I'm thinking about refactoring the CLI options so that you can run multiple commands with one go.
Something that would reduce left to right maybe.
shadow-cljs --once a --start b --start c --repl c
:a once:b:c:cCurrently this would require running shadow-cljs 4 times. With --server this doesn't matter as much but I think it would be useful to be able to start multiple things at once.
Compile 3 builds once and exit
shadow-cljs once a,b,c
shadow-cljs release a,b,c
Compile and watch 3 builds, stays alive until killed
shadow-cljs watch a,b,c
Connect to REPL of build c
shadow-cljs cljs-repl c
Start or connect to running node-repl that isn't tied to any build
shadow-cljs node-repl
Start background server so all other commands get faster (watch will act as server if none is running)
shadow-cljs server
Connect to CLJ REPL of server
shadow-cljs clj-repl
watch or dev or autobuild?server launch into a clj-repl or stay non-interactive?server allow additional commands? shadow-cljs server watch a,b,c?watch|once|release be optional and default to "all"?I was a CoffeeScript fan, I would vote for compile(--once) and watch(--dev). And by default it compiles.
I just finished the first pass of the CLI refactor. Pretty much all the old options are gone. Running the command now looks like
$ shadow-cljs
shadow-cljs - config: /Users/zilence/code/shadow-cljs/shadow-cljs.edn version: 1.0.20170618
shadow-cljs - connected to server
Please specify which action to run!
Usage:
shadow-cljs <action> <zero or more build ids>
Supported actions are:
compile - ...
watch - ...
check - ...
release - ...
node-repl - ...
cljs-repl - ...
clj-repl - ...
server - ...
Options:
-----
--npm internal, used by the shadow-cljs npm package
--debug
-v, --verbose verbose build log
-h, --help
-----
Still need to write the docs for each action. Here are some example commands
# starts a server process, do this first so everything else is faster
shadow-cljs server
# assuming there is an :app build defined
shadow-cljs compile app
shadow-cljs watch app
shadow-cljs check app
shadow-cljs release app
# all of these can do more than one build
shadow-cljs compile build1 build2 build3
# this connects to a REPL for :app
shadow-cljs cljs-repl app
# node-repl (starts or connects)
shadow-cljs node-repl
# clojure repl
shadow-cljs cli-repl
[email protected] includes this now. I could use some feedback if it is actually better than before.
I broke the zero-configuration hidden default :npm build and I'm not sure it worth adding back. Previously if you just ran shadow-cljs --once it compiled this "hidden" :npm build which didn't need to be in your config. shadow-cljs compile will complain if you don't give it a build id.
Currently you'd need to add this :npm build and run shadow-cljs compile npm.
{:source-paths ["src"]
:builds
{:npm {:target :npm-module
:output-dir "node_modules/shadow-cljs"}}}
Any thoughts on what commands should do when you don't specify a build? Should it default to all or nothing?
How about allowing users to add an entry called :default? I don't see a real-world example though.
Not going to do the :default for now. It is ok to type shadow-cljs compile npm and the implicit npm build is back now so the config for this is optional. Just needs to be documented properly.
Most helpful comment
I just finished the first pass of the CLI refactor. Pretty much all the old options are gone. Running the command now looks like
Still need to write the docs for each action. Here are some example commands