From 2cdf1adb8455e10dcd670a1a755e2197f3604c90 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Sat, 31 Aug 2024 18:20:22 -0700 Subject: [PATCH 1/3] feat: add rush-pnpm patch-remove --- .../src/cli/RushPnpmCommandLineParser.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts b/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts index bfe3f90b901..2f404435424 100644 --- a/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts +++ b/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts @@ -334,6 +334,22 @@ export class RushPnpmCommandLineParser { } break; } + case 'patch-remove': { + const semver: typeof import('semver') = await import('semver'); + /** + * The "patch-remove" command was introduced in pnpm version 8.5.0 + */ + if (semver.lt(this._rushConfiguration.packageManagerToolVersion, '8.5.0')) { + this._terminal.writeErrorLine( + PrintUtilities.wrapWords( + `Error: The "pnpm patch-remove" command is added after pnpm@8.5.0.` + + ` Please update "pnpmVersion" >= 8.5.0 in ${RushConstants.rushJsonFilename} file and run "rush update" to use this command.` + ) + '\n' + ); + throw new AlreadyReportedError(); + } + break; + } // Known safe case 'audit': @@ -447,6 +463,7 @@ export class RushPnpmCommandLineParser { const subspaceConfigFolder: string = this._subspace.getSubspaceConfigFolderPath(); switch (commandName) { + case 'patch-remove': case 'patch-commit': { // why need to throw error when pnpm-config.json not exists? // 1. pnpm-config.json is required for `rush-pnpm patch-commit`. Rush writes the patched dependency to the pnpm-config.json when finishes. From 00fc8d7460ae076a194de4f2e7fbfa605d541191 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Sat, 31 Aug 2024 18:28:30 -0700 Subject: [PATCH 2/3] chore: rush change --- .../rush/rush-pnpm-patch-remove_2024-09-01-01-28.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json diff --git a/common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json b/common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json new file mode 100644 index 00000000000..d136c853963 --- /dev/null +++ b/common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Support \"rush-pnpm patch-remove\" command", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file From 38c419d3c8f7fdc3764580fd1b81489d65306077 Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Mon, 9 Sep 2024 11:25:00 -0700 Subject: [PATCH 3/3] Rush change. --- .../rush/rush-pnpm-patch-remove_2024-09-01-01-28.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json b/common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json index d136c853963..cc6ff40a0a3 100644 --- a/common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json +++ b/common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json @@ -2,7 +2,7 @@ "changes": [ { "packageName": "@microsoft/rush", - "comment": "Support \"rush-pnpm patch-remove\" command", + "comment": "Support the `rush-pnpm patch-remove` command.", "type": "none" } ],