-
Notifications
You must be signed in to change notification settings - Fork 21
Command line interface
Rich-Harris edited this page Nov 22, 2014
·
3 revisions
You can use Esperanto as a node.js module, or via the command line interface. To use the CLI, you must first install Esperanto globally:
npm install -g esperanto
This will give you access to the esperanto
command.
For help, run esperanto -h
or esperanto --help
.
-v, --version Show version number
-h, --help Show help message
-i, --input Input file (if absent, reads from stdin)
-o, --output <output> Output file (if absent, prints to stdout)
-t, --type [amd] Type of output (amd, cjs, umd)
-s, --strict Use strict mode
-b, --bundle Create a bundle including <file>'s dependencies
-n, --name Name for UMD export
-m, --sourcemap Generate sourcemap (`-m inline` for inline map)
-d, --basedir=<basedir> Base directory for module resolution
-k, --skip=<files...> Comma-separated list of files to skip (relative to basedir)
esperanto -i src/input.js > output.js
esperanto -i src/input.js -t cjs > output.js
Note: You must supply a --name
or -n
option for the exported value.
esperanto -i src/input.js -t umd -n myModule > output.js
esperanto -i src/input.js -s > output.js
esperanto -i src/input.js -o path/to/nonexistentdir/output.js
Note: You must specify --input
(-i
) and --output
(-o
) options rather than reading from stdin/writing to stdout.
# This will create an output.js.map file in addition to output.js
esperanto -i src/input.js -m -o output.js
# This will add the sourcemap as an inline data URI to output.js
esperanto -i src/input.js -m inline -o output.js
esperanto -i src/input.js -b > output.js