[rush] supports "rush-pnpm patch-remove" command (#4911)

* feat: add rush-pnpm patch-remove

* chore: rush change

* Rush change.

---------

Co-authored-by: Cheng Liu <chengcyber@users.noreply.github.com>
Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
This commit is contained in:
Cheng Liu 2024-09-09 11:43:01 -07:00 коммит произвёл GitHub
Родитель cf7f5e35b1
Коммит 6a5ac8ae52
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Support the `rush-pnpm patch-remove` command.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}

Просмотреть файл

@ -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.