Slyte CLI - a command line tool, used to create, build and manage an application in Lyte.
npm install -g @slyte/cli@<<version>>
lyte new my-app
This command will create a new directory called my-app with default lyte files and folders such as routes,components,build.js(build configuration file) and package.json(contains all the lyte dependencies)
lyte build <<options>>
Options:
--production(string) - In production, js files (routes, models, components etc) will be concatenated and minified as per configurations provided by the user in configuration files provided inside build folder.
--development(string) - In development, js files will be only concatenated as per configurations provided by user in json file under build folder.
Note : Default value is development.
--watch(string) - Watches the files for changes and automatically builds the application.
Note : Default value is false.
Building of application is based on the procedures mentioned in build.js(build/build.js in the application directory, a procedure file for building application). where you can also write your own build procedures.
lyte serve
This will launch a development server and serves the built app at http://localhost:3000/ by default.Port can be changed using
lyte serve --port <<port_no>>
lyte generate <<route|component|helper|mixin|connector|serializer|schema>> <<name>>
For route generation, two optional parameters are possible lyte generate route << name >> << path >> , if not specified path will be generated based on the route name. While route generation, router.js will be updated.
lyte generate route <<route_name>> <<route_path>>
lyte generate route blog /blog
lyte generate route blog.list /list //Will create a sub route inside blog route.
lyte generate route blog.view view/:blogId //A dynamic route
lyte gnereate route blog.reviewed /blog?review=true //Default query param is passed.
Specifying folders :
We can specify the folder using -d options, this is available for the all the modules except route.
lyte generate component <<component_name>>
lyte generate component blogger-comp -d blogFolder //We can also specify the folder.
lyte generate schema bloglist -d blogFolder //Which will create bloglist schema inside blogFolder.
Note : Component name should be hyphenated. It should not contain capital letters and special character except hyphen. Similarly Helper names should not be hyphenated.
lyte destroy <<route|component|helper|mixin>> <<name>>
If you have created a component inside a folder, it is mandated to specify the same during destroy as well for example:
lyte destroy component blogger-comp -d blogFolder