Fork me on GitHub
#clojurescript
<
2022-06-02
>
madis13:06:02

I posted some more information in the thread above (pull request with code examples). Maybe a different way to phrase the question makes it easier to answer: How to package CLJS library that depends on NPM library so that the end user gets the NPM library without having to specify it (i.e. by just adding CLJS library the dependency tool (deps.edn, shadow, lein) would find &amp; install the required NPM library)? Is it possible? Where in the published JAR (of the CLJS library) would the information about the NPM library be included (deps.edn, pom.xml, <something else>)?

augustl13:06:13

I think cljsjs is the way to go if you don't want to force the user to do a npm intall

madis13:06:02

NPM install would be fine (besides I think I can automate it). Just that I'd like to find a way to just tell the user "Add [madis/my-cljs-lib "1.0.0"] to your dependencies" and it would work (so it would give the tools information about the NPM libraries needed too). Currently if there are 3 CLJS libraries A => B => C (A depends on B which depends on C) and C depends on NPM library, maintainers of A and B must remember to say & update their documentation with the NPM library and version (even if they never directly access it)

thheller13:06:41

@U03HLRRMXE2 you put a deps.cljs file with {:npm-deps {"that-dependency" "version"}} into the classpath of the library. so src/main or whatever you use. you then publish it as any other clojure lib including that file

thheller13:06:06

so say you have :source-paths ["src/main" ...] that would be src/main/deps.cljs

madis13:06:04

Ohh, I see. Didn't try it that way. Thanks for the advice, trying it now!