PNPM should prioritize linking local (private) packages in repo instead of installing external packages
- Clone this repo.
- Run
pnpm recursive install
. - Run
node index.js
.
After step 2, pnpm
should link /tools/foo
to /tools/bar/node_modules
.
After step 3, /index.js
should calls /tools/bar/index.js
which in turn calls /tools/foo/index.js
which prints 'foo'
.
After step 2, pnpm
installs an actual foo
package from npm registry which is not what I needed.
Repo Overview
-
This is a multi-packages repo.
-
Directory [
/tools
] contains packages that are used as tools in dev environment (e.g. to assist testing, or to validate packages before publishing, etc.) and therefore have"private": true
in theirpackage.json
. -
Package
/tools/bar
depends onfoo
(/tools/foo
).
Folder structure:
.
├── index.js
├── pnpm-workspace.yaml
├── README.md
└── tools
├── bar
│ ├── index.js
│ └── package.json
└── foo
├── index.js
└── package.json
Why do I want this?
- It is nicer to call package by their names instead of write out full paths to their files.
- It allows me to isolate their dependencies from production packages' dependencies.
- It makes it easier for me to know whether a dependency is still neccessary.
Why don't I just rename to package or increase version to really high?
- It doesn't work in a long term.