-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rush] supports "rush-pnpm patch-remove" command (#4911)
* feat: add rush-pnpm patch-remove * chore: rush change * Rush change. --------- Co-authored-by: Cheng Liu <[email protected]> Co-authored-by: Ian Clanton-Thuon <[email protected]>
- Loading branch information
1 parent
cf7f5e3
commit 6a5ac8a
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@microsoft/rush/rush-pnpm-patch-remove_2024-09-01-01-28.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@microsoft/rush", | ||
"comment": "Support the `rush-pnpm patch-remove` command.", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@microsoft/rush" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected].` + | ||
` 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. | ||
|