This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-08
Channels
- # aleph (2)
- # announcements (2)
- # asami (50)
- # babashka (39)
- # beginners (17)
- # calva (61)
- # cider (9)
- # clj-kondo (5)
- # clojure (37)
- # clojure-europe (52)
- # clojure-nl (1)
- # clojure-norway (14)
- # clojure-uk (5)
- # clojurescript (28)
- # cursive (3)
- # datahike (11)
- # datomic (28)
- # deps-new (11)
- # events (3)
- # fulcro (18)
- # google-cloud (1)
- # graphql (8)
- # introduce-yourself (4)
- # jobs (2)
- # leiningen (7)
- # lsp (15)
- # pathom (9)
- # re-frame (6)
- # reagent (35)
- # reitit (17)
- # releases (1)
- # shadow-cljs (20)
- # specter (1)
- # test-check (106)
- # tools-deps (8)
- # uncomplicate (1)
- # vim (29)
👋 Hi there, I’m an experienced Clojure dev and I’m working on my first CLJS project, which is sort-of a CLI tool that runs on/in Node.
Sorry if this is a FAQ or a silly question, but is there a way to use shadow to run a CLJS project with node, recompiling if necessary, as opposed to just (re)compiling the project? My goal is to ensure that people can check out the repo hosting this tool and run it immediately in a single step, and also that if they make changes to the code and then run the tool again, the changes will be picked up.
If the answer is just, write a script that first (re)compiles the program and then runs the program, that’s fine. I’m only asking because I’m used to the model provided by Clojure CLI tools (i.e. the clojure
script) wherein I can use it to run my project, compiling it on the fly every time I run it; and I find that convenient.
Thanks!
outside of shadow-cljs, you can use a self hosted version of cljs like lumo, although I fear it has fallen into an unmaintained state
both of these would allow someone to clone your repo and run the script in a single command
if you'd rather stick with compiled CLJS, then having a build script that compiles and runs it
I strongly recommend using a compiled script distributed to npm. instead of compiling from source on the end users machine.
otherwise you have to pay the startup cost of the JVM every time which will make the CLI tool unusably slow (if you care about startup time)
checking out the source and compiling it can still be done, just shouldn't be the default
I’m leaning towards a script that looks sort of like shadow-cljs start && shadow-cljs compile <build> && node path/to/compiled/script.js
that way if it’s run multiple times it’ll be fast because the server is running in the background
I’ve been using a script that does something similar during development and it’s been working well for me
Ah also WRT this: > …using a compiled script distributed to npm. I don’t think I can do this in this case because this is a private, proprietary, internal tool.