Skip to content

Commit

Permalink
Merge pull request #4344 from dmichon-msft/pnpm-install-filter
Browse files Browse the repository at this point in the history
[rush] Fix filtered installs in pnpm@8
  • Loading branch information
iclanton authored Sep 22, 2023
2 parents fa37ed8 + b9f20ae commit ee808b0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fix filtered installs in pnpm@8.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
4 changes: 2 additions & 2 deletions libraries/rush-lib/src/api/RushConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
*/
Expand Down
8 changes: 8 additions & 0 deletions libraries/rush-lib/src/logic/base/BaseInstallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,14 @@ ${gitLfsHookHandling}

if (experiments.usePnpmFrozenLockfileForRushInstall && !options.allowShrinkwrapUpdates) {
args.push('--frozen-lockfile');

if (
options.pnpmFilterArguments.length > 0 &&
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');
}
} else if (experiments.usePnpmPreferFrozenLockfileForRushUpdate) {
// In workspaces, we want to avoid unnecessary lockfile churn
args.push('--prefer-frozen-lockfile');
Expand Down

0 comments on commit ee808b0

Please sign in to comment.