cljsjs

2018-06-27T20:09:09.000006Z

I've been working on a library that depends on a node module. It's tests are working fine, but when I try to consume it from another code base, the npm-deps from my compiler config is missing. Do I need to package up the node module as a cljsjs package to have it as a transitive dependency?

juhoteperi 2018-06-27T20:16:43.000129Z

@christian767 No, not necessarily. Simple solution is to tell users of the library to add npm package themselves (npm-deps or manually or anything).

juhoteperi 2018-06-27T20:17:24.000255Z

Transitive :npm-deps are also supported, the library can create deps.cljs file in jar root and :npm-deps from that file is read by consumer projects, IF the apps use :install-deps true option.

juhoteperi 2018-06-27T20:17:51.000153Z

Creating the cljsjs package is also option, if you want to allow users to select if they want to use cljsjs or npm. Reagent does this.

2018-06-27T20:20:32.000027Z

Thanks

2018-06-27T20:21:19.000036Z

Guess I'll make the cljsjs package then, I'd rather my users needn't worry about specifics of my deps

juhoteperi 2018-06-27T20:22:50.000291Z

Yes, I think that allows the broadest support for library now. To allow the lib also be used with npm, you should match the npm names in cljsjs package and use global-exports option: https://github.com/cljsjs/packages/blob/master/create-react-class/build.boot#L25-L28

juhoteperi 2018-06-27T20:23:11.000017Z

With those options the JS lib can be used from Cljs using the same code as npm-deps, so users can use either

2018-06-27T20:23:26.000148Z

Cool, thanks!