I’m trying to make the following work:
-
projectA
is a Javascript project with apackage.json
etc.; runningnpm install && npm run-script build
compiles it to some.js
files in./dist
.
I’ve packaged this up as a nix package. Its output is that./dist
folder. -
projectB
is a second Javascript project that depends onprojectA
. This is currently encoded by having"projectA": "file:../projectA"
inpackage.json
; now I can buildprojectB
against the version ofprojectA
that happens to have been built locally. This kind of works for development but is clearly a bit of a mess.
I don’t know how to package this as a nix package. (Well, I’ve hacked around it by checking in the build output for now.)
What I would like is to be able to have projectB
depend on projectA
on a nix level. E.g. when using flakes, make the projectA
git repo an input to projectB
. (While also dealing with regular npm dependencies somewhat conveniently.) Does anyone have an example of a setup like this? Is it a bad idea?
(I think what I’m fundamentally struggling with is that npm doesn’t build dependencies, but only copies them over. So it expects me to either release the build output of projectA
somewhere before I can depend on it, or to depend on the source of projectA
directly. Does that seem accurate?)