PNpM CLI
Notes
no notes yet
Features
Shared Monorepo node_modules and shrinkwrap.yaml
By default, when running the pnpm recursive install in a monorepo, pnpm creates a dedicated node_modules and shrinkwrap.yaml for every package in the monorepo. pnpm now allows to set the shared-workspace-shrinkwrap config to true and a single lockfile will be created in the root of your repository.
The shared lockfile also means that all the dependencies will be hard linked into one node_modules in the root of the repo and symlinks will be created from that single node_modules into each project of the monorepo.
Bonus advantages of the new config:
- every dependency is a singleton
- faster installations in a monorepo
- less changes in code reviews
How to configure the new config
- your monorepo has to have a
pnpm-workspace.yamlfile in the root - an
.npmrcfile with the following content should be in the root of the monorepo:
shared-workspace-shrinkwrap = true
; the following is also a nice to have option in a monorepo
; when link-workspace-packages is true, dependencies are linked from the repo, when available
link-workspace-packages = true