command line utility for working with LightScript code & packages
note: this project is a work in progress and, while usable, is not considered entirely stable
$ npm i -g lightscript-cli
lightscript command is then available from anywhere, as well as
the shorter form
# compile an input file to an output file$ lsc compile file.lsc -f file.js# compile a directory of files to an output directory$ lsc compile src -d dist# use additional Babel presets or plugins$ lsc compile src -d dist --presets react --plugins partial-application# do not use existing .babelrc file$ lsc compile src -d dist --no-babelrc# do not apply `babel-preset-env`$ lsc compile src -d dist --no-env-preset# look up a configuration file (ie. `lightscript.config.lsc`)$ lsc compile -c# specify a path to a configuration file$ lsc compile -c build/lightscript.config.lsc
Note that, by default,
lightscript-cli will use Babel's usual
.babelrc lookup behavior, and merge this with its internally
provided configuration. This means that if there is a
file present, those presets & plugins will be added after the
lightscript plugins. You can use the
--no-babelrc flag to disable this.
babel-preset-env is also applied by default, but can be disabled
run LightScript code or files containing LightScript code (similar to
node -e <code | file>)
# evaluate the given code and output the result$ lsc eval "f = (x, y) -> x + y; f(1, 2)"# run the given file and output the result$ lsc eval build.js# same as above, using the `run` alias$ lsc run build.js
kickstart a LightScript package
This command currently has no function - input is needed as to how it should work and what it should do under various circumstances.
See this issue to join the discussion.
start an interactive REPL for evaluating LightScript code (similar to the
$ lsc repl> fn = (x, y) -> x + y'use strict'> fn(1, 2)3
Similar to webpack, you can create a config file for a more clear,
reusable, & dynamic way to apply options. When passed the
-c flag without a parameter,
search for a config file within the current working directory in
the following order:
lightscript.config.lsc allows you to use LightScript
syntax to define your configuration. For example:
comments = processenvNODE_ENV == 'development'export defaultinputs: 'src/**/*''!src/*.spec.lsc'directory: 'dist'envPreset: falsebabel:babelrc: falsecommentsplugins
The above configuration allows you to run only
lsc compile -c. The CLI
would locate this file and compile the
babel-preset-env or any existing
It also shows a tiny example of dynamic configuration by deciding whether or not to output comments based on environment.
You can also specify a config file by passing a parameter with the flag:
$ lsc compile -c build/compile-config.lsc
git clonecd lightscript-clinpm run buildnpm link
This will make your local development copy available globally.
Pull requests and any issues found are always welcome.
- Fork the project, and preferably create a branch named something like
- Modify as needed, where
srccontains the LightScript source of the project
- Make sure all tests continue to pass, and it never hurts to have more tests
- Push & pull request! 🎉
MIT © Bo Lingen / citycide