diff --git a/common/changes/@microsoft/rush/chao-enable-pnpm-sync_2024-02-16-23-54.json b/common/changes/@microsoft/rush/chao-enable-pnpm-sync_2024-02-16-23-54.json new file mode 100644 index 00000000000..b2a27246fdf --- /dev/null +++ b/common/changes/@microsoft/rush/chao-enable-pnpm-sync_2024-02-16-23-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Include a `pnpmPatchesCommonFolderName` constant for the folder name \"pnpm-patches\" that gets placed under \"common\".", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/common/reviews/api/rush-lib.api.md b/common/reviews/api/rush-lib.api.md index f67fd0ec7c0..9ef84fffcae 100644 --- a/common/reviews/api/rush-lib.api.md +++ b/common/reviews/api/rush-lib.api.md @@ -1247,6 +1247,7 @@ export class RushConstants { static readonly pnpmfileGlobalFilename: string; static readonly pnpmfileV1Filename: string; static readonly pnpmfileV6Filename: string; + static readonly pnpmPatchesCommonFolderName: string; static readonly pnpmPatchesFolderName: string; static readonly pnpmV3ShrinkwrapFilename: string; static readonly projectImpactGraphFilename: string; diff --git a/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts b/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts index 0f3afa73640..6a746f484a7 100644 --- a/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts +++ b/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts @@ -406,7 +406,7 @@ export class RushPnpmCommandLineParser { if (!objectsAreDeepEqual(currentGlobalPatchedDependencies, newGlobalPatchedDependencies)) { const commonTempPnpmPatchesFolder: string = `${this._rushConfiguration.commonTempFolder}/${RushConstants.pnpmPatchesFolderName}`; - const rushPnpmPatchesFolder: string = `${this._rushConfiguration.commonFolder}/pnpm-${RushConstants.pnpmPatchesFolderName}`; + const rushPnpmPatchesFolder: string = `${this._rushConfiguration.commonFolder}/${RushConstants.pnpmPatchesCommonFolderName}`; // Copy (or delete) common\temp\patches\ --> common\pnpm-patches\ if (FileSystem.exists(commonTempPnpmPatchesFolder)) { FileSystem.ensureEmptyFolder(rushPnpmPatchesFolder); @@ -433,7 +433,8 @@ export class RushPnpmCommandLineParser { await this._doRushUpdateAsync(); this._terminal.writeWarningLine( - `Rush refreshed the ${RushConstants.pnpmConfigFilename}, shrinkwrap file and patch files under the "common/pnpm/patches" folder.\n` + + `Rush refreshed the ${RushConstants.pnpmConfigFilename}, shrinkwrap file and patch files under the ` + + `"${RushConstants.commonFolderName}/${RushConstants.pnpmPatchesCommonFolderName}" folder.\n` + ' Please commit this change to Git.' ); } diff --git a/libraries/rush-lib/src/logic/RushConstants.ts b/libraries/rush-lib/src/logic/RushConstants.ts index 37ea80cacc7..091f4fe4b4e 100644 --- a/libraries/rush-lib/src/logic/RushConstants.ts +++ b/libraries/rush-lib/src/logic/RushConstants.ts @@ -103,6 +103,12 @@ export class RushConstants { */ public static readonly pnpmPatchesFolderName: string = 'patches'; + /** + * The folder name under `/common/temp` used to store checked-in patches. + * Example: `C:\MyRepo\common\pnpm-patches` + */ + public static readonly pnpmPatchesCommonFolderName: string = `pnpm-${RushConstants.pnpmPatchesFolderName}`; + /** * The filename ("shrinkwrap.yaml") used to store state for pnpm */ diff --git a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts index c876339625c..514f79d78ab 100644 --- a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts +++ b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts @@ -438,7 +438,7 @@ export abstract class BaseInstallManager { const commonTempPnpmPatchesFolder: string = `${subspace.getSubspaceTempFolder()}/${ RushConstants.pnpmPatchesFolderName }`; - const rushPnpmPatchesFolder: string = `${this.rushConfiguration.commonFolder}/pnpm-${RushConstants.pnpmPatchesFolderName}`; + const rushPnpmPatchesFolder: string = `${this.rushConfiguration.commonFolder}/${RushConstants.pnpmPatchesCommonFolderName}`; if (FileSystem.exists(rushPnpmPatchesFolder)) { FileSystem.copyFiles({ sourcePath: rushPnpmPatchesFolder,