This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-26
Channels
- # asami (3)
- # babashka (3)
- # beginners (45)
- # boot (3)
- # calva (6)
- # clojure (26)
- # clojure-dev (16)
- # clojure-europe (15)
- # clojure-norway (6)
- # clojure-uk (6)
- # clojurescript (34)
- # community-development (4)
- # conjure (3)
- # datascript (4)
- # datomic (4)
- # emacs (21)
- # events (1)
- # fulcro (16)
- # graalvm (5)
- # jackdaw (1)
- # kaocha (5)
- # lsp (74)
- # malli (8)
- # nbb (37)
- # off-topic (50)
- # pathom (5)
- # reagent (19)
- # ring (1)
- # shadow-cljs (60)
- # sql (3)
Hi, I'm trying to require a shadow-cljs project A into another shadow-cljs project B. Project A has an npm dependency on a git repo as described https://stackoverflow.com/questions/14187956/npm-install-from-git-in-a-specific-version. Project B doesn't seem to download this dependency when built. I also tried using the :npm-deps
approach but it doesn't make a difference. I know I can just add the dependency manually to B but it increases the likelihood I update the npm package in one project but not the other. I was wondering if this is a known issue. Maybe it's a specific to this git approach of declaring an npm dependency.
I put in my src
folder in a file called deps.cljs
I never tested git dependencies myself so no clue if there is some special care that needs to be taken regarding those
When in the course of building project B does shadow prompt an npm install my-package
given that a required library A, requires some package my-package
?
not "in the source of building project B" no. when starting shadow-cljs in project B is collects all deps.cljs
files on the classpaths and then runs npm install
for the packages found there, unless they are already declared as dependencies in the project B package.json
can shadow support more complicated layouts where shadow.edn is not in the root and some of the sources are located relative to its location, think polylith where you would have shadow-cljs.edn in the project folder but the src's will be located in component or bases folder so this type of layout https://polylith.gitbook.io/poly/architecture/workspace
shadow-cljs.edn needs to be in the place where you run it. it doesn't care how you construct your classpath otherwise if you use deps.edn, so it doesn't matter at all where the sources are
I don't know polylith otherwise to answer more specifically but looks to me like shadow-cljs.edn should be next to the workspace.edn? or whereever you run your project normally
given the architecture you could have multiple seperate shadow projects so you would create a project for each and include the components you want to share, so i believe project would be the correct place then to add ../../bases/base1/ and ../../components/ perhaps to the :source path key in shadow ?
currently my project works but I don't get the hot reloading on any components, only on code inside the base
yeah sorry I do not understand what you are saying because I'm not familiar with the polylith terms
I would assume that you just use deps.edn to manage dependencies and only control builds in shadow-cljs.edn
perhaps the issue is that you have multiple deps.edn files, so a project has a deps.edn which includes the bases and components it uses, bases and components can also have there own separate deps.edn
so the projects deps.edn does not specify the src in :paths key its specified in the bases and components deps.edn files if that makes sense
yes correct so entries like this poly/web-ui {:local/root "../../components/web-ui"}
ok, and that deps.edn file is in the same dir as the shadow-cljs.edn file and you also run shadow-cljs in that dir?
and you have :deps {:aliases [:whatever :aliases :you :need]}
in said shadow-cljs.edn
yeah well i actually have it in bases as wel but thats from trying to make it work how I expect 🙂
so a project has no code its just build files, bases is more like the curated app code built from components
or another way of thinking about it is the project pulls together the src from the base and components into a buildable artifact,
I may not be explaing this overly well 😕
part of the reason I have a shadow-cljs.edn file is actually for jack-in because when you jackin to a src file it search up the tree, there may be a better way than this though I would be happy to use the shadow file from a base anyway, its more about how I can make the code reload work on components
I was hoping some one had walked this path previously 😕
@olymk2 shadow-cljs is only interested in the classpath. and it should reload all files from the classpath, excluding all .jar files or git deps. so it should just work
I’m having a hard time getting a repl going in a pulumi project. shadow-cljs watch
works and I can connect to it. But am having difficulty getting a runtime for it. I have tried https://stackoverflow.com/questions/58060822/how-to-connect-a-clojurescript-node-repl-to-my-node-library-shadow-cljs-project but it then tells me that i need to run it with pulumi
then when I run pulumi watch
I get the error pulumi watch is not currently supported on darwin/arm64
. Can anyone think of a way around this?
okay thanks I will play around a bit more see where I get to, could be something I have done
if a base looks something like this then it doesn't seem like something runnable? https://github.com/seancorfield/usermanager-example/tree/polylith/bases/web
so I guess a project looks like something thats actually runnable? https://github.com/seancorfield/usermanager-example/blob/polylith/projects/usermanager/deps.edn
yeah exactly that, it seems like the shadow-cljs.edn should sit in project, I know it has been gaining some traction of late as a way of organizing code but the cljs version is not as smooth as the clj code from my own experience, especially when it comes to things like jacking in to a cljs project, I know calva got support for polylith so that could be a cider issue
@dgonsalves22 sorry, I don't even know what pulumi is. could be that it just runs the code in such a containerized way that the actual runtime isn't able to connect back to shadow-cljs, which is required for the REPL to work
all good, If i figure out a solution i’ll post it in a thread of my original question
I'm getting this weird error for any shadow-cljs
version >= 2.17.8
and it happens on two different projects as well.
➜ domo git:(develop) ✗ npm run shadow:watch:app
> [email protected] shadow:watch:app
> shadow-cljs -A:cljs:dev-cljs:test-cljs watch app
shadow-cljs - config: /home/albertobalsalm/IdeaProjects/domo/shadow-cljs.edn
shadow-cljs - starting via "clojure"
shadow-cljs - HTTP server available at
shadow-cljs - HTTP server available at
shadow-cljs - server version: 2.19.8 running at
shadow-cljs - nREPL server started on port 7002
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
Failed to inspect file
/home/albertobalsalm/IdeaProjects/domo/node_modules/highlight.js/lib/languages/isbl.js
it was required from
/home/albertobalsalm/IdeaProjects/domo/node_modules/highlight.js/lib/index.js
Errors encountered while trying to parse file
/home/albertobalsalm/IdeaProjects/domo/node_modules/highlight.js/lib/languages/isbl.js
{:line 1, :column 1, :message "The file could not be parsed as JavaScript."}
RuntimeException: Exception parsing "/home/albertobalsalm/IdeaProjects/domo/node_modules/highlight.js/lib/languages/isbl.js"
com.google.javascript.jscomp.parsing.ParserRunner.parse (ParserRunner.java:148)
com.google.javascript.jscomp.JsAst.parse (JsAst.java:156)
com.google.javascript.jscomp.JsAst.getAstRoot (JsAst.java:62)
shadow.build.closure.JsInspector.getFileInfo (JsInspector.java:180)
shadow.build.closure.JsInspector.getFileInfoMap (JsInspector.java:194)
shadow.build.npm/get-file-info*/fn--12302 (npm.clj:452)
shadow.build.npm/get-file-info* (npm.clj:451)
shadow.build.npm/get-file-info* (npm.clj:401)
shadow.build.npm/get-file-info (npm.clj:512)
shadow.build.npm/get-file-info (npm.clj:509)
shadow.build.npm/find-resource-in-package (npm.clj:726)
shadow.build.npm/find-resource-in-package (npm.clj:686)
shadow.build.npm/find-resource (npm.clj:776)
shadow.build.npm/find-resource (npm.clj:739)
shadow.build.resolve/find-npm-resource (resolve.clj:122)
shadow.build.resolve/find-npm-resource (resolve.clj:93)
shadow.build.resolve/eval14402/fn--14405 (resolve.clj:262)
clojure.lang.MultiFn.invoke (MultiFn.java:244)
shadow.build.resolve/find-resource-for-string (resolve.clj:80)
shadow.build.resolve/find-resource-for-string (resolve.clj:69)
shadow.build.resolve/resolve-string-require (resolve.clj:453)
shadow.build.resolve/resolve-string-require (resolve.clj:436)
shadow.build.resolve/resolve-require (resolve.clj:668)
shadow.build.resolve/resolve-require (resolve.clj:661)
shadow.build.resolve/resolve-deps/fn--14351 (resolve.clj:51)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:42)
shadow.cljs.util/reduce-> (util.clj:41)
shadow.build.resolve/resolve-deps (resolve.clj:49)
shadow.build.resolve/resolve-deps (resolve.clj:33)
shadow.build.resolve/resolve-string-require (resolve.clj:478)
shadow.build.resolve/resolve-string-require (resolve.clj:436)
shadow.build.resolve/resolve-require (resolve.clj:668)
shadow.build.resolve/resolve-require (resolve.clj:661)
shadow.build.resolve/resolve-deps/fn--14351 (resolve.clj:51)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:42)
shadow.cljs.util/reduce-> (util.clj:41)
shadow.build.resolve/resolve-deps (resolve.clj:49)
shadow.build.resolve/resolve-deps (resolve.clj:33)
shadow.build.resolve/resolve-symbol-require (resolve.clj:655)
shadow.build.resolve/resolve-symbol-require (resolve.clj:615)
shadow.build.resolve/resolve-require (resolve.clj:665)
shadow.build.resolve/resolve-require (resolve.clj:661)
shadow.build.resolve/resolve-entry (resolve.clj:675)
shadow.build.resolve/resolve-entry (resolve.clj:674)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:42)
shadow.cljs.util/reduce-> (util.clj:41)
shadow.build.resolve/resolve-entries (resolve.clj:689)
shadow.build.resolve/resolve-entries (resolve.clj:680)
shadow.build.modules/resolve-module/fn--15659 (modules.clj:252)
shadow.build.modules/resolve-module (modules.clj:248)
shadow.build.modules/resolve-module (modules.clj:238)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.build.modules/resolve-modules (modules.clj:258)
shadow.build.modules/resolve-modules (modules.clj:257)
shadow.build.modules/analyze (modules.clj:312)
shadow.build.modules/analyze (modules.clj:303)
shadow.build/resolve (build.clj:459)
shadow.build/resolve (build.clj:453)
shadow.build/compile (build.clj:509)
shadow.build/compile (build.clj:493)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:368)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:349)
shadow.cljs.devtools.server.worker.impl/eval17412/fn--17414 (impl.clj:448)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--17170/fn--17171/fn--17179 (util.clj:269)
shadow.cljs.devtools.server.util/server-thread/fn--17170/fn--17171 (util.clj:268)
shadow.cljs.devtools.server.util/server-thread/fn--17170 (util.clj:241)
java.lang.Thread.run (Thread.java:829)
Caused by:
StackOverflowError:
com.google.javascript.jscomp.parsing.IRFactory.parseJSDocInfoOnTree (IRFactory.java:695)
com.google.javascript.jscomp.parsing.IRFactory.transform (IRFactory.java:784)
com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.processBinaryExpression (IRFactory.java:1800)
...
From what I understand re-frame-10x
depends on re-highlight
which in turn depends on highlight.js
. I tried with multiple versions of highlight
in my package.json
as well but with no success.@silencioseu its not the highlight.js version you need to change. its the re-frame-10x or re-highlight version
see https://github.com/thheller/shadow-cljs/issues/1015 https://github.com/thheller/shadow-cljs/issues/1031
@thheller You were right, I've fixed this by bumping both re-frame-10x and re-highlight version to their latest versions (re-highlight was a transitive dependency now I have it explicitly)
@thheller When i tried to bump on re-frame-10x only it didn't work.
Nvm it looks like it still happens
@thheller Yep bumping the stack size in my deps.edn
seems to have done the trick
its probably still worth investigating what is including that file, best via a build report https://shadow-cljs.github.io/docs/UsersGuide.html#build-report. if its actually still in the release build that is.
Why would that be a non issue with older shadow versions though?
its an issue with the closure compiler. dunno what change there caused this problem to happen, but can't go back to older versions of it since we want some of the newer fixes fixing other problems 😛
but I had hoped that just not include the file in the first place would be a better fix
turns out that it comes up much more often than anticipated. so I might have to work around it after all
Goodnight, fix 8s good enough for me
I don't know how to exclude files from highlight js, even though I'm probably using only one of them