Skip to content

Commit

Permalink
fix: dedupe-peer-dependents should not remove peer deps
Browse files Browse the repository at this point in the history
close #6154
  • Loading branch information
zkochan committed Mar 25, 2023
1 parent eb5b7d5 commit 0562519
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 58 deletions.
2 changes: 1 addition & 1 deletion __utils__/assert-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@pnpm/constants": "workspace:*",
"@pnpm/lockfile-types": "workspace:*",
"@pnpm/modules-yaml": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/types": "workspace:*",
"is-windows": "^1.0.2",
"isexe": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion __utils__/assert-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"dependencies": {
"@pnpm/cafs": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"path-exists": "^4.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion exec/plugin-commands-rebuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@pnpm/filter-workspace-packages": "workspace:*",
"@pnpm/plugin-commands-rebuild": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/test-fixtures": "workspace:*",
"@types/ramda": "0.28.20",
"@types/semver": "7.3.13",
Expand Down
2 changes: 1 addition & 1 deletion exec/plugin-commands-script-runners/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@pnpm/filter-workspace-packages": "workspace:*",
"@pnpm/plugin-commands-script-runners": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@types/is-windows": "^1.0.0",
"@types/ramda": "0.28.20",
"is-windows": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@commitlint/prompt-cli": "^17.4.4",
"@pnpm/eslint-config": "workspace:*",
"@pnpm/meta-updater": "0.2.2",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/tsconfig": "workspace:*",
"@types/jest": "^29.4.0",
"@types/node": "^14.18.37",
Expand Down
2 changes: 1 addition & 1 deletion patching/plugin-commands-patching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@pnpm/filter-workspace-packages": "workspace:*",
"@pnpm/plugin-commands-patching": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/test-fixtures": "workspace:*",
"@types/normalize-path": "^3.0.0",
"@types/ramda": "0.28.20",
Expand Down
2 changes: 1 addition & 1 deletion pkg-manager/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@pnpm/lockfile-types": "workspace:*",
"@pnpm/package-store": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/store-path": "workspace:*",
"@pnpm/test-fixtures": "workspace:*",
"@types/fs-extra": "^9.0.13",
Expand Down
2 changes: 1 addition & 1 deletion pkg-manager/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@pnpm/package-store": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/read-projects-context": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/store-path": "workspace:*",
"@pnpm/test-fixtures": "workspace:*",
"@types/fs-extra": "^9.0.13",
Expand Down
2 changes: 1 addition & 1 deletion pkg-manager/package-requester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@pnpm/client": "workspace:*",
"@pnpm/create-cafs-store": "workspace:*",
"@pnpm/package-requester": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/test-fixtures": "workspace:*",
"@types/normalize-path": "^3.0.0",
"@types/ramda": "0.28.20",
Expand Down
2 changes: 1 addition & 1 deletion pkg-manager/plugin-commands-installation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@pnpm/modules-yaml": "workspace:*",
"@pnpm/plugin-commands-installation": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/test-fixtures": "workspace:*",
"@types/proxyquire": "^1.3.28",
"@types/ramda": "0.28.20",
Expand Down
82 changes: 41 additions & 41 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@pnpm/prepare": "workspace:*",
"@pnpm/read-package-json": "workspace:*",
"@pnpm/read-project-manifest": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@pnpm/run-npm": "workspace:*",
"@pnpm/tabtab": "^0.1.2",
"@pnpm/test-fixtures": "workspace:*",
Expand Down
31 changes: 31 additions & 0 deletions pnpm/test/monorepo/dedupePeers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,34 @@ auto-install-peers=false`, 'utf8')
expect(loadJsonFile<any>('project-1/package.json').dependencies['@pnpm.e2e/abc-grand-parent-with-c']).toBe('^1.0.0') // eslint-disable-line
expect(loadJsonFile<any>('project-2/package.json').dependencies['@pnpm.e2e/abc-grand-parent-with-c']).toBe('^1.0.1') // eslint-disable-line
})

// Covers https://github.com/pnpm/pnpm/issues/6154
test('peer dependents deduplication should not remove peer dependencies', async () => {
preparePackages([
{
location: '',
package: {
name: 'project-1',

dependencies: {
'@pnpm.e2e/abc-parent-with-missing-peers': '1.0.0',
},
},
},
{
location: 'project-2',
package: {
name: 'project-2',
},
},
])

writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
writeFileSync('.npmrc', `dedupe-peer-dependents=true
auto-install-peers=true`, 'utf8')
await execPnpm(['install'])
await execPnpm(['--filter=project-2', 'add', 'is-positive@1.0.0'])

const lockfile = readYamlFile<any>(path.resolve(WANTED_LOCKFILE)) // eslint-disable-line
expect(lockfile.importers['.']?.dependencies?.['@pnpm.e2e/abc-parent-with-missing-peers'].version).toStrictEqual('1.0.0(@pnpm.e2e/peer-a@1.0.0)(@pnpm.e2e/peer-b@1.0.0)(@pnpm.e2e/peer-c@1.0.0)')
})
2 changes: 1 addition & 1 deletion releasing/plugin-commands-deploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@pnpm/lockfile-types": "workspace:*",
"@pnpm/plugin-commands-deploy": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "3.7.0"
"@pnpm/registry-mock": "3.8.0"
},
"dependencies": {
"@pnpm/cli-utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion releasing/plugin-commands-publishing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@pnpm/filter-workspace-packages": "workspace:*",
"@pnpm/plugin-commands-publishing": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@types/cross-spawn": "^6.0.2",
"@types/is-windows": "^1.0.0",
"@types/npm-packlist": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion reviewing/plugin-commands-licenses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@pnpm/plugin-commands-installation": "workspace:*",
"@pnpm/plugin-commands-licenses": "workspace:*",
"@pnpm/read-package-json": "workspace:*",
"@pnpm/registry-mock": "3.7.0",
"@pnpm/registry-mock": "3.8.0",
"@types/ramda": "0.28.20",
"@types/wrap-ansi": "^8.0.1",
"@types/zkochan__table": "npm:@types/table@6.0.0",
Expand Down

0 comments on commit 0562519

Please sign in to comment.