This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-24
Channels
- # beginners (17)
- # calva (29)
- # clojure-europe (37)
- # clojure-germany (11)
- # clojure-norway (24)
- # datalevin (11)
- # datascript (2)
- # fulcro (13)
- # hoplon (8)
- # humbleui (7)
- # hyperfiddle (6)
- # keechma (2)
- # malli (5)
- # nextjournal (4)
- # off-topic (10)
- # polylith (12)
- # releases (1)
- # shadow-cljs (13)
- # squint (106)
- # yamlscript (1)
Hello, I've noticed a slight variance in behavior regarding deps.cljs
when I execute a watch command from the command line (e.g., shadow-cljs watch app
) compared to running it via the API (e.g., (shadow/watch :app)
). It appears that the latter disregards any additional deps.cljs
dependencies originating from ClojureScript packages. Is this the intended behavior?
The deps.cljs logic seems to be originating from the below main
function (via install-deps
), which made me think this might be the entry point for the standalone cli invocation, and this is why is not available by the API?
https://github.com/thheller/shadow-cljs/blob/7f6bec693c1914c8eb463f6016cfa871ffb593d2/src/main/shadow/cljs/devtools/server/npm_deps.clj#L167-L182
I don't consider this as something you should rely on for anything, so frankly I regret even adding it, the automatic install that is. it should have been a manual command
Right, in my situation I was very much surprised first to see package.json
automagically updating itself when the shadow starter app was consuming a package that had a eps.cljs
. It took me some time of head scratching to find out where this was coming from. I was equally surprised a second time when I tried to consume the same package from another starter app which was invoked via the API, but nothing happened.
So I wasn't introducing a deps.cljs
, but consuming one from an external package, and since I didn't know about this feature, it was confusing.
Seems like a good feature though, to be able to automatically induce the npm dependencies of an external clojurescript package.
I can think of some options going forward 1. Update the message when the update happens to indicate this is comfing from a deps cljs file, currently the message is
$ shadow-cljs watch dev
...
shadow-cljs - starting via "clojure"
running: cmd /C yarn add --exact ...
which does not indicate to the user where this update is coming from (I didn't even realilize this is coming from shadow)
2. Update the API call so that it also considers deps.cljs
3. Update relevant section documentation to indicate any difference in behavior calling from CLI/API, and perhaps put a note that this feature has some issues (linking to GH issue?) and should be avoided