Use npm link
for authoring multiple packages simultaneously in docker dev containers
PkgA is a dependency of PkgB, I'm making changes to both. Goal is to be able to link PkgA in PkgB without publishing each small update and re-installing. npm|yarn link solve this, but I'm developing in docker containers.
(I like to make a docker dir and put all of my volumes in it)
mkdir -p ~/docker/volumes/yalc
https://code.visualstudio.com/docs/remote/containers-advanced
devcontainer.json
...
"mounts": ["source=/Users/evan/docker/volumes/yalc,target=/yalc,type=bind,consistency=cached"],
...
and rebuild the container
https://www.npmjs.com/package/yalc
npm i yalc -g
yalc publish --store-folder /yalc
--store-folder tells yalc to publish the repo to our volume
consider adding yalc to .gitignore
first:
.yalc
yalc.lock
Run the link command
npm i yalc -g
yalc link PkgA --store-folder /yalc
Where PkgA
is the name of the package as defined in it's package.json