1. Create a directory on the host machine to serve as the global repo
(I like to make a docker dir and put all of my volumes in it)
mkdir -p ~/docker/volumes/yalc
2. Mount the volume in both (or more) dev containers
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
3. Install yalc and publish the package (In dependency repo 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
4. Link to the package in consuming repo
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