I have cljc code, that I want to publish as a library. The cljs part uses some npm dependencies. What is recommended way to deal with the npm depenencies? Is it possible to bundle them with the library? Or is it possible to add the dependency information, so that shadow-cljs as a consumer of the library can fetch the npm deps. Or there is no way to add the deps and I should mention in the docs that a library consumer must add deps xzy to its package.json file?
you can add a deps.cljs file to the library jar and have that include {:npm-deps {"that-dep" "the-version"}}
shadow-cljs will by default run npm install that-dep@the-version if it finds such a file
Thanks. I will give it a try.
Where in the src-tree do I have to place that file?
in the jar at the root
I have a file called deps.cljs with this content at my jar root
{:npm-deps {"three" "0.143.0"}}
at the jar root. but the dependency does not get installed. Do I have to some more settings? And for information I am using electric v3 , so electric starts shadow,but from what I can see, that should not matter, or should it?that does matter. no clue how electric starts shadow, but it could easily be skipping that install step
(shadow-server/start!)
(shadow/watch :dev)shadow-cljs.edn is:
{:builds
{:dev {:target :browser
:devtools {:loader-mode :default, :watch-dir "resources/public/electric_starter_app"}
:output-dir "resources/public/electric_starter_app/js"
:asset-path "/js"
:modules {:main {:entries [dev] :init-fn dev/start!}}
:build-hooks [(hyperfiddle.electric.shadow-cljs.hooks3/reload-clj)]}
:prod {:target :browser
:output-dir "resources/public/electric_starter_app/js"
:asset-path "/js"
:modules {:main {:entries [prod] :init-fn prod/start!}}
:module-hash-names true}}}yes, that bypasses it
this is the function that handles the install. I guess you could call it manually
Yes. Running npm-deps/main manually worked. Thank you very much for your support and advice 🙂
Is there a luminous template or some other template to create a GCP Serverless NodeJS project that runs on GCP backed by Firebase and uses simple EJS or SELMER templates and no Reagent/Reframe/React?