Fork me on GitHub
#shadow-cljs
<
2023-11-23
>
itaied13:11:19

how can i set different deps (using deps.edn) for different buids? For example, build :app use all the deps in deps.edn but I want another dependency for the build :tool

thheller13:11:27

that is not supported and also not necessary, just enable all aliases you need always. deps.edn does not control what the build ends up using, so extra dependencies hurt no one

itaied13:11:22

ok I see. Now I understand that what I actually need is to build a node binary (executable). I'm a bit confused between node-library and npm-module

itaied13:11:16

I want to build a project, publish it to npm, and then in another project install it and execute as a binary (I guess it has to be via yarn or npm and not deps.edn, since I don't want to build it again)

thheller13:11:39

sounds like you want :node-script?

thheller13:11:19

I recommend creating a dedicated packages/the-thing folder with its own package.json

thheller13:11:35

then you make :node-script build with :output-to "packages/the-thing/index.js"

thheller13:11:45

then you npm publish in the packages/the-thing folder

thheller13:11:55

and others can npm install the-thing

thheller13:11:31

you can add a "bin" entry in package.json so others can run npx the-thing foo bar to execute

itaied13:11:12

ok ill try that, thanks again

thheller13:11:40

thats more or less how you get the shadow-cljs command, see https://github.com/thheller/shadow-cljs/tree/master/packages/shadow-cljs

itaied15:11:30

What should be in the npm package when I publish? At first I thought only out and bin, but then I received the error

/home/app/dev/deps/apps/drift-v2/node_modules/@deps/deps-ops/.shadow-cljs/builds/main/dev/out/cljs-runtime/goog.debug.error.js
I guess I need to add the folder .shadow-cljs as well for the cljs runtime, right?

thheller19:11:09

thats why I suggested to use the packages/the-thing folder. Only what is in that you need

thheller19:11:26

not the cljs source files, not shadow-cljs, not .shadow-cljs, nothing else

thheller19:11:47

and only publish npx shadow-cljs release ... builds, not the development versions

thheller19:11:11

see how that only has the cli/dist.js file generated by shadow-cljs and the manually written helper files, nothing else