[Discuss] intention on replacing my npm scripts with clj CLI

Previous conversation on Slack https://clojurians.slack.com/messages/C6N245JGG/

things are different on this side in ClojureScript. when I was using CoffeeScript, it compiles to JavaScript and everything runs in JavaScript, most of the tools are fast(except for Webpack), we just start processes and kill processes like we did in Unix. That was mentally very easy.

[10:05]
I still can’t fit into Java world, to found Clojure starts so slowly, and ClojureScript compilation takes so much time. Again I know the author of BuckleScript, who put emphasis on performance in building his compiler.

[10:06]
since it’s reality that compilation takes time, I would eventually accept that fact, and change my scripts to reduce the cost in time. (edited)

[10:10]
since there’s cli release with a decent documentation, I would like to take a spin and see if that works in my case: replacing my npm scripts.

[10:11]
clj command takes about 2s to run in my machine, that’s acceptable. And it’s much better than Boot visually.

[10:15]
shadow-cljs takes long time to start too. It’s reasonable to start a compiler with so much time, but not fast enough for scripts.

[10:19]
you see, quick startup might not be significant for your cases, but it matters when someone does want to get result very quickly, like for beginners when they are learning Clojure or exploring new features. Or even for people like us, writing ClojureScript in the fractional time during job, I need to switch quickly…

@thheller

@Jon so my “solution” to this is just having a server running. just do a comparison. a) time yarn your-scripts b) run yarn shadow-cljs server, in another terminal time yarn your scripts. The difference should be substantial when the server is running since you only pay for startup once. (edited)

server management itself is a bit annoying at the moment but I’m working on improving that

I tried. The time was cut from 10s+ to 2s in one of my project with caches for compilation. In many occasions I would release my projects with the server running.

so there might be a shadow-cljs start|stop|restart at some point which starts a background server so you could modify your scripts to first call start, then do all the rest, then call stop. (edited)

I would start a watch server and keep it running actually. I think I would rely on the logs of the server to read its status. If it runs in backend, I can’t see the logs.

besides that I can make shadow-cljs clj-run start as fast as clj, it is slow since it wants to provide easy access to shadow-cljs itself. as soon as you are going to use anything you are going to pay for that startup time again. UNLESS you are using the server instance …

That would be nice. My most frequent use case of Clojure REPL is to try macros, or I would just use Lumo. Besides, now it’s 4 keystrokes away to start a Clojure REPL.

installing shadow-cljs takes about 20sec for me with the new AOT enabled, less than 5sec wit

Bad network. Would you mind adding a processbar?