@@ -13,7 +13,9 @@ import globEscape = require('glob-escape');
1313import { JsonFile } from '@microsoft/node-core-library' ;
1414
1515import AsyncRecycler from '../../utilities/AsyncRecycler' ;
16- import RushConfiguration from '../../data/RushConfiguration' ;
16+ import RushConfiguration , {
17+ PackageManager
18+ } from '../../data/RushConfiguration' ;
1719import RushConfigurationProject from '../../data/RushConfigurationProject' ;
1820import { RushConstants } from '../../RushConstants' ;
1921import Utilities from '../../utilities/Utilities' ;
@@ -152,7 +154,7 @@ export default class InstallManager {
152154 fsx . mkdirSync ( rushHomeFolder ) ;
153155 }
154156
155- const packageManager : 'pnpm' | 'npm' = this . _rushConfiguration . packageManager ;
157+ const packageManager : PackageManager = this . _rushConfiguration . packageManager ;
156158 const packageManagerVersion : string = this . _rushConfiguration . packageManagerToolVersion ;
157159
158160 // Example: "C:\Users\YourName\.rush\pnpm-1.2.3"
@@ -517,16 +519,16 @@ export default class InstallManager {
517519 }
518520 } else {
519521 if ( this . _rushConfiguration . packageManager === 'npm' ) {
520- console . log ( `Deleting the packages -cache folder` ) ;
522+ console . log ( `Deleting the "npm -cache" folder` ) ;
521523 // This is faster and more thorough than "npm cache clean"
522524 this . _asyncRecycler . moveFolder ( this . _rushConfiguration . npmCacheFolder ) ;
523525
524- console . log ( `Deleting the "packages -tmp" folder` ) ;
526+ console . log ( `Deleting the "npm -tmp" folder` ) ;
525527 this . _asyncRecycler . moveFolder ( this . _rushConfiguration . npmTmpFolder ) ;
526528
527529 } else if ( installType === InstallType . UnsafePurge ) {
528- console . log ( `Deleting the PNPM store folder` ) ;
529- this . _asyncRecycler . moveFolder ( this . _rushConfiguration . npmCacheFolder ) ;
530+ console . log ( `Deleting the "pnpm- store" folder` ) ;
531+ this . _asyncRecycler . moveFolder ( this . _rushConfiguration . pnpmStoreFolder ) ;
530532 }
531533 }
532534
@@ -545,8 +547,6 @@ export default class InstallManager {
545547 if ( deletingNodeModules ) {
546548 // YES: Delete "node_modules"
547549
548- // @todo , try not to remove the local registry install
549-
550550 // Explain to the user why we are hosing their node_modules folder
551551 if ( installType === InstallType . Normal ) {
552552 console . log ( 'Deleting the "node_modules" folder because the previous Rush install' +
@@ -563,12 +563,15 @@ export default class InstallManager {
563563 } else {
564564 // NO: Do an incremental install in the "node_modules" folder
565565
566- console . log ( `Running "${ this . _rushConfiguration . packageManager } prune"`
567- + ` in ${ this . _rushConfiguration . commonTempFolder } ` ) ;
568- const args : string [ ] = [ 'prune' ] ;
569- this . pushConfigurationArgs ( args ) ;
570- Utilities . executeCommandWithRetry ( packageManagerFilename , args , MAX_INSTALL_ATTEMPTS ,
571- this . _rushConfiguration . commonTempFolder ) ;
566+ // note: it is not necessary to run "prune" with pnpm
567+ if ( this . _rushConfiguration . packageManager === 'npm' ) {
568+ console . log ( `Running "${ this . _rushConfiguration . packageManager } prune"`
569+ + ` in ${ this . _rushConfiguration . commonTempFolder } ` ) ;
570+ const args : string [ ] = [ 'prune' ] ;
571+ this . pushConfigurationArgs ( args ) ;
572+ Utilities . executeCommandWithRetry ( packageManagerFilename , args , MAX_INSTALL_ATTEMPTS ,
573+ this . _rushConfiguration . commonTempFolder ) ;
574+ }
572575
573576 // Delete the (installed image of) the temp projects, since "npm install" does not
574577 // detect changes for "file:./" references.
@@ -596,7 +599,8 @@ export default class InstallManager {
596599
597600 // Run "npm install" in the common folder
598601
599- // NOTE: we do NOT install optional dependencies for Rush, as it seems that optional dependencies do not
602+ // NOTE FOR NPM:
603+ // we do NOT install optional dependencies for Rush, as it seems that optional dependencies do not
600604 // work properly with shrinkwrap. Consider the "fsevents" package. This is a Mac specific package
601605 // which is an optional second-order dependency. Optional dependencies work by attempting to install
602606 // the package, but removes the package if the install failed.
@@ -637,7 +641,7 @@ export default class InstallManager {
637641 args . push ( '--cache' , this . _rushConfiguration . npmCacheFolder ) ;
638642 args . push ( '--tmp' , this . _rushConfiguration . npmTmpFolder ) ;
639643 } else if ( this . _rushConfiguration . packageManager === 'pnpm' ) {
640- args . push ( '--store' , this . _rushConfiguration . npmCacheFolder ) ;
644+ args . push ( '--store' , this . _rushConfiguration . pnpmStoreFolder ) ;
641645 args . push ( '--no-lock' ) ;
642646 }
643647 }
0 commit comments