diff --git a/common/changes/@microsoft/rush/fix-pnpm-patch_2024-08-09-10-38.json b/common/changes/@microsoft/rush/fix-pnpm-patch_2024-08-09-10-38.json new file mode 100644 index 00000000000..b8a55f9c378 --- /dev/null +++ b/common/changes/@microsoft/rush/fix-pnpm-patch_2024-08-09-10-38.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Fix an issue where `rush-pnpm patch-commit` would not correctly resolve patch files when the subspaces feature is enabled.", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts b/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts index 3af75b88013..5228f5ca115 100644 --- a/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts +++ b/libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts @@ -443,6 +443,7 @@ export class RushPnpmCommandLineParser { } const subspaceTempFolder: string = this._subspace.getSubspaceTempFolder(); + const subspaceConfigFolder: string = this._subspace.getSubspaceConfigFolder(); switch (commandName) { case 'patch-commit': { @@ -468,8 +469,8 @@ export class RushPnpmCommandLineParser { if (!objectsAreDeepEqual(currentGlobalPatchedDependencies, newGlobalPatchedDependencies)) { const commonTempPnpmPatchesFolder: string = `${subspaceTempFolder}/${RushConstants.pnpmPatchesFolderName}`; - const rushPnpmPatchesFolder: string = `${subspaceTempFolder}/${RushConstants.pnpmPatchesCommonFolderName}`; - // Copy (or delete) common\temp\patches\ --> common\pnpm-patches\ + const rushPnpmPatchesFolder: string = `${subspaceConfigFolder}/${RushConstants.pnpmPatchesCommonFolderName}`; + // Copy (or delete) common\temp\subspace\patches\ --> subspace\pnpm-patches\ if (FileSystem.exists(commonTempPnpmPatchesFolder)) { FileSystem.ensureEmptyFolder(rushPnpmPatchesFolder); // eslint-disable-next-line no-console diff --git a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts index 8ce864ed08e..72fd88975ad 100644 --- a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts +++ b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts @@ -496,7 +496,7 @@ export abstract class BaseInstallManager { const commonTempPnpmPatchesFolder: string = `${subspace.getSubspaceTempFolder()}/${ RushConstants.pnpmPatchesFolderName }`; - const rushPnpmPatchesFolder: string = `${this.rushConfiguration.commonFolder}/${RushConstants.pnpmPatchesCommonFolderName}`; + const rushPnpmPatchesFolder: string = `${subspace.getSubspaceConfigFolder()}/${RushConstants.pnpmPatchesCommonFolderName}`; let rushPnpmPatches: FolderItem[] | undefined; try { rushPnpmPatches = await FileSystem.readFolderItemsAsync(rushPnpmPatchesFolder);