-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pnpm update --filter --latest
leads to the lockfile changing for unrelated project and dependencies, when dedupe-peer-dependents
is false
#8877
Comments
pnpm update --filter
leads to the lockfile changing for unrelated workspace packagespnpm update --filter
leads to the lockfile changing for unrelated workspace packages, in a seemingly incompatible way
After some investigation, this seems to be an issue with For example, using an pnpm --filter a update react@latest It updates only diff --git a/packages/a/package.json b/packages/a/package.json
index 1ed69e4..96bf809 100644
--- a/packages/a/package.json
+++ b/packages/a/package.json
@@ -2,7 +2,6 @@
"name": "a",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
@@ -11,6 +10,6 @@
"author": "",
"license": "ISC",
"dependencies": {
- "react": "^18.2.0"
+ "react": "^19.0.0"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b56350f..43e002d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,8 +11,8 @@ importers:
packages/a:
dependencies:
react:
- specifier: ^18.2.0
- version: 18.2.0
+ specifier: ^19.0.0
+ version: 19.0.0
packages/b:
dependencies:
@@ -47,6 +47,10 @@ packages:
resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==}
engines: {node: '>=0.10.0'}
+ react@19.0.0:
+ resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==}
+ engines: {node: '>=0.10.0'}
+
snapshots:
js-tokens@4.0.0: {}
@@ -65,3 +69,5 @@ snapshots:
react@18.2.0:
dependencies:
loose-envify: 1.4.0
+
+ react@19.0.0: {} On the other hand pnpm/pkg-manager/resolve-dependencies/src/index.ts Lines 133 to 142 in 512465c
The interaction with This means that other packages, aside from the specified one, will be updated. I updated the reproduction to show this issue, showing that a third workspace package with @zkochan, this seems like a bit of a footgun, or at least inconsistent since |
Fixes pnpm#8877, whereby `update --filter --latest` with `dedupe-peer-dependents` would end up updating all available dependencies for all projects.
pnpm update --filter
leads to the lockfile changing for unrelated workspace packages, in a seemingly incompatible waypnpm update --filter --latest
leads to the lockfile changing for unrelated project and dependencies, when dedupe-peer-dependents
is false
…ages and projects, with `dedupe-peer-dependents=true` (#8905) * test(update): add failing tests for update with dedupe-peer-dependents=true Relates to #8877 * fix: update --filter --latest should work with dedupe-peer-dependents Fixes #8877, whereby `update --filter --latest` with `dedupe-peer-dependents` would end up updating all available dependencies for all projects. * test(pnpm): more accurate dedupePeers filtered install case * docs: add changeset for updateToLatest moving to projects/importers * docs: add changesets for pnpm and plugin-commands-installation * chore: fix tsc issue by removing unknown bound resolver property This unknown property was accepted by tsc prior to adding updateToLatest in toResovleImporter options, but now it was erroring out. This is likely a tsc quirk about the shape of the object; regardless that property is not defined, and should not be present. * test: keep only pnpm/test/monorepo/dedupePeers.test.ts There was duplicate coverage of the pnpm update --filter --latest command between two tests, so this keeps only the one dedicated to testing the dedupe-peer-dependents feature. * chore: fix unused import error
Last pnpm version that worked
9.4.0
pnpm version
9.15.0
Code to reproduce the issue
More specifically, this stopped working as expected in 9.5.0. Version 10 rc0 also does not work as expected.
I have a full reproduction at https://github.com/fpapado/pnpm-filtered-updated-changes-other-packages, so please refer to that for the full details / a cloneable set of code.
In prose:
You will need a workspace with two packages:
a
andb
. Each of them depends (puredependencies
) onreact@18.3.0
.Run
pnpm --filter a update --latest react
, to update react only for packagea
, resolvingreact@19.0.0
. Optionally runpnpm install
(the observed behaviour seems the same regardless).Observe the lockfile diff, see that
react@19.0.0
is resolved also forb
. Thepackage.json
ofb
is unaffected.pnpm ls -r react
shows similar output:Expected behavior
That
a
resolvesreact@19.0.0
andb
resolvesreact@18.3.0
Actual behavior
Now
a
resolvesreact@19.0.0
andb
also resolvesreact@19.0.0
Additional information
While debugging and after reading the changelog for 9.5.0, I decided to set
dedupe-peer-dependents=false
in.npmrc
, kind of on a whim. This actually fixes the issue, but I am confused, because we are not dealing with packages that are peer dependents.It also seems odd to me that
react@19.0.0
would be able to deduplicatereact@18.3.0
, since the major versions differ.Please let me know if there is any other information I can provide; I might have missed something 😌
Node.js version
v22.12.0
Operating System
macOS
The text was updated successfully, but these errors were encountered: