Skip to content

Commit

Permalink
fix(npm): correct Yarn lockedVersion for scoped package (#7219)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhys Arkins <[email protected]>
  • Loading branch information
ylemkimon and rarkins authored Sep 9, 2020
1 parent 2de2378 commit c65d400
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/manager/npm/__fixtures__/yarn2.2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.11.2",
"chalk": "^2.4.1"
}
}
17 changes: 17 additions & 0 deletions lib/manager/npm/__fixtures__/yarn2.2/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ __metadata:
version: 4
cacheKey: 6

"@babel/runtime@npm:^7.11.2":
version: 7.11.2
resolution: "@babel/runtime@npm:7.11.2"
dependencies:
regenerator-runtime: ^0.13.4
checksum: 2f127ad60a0f0568faa0044e5b48329d8166c7fd3a0a3ce774070010a1c441ebf5570f526dd6bb26e214fb1a01bb987ab6a4c3f60a00f04d02448939f4c61e1e
languageName: node
linkType: hard

"ansi-styles@npm:^3.2.1":
version: 3.2.1
resolution: "ansi-styles@npm:3.2.1"
Expand Down Expand Up @@ -55,6 +64,13 @@ __metadata:
languageName: node
linkType: hard

"regenerator-runtime@npm:^0.13.4":
version: 0.13.7
resolution: "regenerator-runtime@npm:0.13.7"
checksum: 6ef567c662088b1b292214920cbd72443059298d477f72e1a37e0a113bafbfac9057cbfe35ae617284effc4b423493326a78561bbff7b04162c7949bdb9624e8
languageName: node
linkType: hard

"supports-color@npm:^5.3.0":
version: 5.5.0
resolution: "supports-color@npm:5.5.0"
Expand All @@ -68,6 +84,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "yarn2@workspace:."
dependencies:
"@babel/runtime": ^7.11.2
chalk: ^2.4.1
languageName: unknown
linkType: soft
2 changes: 2 additions & 0 deletions lib/manager/npm/extract/__snapshots__/yarn.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ Object {

exports[`manager/npm/extract/yarn .getYarnLock() extracts yarn 2 cache version 1`] = `
Object {
"@babel/runtime@^7.11.2": "7.11.2",
"ansi-styles@^3.2.1": "3.2.1",
"chalk@^2.4.1": "2.4.2",
"color-convert@^1.9.0": "1.9.3",
"[email protected]": "1.1.3",
"escape-string-regexp@^1.0.5": "1.0.5",
"has-flag@^3.0.0": "3.0.0",
"regenerator-runtime@^0.13.4": "0.13.7",
"supports-color@^5.3.0": "5.5.0",
"yarn2@.": "0.0.0-use.local",
}
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/extract/yarn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('manager/npm/extract/yarn', () => {
expect(res.isYarn1).toBe(false);
expect(res.cacheVersion).toBe(6);
expect(res.lockedVersions).toMatchSnapshot();
expect(Object.keys(res.lockedVersions)).toHaveLength(8);
expect(Object.keys(res.lockedVersions)).toHaveLength(10);
});
});
});
2 changes: 1 addition & 1 deletion lib/manager/npm/extract/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function getYarnLock(
} else {
for (const entry of key.split(', ')) {
const { scope, name, range } = structUtils.parseDescriptor(entry);
const packageName = scope ? `${scope}/${name}` : name;
const packageName = scope ? `@${scope}/${name}` : name;
const { selector } = structUtils.parseRange(range);

logger.trace({ entry, version: val.version });
Expand Down

0 comments on commit c65d400

Please sign in to comment.