Serves and builds an app with Google Closure Compiler/Library/Templates. An alternative to plovr.
Status: WIP
$ npm i -D @teppeis/duck
duck <command>
Commands:
duck serve [entryConfigDir] Start dev server
duck build [entryConfigDir] Compile Soy and JS files
duck build:js [entryConfigDir] Compile JS files
duck build:soy Compile Soy templates
duck build:deps Generate deps.js
duck clean:soy Remove all compiled .soy.js
duck clean:deps Remove generated deps.js
duck completion Generate completion script for bash/zsh
Options:
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
CLI options overwrite config file
duck serve [entryConfigDir]
Start dev server
Options:
--inputsRoot A root directory to serve [string]
--closureLibraryDir Closure Library directory [string]
--depsJs A path to deps.js to save and load [string]
--skipInitialSoy, -s Skip initial compiling of Soy templates [boolean] [default: false]
--port A port number to listen [number] [default: 9810]
--host A host to listen [string] [default: "localhost"]
--config A path to duck.config.js, the extension can be ommited [string]
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
duck build [entryConfigDir]
Compile Soy and JS files
Options:
--entryConfigs, -e Entry config files (this option ignores entryConfigDir) [array]
--closureLibraryDir Closure Library directory [string]
--config A path to duck.config.js, the extension can be ommited [string]
--concurrency, -c Concurrency limit for compiler [number] [default: 1]
--depsJs A path to deps.js to save and load [string]
--printConfig, -p Print effective configs for compilers [boolean] [default: false]
--soyJarPath A path to Soy.jar [string]
--soyFileRoots Root directories of soy files [array]
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
Also see examples/chunks
.
Create a self-signed certificate like
# https://stackoverflow.com/a/10176685
$ openssl req -x509 -newkey rsa:4096 -keyout duck-key.pem -out duck-cert.pem -days 365 -nodes -subj '/CN=localhost'
Then specify them and enable http2
in duck.config.js
.
module.exports = {
http2: true,
https: {
keyPath: './path/to/duck-key.pem',
certPath: './path/to/duck-cert.pem'
}
};
Initial setting:
$ duck completion >> ~/.bashrc
# or
$ duck completion >> ~/.zshrc
Then, you can complete commands and options with TAB !
$ duck build:<TAB>
build:deps -- Generate deps.js
build:js -- Compile JS files
build:soy -- Compile Soy templates
MIT License: Teppei Sato <teppeis@gmail.com>