From 863d75906123f89cc66a4f04352f5d383c3daa04 Mon Sep 17 00:00:00 2001 From: Arri Rucker Date: Fri, 3 Jul 2020 00:23:26 -0400 Subject: [PATCH 1/2] allow URLs to start with @ prefix to support new pnpm tarball format --- apps/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts | 3 ++- apps/rush-lib/src/logic/test/ShrinkwrapFile.test.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts b/apps/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts index ef63d62a954..542414354f5 100644 --- a/apps/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts +++ b/apps/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts @@ -154,9 +154,10 @@ export function parsePnpmDependencyKey( } if (!semver.valid(parsedVersionPart)) { - const urlRegex: RegExp = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}\/([^\/\\]+\/?)*([^\/\\]+)$/i; + const urlRegex: RegExp = /^(@?)([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}\/([^\/\\]+\/?)*([^\/\\]+)$/i; // Test for urls: // Examples: + // @github.com/abc/def/188ed64efd5218beda276e02f2277bf3a6b745b2 // github.com/abc/def/188ed64efd5218beda276e02f2277bf3a6b745b2 // github.com.au/abc/def/188ed64efd5218beda276e02f2277bf3a6b745b2 // bitbucket.com/abc/def/188ed64efd5218beda276e02f2277bf3a6b745b2 diff --git a/apps/rush-lib/src/logic/test/ShrinkwrapFile.test.ts b/apps/rush-lib/src/logic/test/ShrinkwrapFile.test.ts index a1a696d77f5..5ac880b372a 100644 --- a/apps/rush-lib/src/logic/test/ShrinkwrapFile.test.ts +++ b/apps/rush-lib/src/logic/test/ShrinkwrapFile.test.ts @@ -159,6 +159,9 @@ describe('extractVersionFromPnpmVersionSpecifier', () => { ); }); it('detects urls', () => { + expect( + testParsePnpmDependencyKey('example', '@github.com/abc/def/abcdef2fbd0260e6e56ed5ba34df0f5b6599bbe64') + ).toEqual('@github.com/abc/def/abcdef2fbd0260e6e56ed5ba34df0f5b6599bbe64'); expect( testParsePnpmDependencyKey('example', 'github.com/abc/def/abcdef2fbd0260e6e56ed5ba34df0f5b6599bbe64') ).toEqual('github.com/abc/def/abcdef2fbd0260e6e56ed5ba34df0f5b6599bbe64'); From ffa2127d422d7e237dcab31faabf464bc6aee623 Mon Sep 17 00:00:00 2001 From: Arri Rucker Date: Fri, 3 Jul 2020 00:30:42 -0400 Subject: [PATCH 2/2] added change files --- ...github-pnpm-shrinkwrap-error_2020-07-03-04-30.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@microsoft/rush/fix-github-pnpm-shrinkwrap-error_2020-07-03-04-30.json diff --git a/common/changes/@microsoft/rush/fix-github-pnpm-shrinkwrap-error_2020-07-03-04-30.json b/common/changes/@microsoft/rush/fix-github-pnpm-shrinkwrap-error_2020-07-03-04-30.json new file mode 100644 index 00000000000..375be448064 --- /dev/null +++ b/common/changes/@microsoft/rush/fix-github-pnpm-shrinkwrap-error_2020-07-03-04-30.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Added support for new format used by pnpm for tarball URLs that now begin with an @ symbol", + "type": "none" + } + ], + "packageName": "@microsoft/rush", + "email": "arri-cc@users.noreply.github.com" +} \ No newline at end of file