Skip to content

Commit cf40afd

Browse files
authored
Merge pull request microsoft#1340 from microsoft/sachinjoseph/pnpm1890-workaround
[rush] Workaround for PNPM Issue microsoft#1890
2 parents 9cf4692 + 6b1f281 commit cf40afd

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎apps/rush-lib/src/logic/InstallManager.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,23 @@ export class InstallManager {
729729
} else {
730730
// Otherwise delete the temporary file
731731
FileSystem.deleteFile(this._rushConfiguration.tempShrinkwrapFilename);
732+
733+
if (this._rushConfiguration.packageManager === 'pnpm') {
734+
const commonNodeModulesFolder: string = path.join(this._rushConfiguration.commonTempFolder, 'node_modules');
735+
736+
// Workaround for https://github.com/pnpm/pnpm/issues/1890
737+
//
738+
// When "rush update --full" is run, rush deletes common/temp/pnpm-lock.yaml so that
739+
// a new lockfile can be generated. But because of the above bug "pnpm install" would
740+
// respect "common/temp/node_modules/.pnpm-lock.yaml" and thus would not generate a
741+
// new lockfile. Deleting this file in addition to deleting common/temp/pnpm-lock.yaml
742+
// ensures that a new lockfile will be generated with "rush update --full".
743+
744+
// Note that there is period in the file name: common/temp/node_modules/.pnpm-lock.yaml
745+
const pnpmShrinkwrapInNodeModulesFolder: string = path.join(commonNodeModulesFolder, '.'
746+
+ this._rushConfiguration.shrinkwrapFilename);
747+
FileSystem.deleteFile(pnpmShrinkwrapInNodeModulesFolder);
748+
}
732749
}
733750

734751
// Don't update the file timestamp unless the content has changed, since "rush install"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Workaround for pnpm issue 1890: https://github.com/pnpm/pnpm/issues/1890. Fixes the issue of \"rush update --full\" not working correctly if the internal copy of the pnpm shrinkwrap \"common/temp/node_modules/.shrinkwrap.yaml\" exists even though Rush deletes the formal copy in \"common/temp/shrinkwrap.yaml\".",
5+
"packageName": "@microsoft/rush",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "sachinjoseph@users.noreply.github.com"
11+
}

0 commit comments

Comments
 (0)