@@ -67,9 +67,12 @@ export default class GenerateAction extends BaseRushAction {
6767
6868 const installManager : InstallManager = new InstallManager ( this . rushConfiguration ) ;
6969
70+ const committedShrinkwrapFilename : string = this . rushConfiguration . committedShrinkwrapFilename ;
71+ const tempShrinkwrapFilename : string = this . rushConfiguration . tempShrinkwrapFilename ;
72+
7073 try {
7174 const shrinkwrapFile : ShrinkwrapFile | undefined
72- = ShrinkwrapFile . loadFromFile ( this . rushConfiguration . committedShrinkwrapFilename ) ;
75+ = ShrinkwrapFile . loadFromFile ( committedShrinkwrapFilename ) ;
7376
7477 if ( shrinkwrapFile
7578 && ! this . _forceParameter . value
@@ -86,17 +89,17 @@ export default class GenerateAction extends BaseRushAction {
8689 console . log ( 'There was a problem reading the shrinkwrap file. Proceeeding with "rush generate".' ) ;
8790 }
8891
89- installManager . ensureLocalNpmTool ( false ) ;
92+ installManager . ensureLocalPackageManager ( false ) ;
9093
9194 installManager . createTempModules ( ) ;
9295
9396 // Delete both copies of the shrinkwrap file
94- if ( fsx . existsSync ( this . rushConfiguration . committedShrinkwrapFilename ) ) {
95- console . log ( os . EOL + 'Deleting ' + this . rushConfiguration . committedShrinkwrapFilename ) ;
96- fsx . unlinkSync ( this . rushConfiguration . committedShrinkwrapFilename ) ;
97+ if ( fsx . existsSync ( committedShrinkwrapFilename ) ) {
98+ console . log ( os . EOL + 'Deleting ' + committedShrinkwrapFilename ) ;
99+ fsx . unlinkSync ( committedShrinkwrapFilename ) ;
97100 }
98- if ( fsx . existsSync ( this . rushConfiguration . tempShrinkwrapFilename ) ) {
99- fsx . unlinkSync ( this . rushConfiguration . tempShrinkwrapFilename ) ;
101+ if ( fsx . existsSync ( tempShrinkwrapFilename ) ) {
102+ fsx . unlinkSync ( tempShrinkwrapFilename ) ;
100103 }
101104
102105 if ( isLazy ) {
@@ -107,20 +110,27 @@ export default class GenerateAction extends BaseRushAction {
107110 // Do an incremental install
108111 installManager . installCommonModules ( InstallType . Normal ) ;
109112
110- console . log ( os . EOL + colors . bold ( '(Skipping "npm shrinkwrap")' ) + os . EOL ) ;
113+ if ( this . rushConfiguration . packageManager === 'npm' ) {
114+ console . log ( os . EOL + colors . bold ( '(Skipping "npm shrinkwrap")' ) + os . EOL ) ;
115+ } else if ( this . rushConfiguration . packageManager === 'pnpm' ) {
116+ console . log ( os . EOL + colors . bold ( '(Deleting "shrinkwrap.yaml")' ) + os . EOL ) ;
117+ fsx . unlinkSync ( tempShrinkwrapFilename ) ;
118+ }
111119 } else {
112120 // Do a clean install
113121 installManager . installCommonModules ( InstallType . ForceClean ) ;
114122
115- console . log ( os . EOL + colors . bold ( 'Running "npm shrinkwrap"...' ) ) ;
116- const npmArgs : string [ ] = [ 'shrinkwrap' ] ;
117- installManager . pushConfigurationNpmArgs ( npmArgs ) ;
118- Utilities . executeCommand ( this . rushConfiguration . npmToolFilename ,
119- npmArgs , this . rushConfiguration . commonTempFolder ) ;
120- console . log ( '"npm shrinkwrap" completed' + os . EOL ) ;
123+ if ( this . rushConfiguration . packageManager === 'npm' ) {
124+ console . log ( os . EOL + colors . bold ( 'Running "npm shrinkwrap"...' ) ) ;
125+ const npmArgs : string [ ] = [ 'shrinkwrap' ] ;
126+ installManager . pushConfigurationArgs ( npmArgs ) ;
127+ Utilities . executeCommand ( this . rushConfiguration . packageManagerToolFilename ,
128+ npmArgs , this . rushConfiguration . commonTempFolder ) ;
129+ console . log ( '"npm shrinkwrap" completed' + os . EOL ) ;
130+ }
121131
122132 // Copy (or delete) common\temp\npm-shrinkwrap.json --> common\npm-shrinkwrap.json
123- installManager . syncFile ( this . rushConfiguration . tempShrinkwrapFilename ,
133+ installManager . syncFile ( tempShrinkwrapFilename ,
124134 this . rushConfiguration . committedShrinkwrapFilename ) ;
125135
126136 // The flag file is normally created by installCommonModules(), but "rush install" will
0 commit comments