This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-15
Channels
- # announcements (1)
- # asami (29)
- # babashka (31)
- # beginners (48)
- # calva (39)
- # cljsrn (4)
- # clojure (56)
- # clojure-dev (51)
- # clojure-doc (3)
- # clojure-europe (40)
- # clojure-gamedev (13)
- # clojure-italy (22)
- # clojure-nl (3)
- # clojure-uk (5)
- # cursive (9)
- # datomic (184)
- # events (7)
- # fulcro (8)
- # graalvm (2)
- # jobs (1)
- # malli (6)
- # meander (1)
- # nrepl (5)
- # off-topic (10)
- # pathom (9)
- # polylith (33)
- # portal (2)
- # re-frame (7)
- # reagent (12)
- # releases (3)
- # remote-jobs (3)
- # reveal (27)
- # shadow-cljs (34)
- # sql (1)
- # vim (7)
- # xtdb (62)
If I use [:js-options :js-package-dirs
to tell shadow about an npm module that a sub project (a :local/root
deps.edn dependency) needs. Do I risk to be using the wrong version of some subdependency that my main project and the subproject both bring in?
I am using yarn to initialize node_modules in all projects. Does that make a difference? Or rather, I should ask what makes this risky.
but why not have the sub project declare its :npm-deps
and manage them in the main project as well
> that at least makes the dependency conflicts visible Meaning, that I might still end up with my subproject using X v1?
gonna have to ask yarn. shadow-cljs is only interested in what it finds in node_modules
. it does not care how it got there
don't overthink it too much though. worst case either means your build breaks immediately or you end up including two version of the same dependency
Thanks so much for all this info, @thheller! It looks like we’re going with :npm-deps
now. I notice that it just works with yarn. Is this something shadow-cljs does or is it the clojurescript compiler that does it? I wonder if I need to somehow make sure it is my yarn.lock file that is updated…
shadow-cljs will call yarn add <npm-dep>@<version>
for declared :npm-deps
if they are not already in package.json
if a yarn.lock
file is found
@thheller is there a way to get deps graph from shadow build? I’ve seen some references to /api/graph
endpoint in shadow’s server code, but couldn’t figure out if it’s something that actually works
@roman01la define deps graph? /api/graph
is for EQL graph queries but its not used much. what specifically are you looking for and at which point? you could easily extract it from the build state via a build hook for example
I see. I’m interested in getting dependency graph including application code, cljs deps and npm deps. For build hook: at which build stage the graph is available in the build state?
I still don't know what you mean by "dependency graph". there is no graph of such kind. the information to construct it is there but shadow-cljs itself maintains no such graph.
in the build state you'll find a :build-sources
vector. those are resource-ids sorted in dependency order
there are other ways to get all this data so I don't know if a build hook is the best choice for whatever you intend to do
I’ll give it a try, thanks! 🙏