Skip to content

Commit b78daf0

Browse files
authored
Merge pull request #4518 from iclanton/pnpm-patches-const
[rush] Create a pnpm-patches constant.
2 parents 1e053bc + 5b300df commit b78daf0

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Include a `pnpmPatchesCommonFolderName` constant for the folder name \"pnpm-patches\" that gets placed under \"common\".",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

common/reviews/api/rush-lib.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,7 @@ export class RushConstants {
12471247
static readonly pnpmfileGlobalFilename: string;
12481248
static readonly pnpmfileV1Filename: string;
12491249
static readonly pnpmfileV6Filename: string;
1250+
static readonly pnpmPatchesCommonFolderName: string;
12501251
static readonly pnpmPatchesFolderName: string;
12511252
static readonly pnpmV3ShrinkwrapFilename: string;
12521253
static readonly projectImpactGraphFilename: string;

libraries/rush-lib/src/cli/RushPnpmCommandLineParser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export class RushPnpmCommandLineParser {
406406

407407
if (!objectsAreDeepEqual(currentGlobalPatchedDependencies, newGlobalPatchedDependencies)) {
408408
const commonTempPnpmPatchesFolder: string = `${this._rushConfiguration.commonTempFolder}/${RushConstants.pnpmPatchesFolderName}`;
409-
const rushPnpmPatchesFolder: string = `${this._rushConfiguration.commonFolder}/pnpm-${RushConstants.pnpmPatchesFolderName}`;
409+
const rushPnpmPatchesFolder: string = `${this._rushConfiguration.commonFolder}/${RushConstants.pnpmPatchesCommonFolderName}`;
410410
// Copy (or delete) common\temp\patches\ --> common\pnpm-patches\
411411
if (FileSystem.exists(commonTempPnpmPatchesFolder)) {
412412
FileSystem.ensureEmptyFolder(rushPnpmPatchesFolder);
@@ -433,7 +433,8 @@ export class RushPnpmCommandLineParser {
433433
await this._doRushUpdateAsync();
434434

435435
this._terminal.writeWarningLine(
436-
`Rush refreshed the ${RushConstants.pnpmConfigFilename}, shrinkwrap file and patch files under the "common/pnpm/patches" folder.\n` +
436+
`Rush refreshed the ${RushConstants.pnpmConfigFilename}, shrinkwrap file and patch files under the ` +
437+
`"${RushConstants.commonFolderName}/${RushConstants.pnpmPatchesCommonFolderName}" folder.\n` +
437438
' Please commit this change to Git.'
438439
);
439440
}

libraries/rush-lib/src/logic/RushConstants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ export class RushConstants {
103103
*/
104104
public static readonly pnpmPatchesFolderName: string = 'patches';
105105

106+
/**
107+
* The folder name under `/common/temp` used to store checked-in patches.
108+
* Example: `C:\MyRepo\common\pnpm-patches`
109+
*/
110+
public static readonly pnpmPatchesCommonFolderName: string = `pnpm-${RushConstants.pnpmPatchesFolderName}`;
111+
106112
/**
107113
* The filename ("shrinkwrap.yaml") used to store state for pnpm
108114
*/

libraries/rush-lib/src/logic/base/BaseInstallManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export abstract class BaseInstallManager {
438438
const commonTempPnpmPatchesFolder: string = `${subspace.getSubspaceTempFolder()}/${
439439
RushConstants.pnpmPatchesFolderName
440440
}`;
441-
const rushPnpmPatchesFolder: string = `${this.rushConfiguration.commonFolder}/pnpm-${RushConstants.pnpmPatchesFolderName}`;
441+
const rushPnpmPatchesFolder: string = `${this.rushConfiguration.commonFolder}/${RushConstants.pnpmPatchesCommonFolderName}`;
442442
if (FileSystem.exists(rushPnpmPatchesFolder)) {
443443
FileSystem.copyFiles({
444444
sourcePath: rushPnpmPatchesFolder,

0 commit comments

Comments
 (0)