-
-
Notifications
You must be signed in to change notification settings - Fork 948
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: peer dependency is not unlinked when adding a new dependency (#6274
) close #6272
- Loading branch information
Showing
3 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@pnpm/resolve-dependencies": patch | ||
"pnpm": patch | ||
--- | ||
|
||
Peer dependency is not unlinked when adding a new dependency [#6272](https://github.com/pnpm/pnpm/issues/6272). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { promises as fs } from 'fs' | ||
import { WANTED_LOCKFILE } from '@pnpm/constants' | ||
import type { Lockfile } from '@pnpm/lockfile-types' | ||
import { preparePackages } from '@pnpm/prepare' | ||
import readYamlFile from 'read-yaml-file' | ||
import writeYamlFile from 'write-yaml-file' | ||
import { execPnpm } from '../utils' | ||
|
||
// Covers https://github.com/pnpm/pnpm/issues/6272 | ||
test('peer dependency is not unlinked when adding a new dependency', async () => { | ||
preparePackages([ | ||
{ | ||
name: 'project-1', | ||
|
||
dependencies: { | ||
'@pnpm.e2e/abc': '1.0.0', | ||
'@pnpm.e2e/peer-a': 'workspace:*', | ||
}, | ||
}, | ||
{ | ||
name: '@pnpm.e2e/peer-a', | ||
version: '1.0.0', | ||
|
||
dependencies: {}, | ||
}, | ||
]) | ||
|
||
await fs.writeFile('.npmrc', 'auto-install-peers=false', 'utf8') | ||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] }) | ||
await execPnpm(['install']) | ||
await execPnpm(['--filter=project-1', 'add', 'is-odd@1.0.0']) | ||
|
||
const lockfile = await readYamlFile<Lockfile>(WANTED_LOCKFILE) | ||
expect(Object.keys(lockfile!.packages!)).toContain('/@pnpm.e2e/abc@1.0.0(@pnpm.e2e/peer-a@@pnpm.e2e+peer-a)') | ||
}) |