Node.js v10 support is dropped. At least Node.js v12.17 is required for the package to work.
Arbitrary pre/post hooks for user-defined scripts (such as prestart
) are not executed automatically.
The lockfile version is bumped to v5.3. Changes in the new format:
- Blank lines added between package/project entries to improve readability and decrease merge issues.
- The
resolution
, engines
, os
, and cpu
fields are now always written in a single lines, as the first keys of the package objects.
- A new field is added to the package objects:
transitivePeerDependencies
.
The layout of the virtual store directory has changed (node_modules/.pnpm
) to allow keeping cache in it:
- All packages inside the virtual store directory are on the same depth. Instead of subdirectories, one directory is used with
#
instead of slashes.
- New setting added:
modules-cache-max-age
. The default value of the setting is 10080 (7 days in minutes). modules-cache-max-age
is the time in minutes after which pnpm should remove the orphan packages from node_modules
.
pnpx does not automatically install packages. A prompt asks the user if a package should be installed, if it is not present.
pnpx --yes
tells pnpx to install any missing package.
pnpx --no
makes pnpx fail if the called packages is not installed.
pnpmfile.js
renamed to .pnpmfile.cjs
in order to force CommonJS.
.pnp.js
renamed to .pnp.cjs
in order to force CommonJS.
The pnpm-prefix
setting is removed. Use global-dir
to specify a custom location for the globally installed packages.
The default depth of an update is Infinity
, not 0
.
The --global
option should be used when linking from/to the global modules directory.
Linking a package to the global directory:
- pnpm v5:
pnpm link
- pnpm v6:
pnpm link --global
Linking a package from the global directory:
- pnpm v5:
pnpm link foo
- pnpm v6:
pnpm link --global foo
pnpm's command file's extension changed to .cjs
(bin/pnpm.js
=>bin/pnpm.cjs
).
node-gyp updated to v8.
prepublish
is not executed on a local pnpm install
. Use prepare
instead.
Workspace packages now can be referenced through aliases #2970.
For instance, the package in the workspace may be named foo
. Usually, you would reference it as { "foo": "workspace:*" }
.
If you want to use a different alias, the next syntax will work now: { "bar": "workspace:foo@*" }
.
Before publish, aliases are converted to regular aliased dependencies. The above example will become: { "bar": "npm:foo@1.0.0" }
.
Workspace packages now can be referenced through relative path #2959.
For example, in a workspace with 2 packages:
+ packages
+ foo
+ bar
bar
may have foo
in its dependencies declared as { "foo": "workspace:../foo" }
. Before publish, these specs are converted to regular version specs supported by all package managers.
For better compatibility with prettier, two new default patterns added to public-hoist-pattern
:
@prettier/plugin-*
*prettier-plugin-*
A "pnpm"."overrides"
field may be used to override version ranges of dependencies.
The overrides field can be specified only in the root project's package.json
.
An example of the "pnpm"."overrides"
field:
{
"pnpm": {
"overrides": {
"foo": "^1.0.0",
"bar@^2.1.0": "3.0.0",
"qar@1>zoo": "2"
}
}
}
You may specify the package to which the overriden dependency belongs by separating the package selector from the dependency selector with a ">", for example qar@1>zoo
will only override the zoo
dependency of any qar@1
dependency.
A new setting added for specifying the shell to use, when running scripts: script-shell #2942
When some of the dependencies of a package have the package as a peer depenendency, don't make the dependency a peer depenendency of itself.
Lockfile version bumped to 5.2
Installation of private Git-hosted repositories via HTTPS using an auth token.
pnpm add git+https:
A new setting called recursive-install
was added. When it is set to false
, pnpm install
will only install dependencies in current project, even when executed inside a monorepo.
If recursive-install
is false
, you should explicitly run pnpm install -r
in order to install all dependencies in all workspace projects.
Projects that don't have a "version"
field may be installed as dependencies of other projects in the workspace, using the "workspace:0.0.0"
specifier.
So if there's foo
in the repository that has no version field, bar
may have it as a dependency:
"dependencies": {
"foo": "workspace:0.0.0"
}
By default, all ESLint plugin are hoisted to the root of node_modules
.
eslint-plugin-*
added as one of the default patterns of public-hoist-pattern
.
Improved error message on workspace range resolution error.
Now the path to the project is printed, where the error originated.
🚀 33% faster installation times vs pnpm v4.
In some cases, 2 times faster than Yarn v1! (performance diff of pnpm v4 vs v5)
| action | cache | lockfile | node_modules | npm | pnpm | Yarn | Yarn PnP |
| ------- | ----- | -------- | ------------ | ----- | ----- | ----- | -------- |
| install | | | | 43.3s | 17.5s | 36.7s | 28.6s |
| install | ✔ | ✔ | ✔ | 7s | 1.5s | 735ms | n/a |
| install | ✔ | ✔ | | 18.3s | 7.8s | 10.5s | 1.8s |
| install | ✔ | | | 24.8s | 10.9s | 22.2s | 12.1s |
| install | | ✔ | | 23.2s | 15.2s | 22.4s | 13.4s |
| install | ✔ | | ✔ | 6.4s | 1.8s | 17.1s | n/a |
| install | | ✔ | ✔ | 7.3s | 1.5s | 735ms | n/a |
| install | | | ✔ | 6.4s | 3.1s | 33.2s | n/a |
| update | n/a | n/a | n/a | 7s | 14.5s | 42.6s | 27.6s |
All the benchmarks are here.
A content-addressable filesystem is used to store packages on the disk.
pnpm v5 uses a content-addressable filesystem to store all files from all module directories on a disk. If you depend on different versions of lodash, only the files that differ are added to the store. If lodash has 100 files, and a new version has a change only in one of those files, pnpm update will only add 1 new file to the storage.
For more info about the structure of this new store, you can check the GitHub issue about it.
This change was inspired by dupe-krill and the content-addressable storage of Git.
Reduced directory nesting in the virtual store directory.
In pnpm v4, if you installed `foo@1.0.0, it was hard-linked into
node_modules/.pnpm/registry.npmjs.org/foo/1.0.0/`.
In pnpm v5, it will be hard-linked into `node_modules/.pnpm/foo@1.0.0/`. This new structure of the virtual store directory drastically reduces the number of directories pnpm has to create. Hence, there are fewer filesystem operations, which improves speed.
pnpm store usages
removed.
This command was using information from the store.json
files, which is not present in the new content-addressable storage anymore.
The independent-leaves
setting has been removed.
When hoisting was off, it was possible to set the independent-leaves
setting to true
. When true
, leaf dependencies were symlinked directly from the global store. However, we turned hoisting on by default for pnpm v4, so this feature has no future at the moment.
The resolution-strategy
setting has been removed.
By default, the fewer-dependencies
resolution strategy is used. It was possible to select a fast
resolution strategy. This setting is deprecated to simplify future improvements to the resolution algorithm.
The store and the modules directory are not locked.
We are not using directory locks anymore. So the --no-lock
option will throw an error. Some users had issues with locking. We have confidence that pnpm will never leave either node_modules or the store in a broken state,
so we removed locking.
git-checks
is true
by default.
By default, pnpm publish
will make some checks before actually publishing a new version of your package.
The next checks will happen:
- The current branch is your publish branch. The publish branch is
master
by default. This is configurable through the publish-branch
setting.
- Your working directory is clean (there are no uncommitted changes).
- The branch is up-to-date.
If you don't want this checks, run pnpm publish --no-git-checks
or set this setting to false
via a .npmrc
file.
In case of a crash, the debug file will be written to node_modules/.pnpm-debug.log
(not to pnpm-debug.log
as in v4 and earlier).