Skip to content

Commit

Permalink
fix: prune should omit descriptors from peerDependencies (#2269)
Browse files Browse the repository at this point in the history
Partially addresses #2049 

Yarn 2+ doesn't expect descriptors that appear in `peerDependencies` to be kept. This behavior only manifested in a lockfile where a pruned package had a normal dependency descriptor that also appeared as a peer dependency descriptor in a package that wasn't pruned. As background "descriptor" is the term Yarn uses for a semver range that appears in a `package.json` or lockfile entry.

Amended the minimal berry lockfile to now test that we don't keep around descriptors even if they appear in `peerDependencies`.
  • Loading branch information
chris-olszewski committed Oct 26, 2022
1 parent eeeba95 commit a931fb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions cli/internal/lockfile/berry_lockfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ func (b *BerryLockfileEntry) possibleDescriptors() []_Descriptor {
for dep, version := range b.Dependencies {
addDescriptor(dep, version)
}
for dep, version := range b.PeerDependencies {
addDescriptor(dep, version)
}

return descriptors
}
Expand Down
2 changes: 2 additions & 0 deletions cli/internal/lockfile/testdata/minimal-berry.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ __metadata:
dependencies:
c: "*"
lodash: ^4.17.0
peerDependencies:
lodash: ^3.0.0 || ^4.0.0
languageName: unknown
linkType: soft

Expand Down

0 comments on commit a931fb5

Please sign in to comment.