Skip to content

Commit

Permalink
fix(core): normalizing key of patched packages with its actual resolv…
Browse files Browse the repository at this point in the history
…ed version and not the one from the key (#18192)
  • Loading branch information
veimox committed Aug 14, 2023
1 parent 4f67f15 commit 5ac66e4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/nx/src/plugins/js/lock-file/yarn-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,20 +411,21 @@ function mapSnapshots(
});

// remove keys that match version ranges that have been pruned away
snapshotMap.forEach((keysSet) => {
for (const key of keysSet.values()) {
snapshotMap.forEach((snapshotValue, snapshotKey) => {
for (const key of snapshotValue.values()) {
const packageName = key.slice(0, key.indexOf('@', 1));
let normalizedKey = key;
if (isBerry && key.includes('@patch:') && key.includes('#')) {
normalizedKey = key
.slice(0, key.indexOf('#'))
.replace(`@patch:${packageName}@`, '@npm:');
.replace(`@patch:${packageName}@`, '@npm:')
.replace(/:.*$/u, ':' + snapshotKey.version);
}
if (
!existingKeys.get(packageName) ||
!existingKeys.get(packageName).has(normalizedKey)
) {
keysSet.delete(key);
snapshotValue.delete(key);
}
}
});
Expand Down

1 comment on commit 5ac66e4

@vercel
Copy link

@vercel vercel bot commented on 5ac66e4 Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.