From e057e8881a2be5b249bc68c708babc06cdccd414 Mon Sep 17 00:00:00 2001 From: David Michon Date: Wed, 20 Sep 2023 18:04:37 +0000 Subject: [PATCH 1/3] [rush] Fix filtered installs in pnpm@8 --- .../rush/pnpm-install-filter_2023-09-20-18-04.json | 10 ++++++++++ .../rush-lib/src/logic/base/BaseInstallManager.ts | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 common/changes/@microsoft/rush/pnpm-install-filter_2023-09-20-18-04.json diff --git a/common/changes/@microsoft/rush/pnpm-install-filter_2023-09-20-18-04.json b/common/changes/@microsoft/rush/pnpm-install-filter_2023-09-20-18-04.json new file mode 100644 index 00000000000..f2c827878f5 --- /dev/null +++ b/common/changes/@microsoft/rush/pnpm-install-filter_2023-09-20-18-04.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Fix filtered installs in pnpm@8.", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts index 150a70295b7..ebdfe98f21a 100644 --- a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts +++ b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts @@ -572,6 +572,14 @@ ${gitLfsHookHandling} if (experiments.usePnpmFrozenLockfileForRushInstall && !options.allowShrinkwrapUpdates) { args.push('--frozen-lockfile'); + + if ( + options.pnpmFilterArguments.length > 0 && + semver.satisfies(this.rushConfiguration.packageManagerToolVersion, '^8') + ) { + // On pnpm@8, disable the "dedupe-peer-dependents" feature when doing a filtered CI install so that filters take effect. + args.push('--config.dedupe-peer-dependents=false'); + } } else if (experiments.usePnpmPreferFrozenLockfileForRushUpdate) { // In workspaces, we want to avoid unnecessary lockfile churn args.push('--prefer-frozen-lockfile'); From 5695b3403d3d8ef20a54d66a69e14a77ced262b5 Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Fri, 22 Sep 2023 01:14:17 -0700 Subject: [PATCH 2/3] Fix a comment. --- libraries/rush-lib/src/api/RushConfiguration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/rush-lib/src/api/RushConfiguration.ts b/libraries/rush-lib/src/api/RushConfiguration.ts index f1f59164000..cc35ec47bdb 100644 --- a/libraries/rush-lib/src/api/RushConfiguration.ts +++ b/libraries/rush-lib/src/api/RushConfiguration.ts @@ -358,12 +358,12 @@ export class RushConfiguration { public readonly currentVariantJsonFilename: string; /** - * The version of the locally installed NPM tool. (Example: "1.2.3") + * The version of the locally package manager tool. (Example: "1.2.3") */ public readonly packageManagerToolVersion: string; /** - * The absolute path to the locally installed NPM tool. If "rush install" has not + * The absolute path to the locally package manager tool. If "rush install" has not * been run, then this file may not exist yet. * Example: `C:\MyRepo\common\temp\npm-local\node_modules\.bin\npm` */ From b9f20ae0ad008769a671f0c85de7438a759a4111 Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Fri, 22 Sep 2023 01:14:39 -0700 Subject: [PATCH 3/3] Faster parsing of pnpm major version. --- libraries/rush-lib/src/logic/base/BaseInstallManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts index ebdfe98f21a..8e738b4125b 100644 --- a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts +++ b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts @@ -575,7 +575,7 @@ ${gitLfsHookHandling} if ( options.pnpmFilterArguments.length > 0 && - semver.satisfies(this.rushConfiguration.packageManagerToolVersion, '^8') + Number.parseInt(this.rushConfiguration.packageManagerToolVersion, 10) >= 8 // PNPM Major version 8+ ) { // On pnpm@8, disable the "dedupe-peer-dependents" feature when doing a filtered CI install so that filters take effect. args.push('--config.dedupe-peer-dependents=false');