@@ -79,6 +79,15 @@ export interface IInstallManagerOptions {
7979 * (pnpmfile.js script logic, registry changes, etc).
8080 */
8181 recheckShrinkwrap : boolean ;
82+
83+ /**
84+ * The value of the "--network-concurrency" command-line parameter, which
85+ * is a diagnostic option used to troubleshoot network failures.
86+ *
87+ * Currently only supported for PNPM.
88+ */
89+ networkConcurrency : number | undefined ;
90+
8291 /**
8392 * Whether or not to collect verbose logs from the package manager.
8493 * If specified when using PNPM, the logs will be in /common/temp/pnpm.log
@@ -239,8 +248,7 @@ export class InstallManager {
239248 }
240249 }
241250
242- return this . _installCommonModules ( shrinkwrapIsUpToDate ,
243- options . allowShrinkwrapUpdates , options . collectLogFile )
251+ return this . _installCommonModules ( shrinkwrapIsUpToDate , options )
244252 . then ( ( ) => {
245253 if ( ! options . noLink ) {
246254 const linkManager : BaseLinkManager = LinkManagerFactory . getLinkManager ( this . _rushConfiguration ) ;
@@ -616,10 +624,7 @@ export class InstallManager {
616624 /**
617625 * Runs "npm install" in the common folder.
618626 */
619- private _installCommonModules (
620- shrinkwrapIsUpToDate : boolean ,
621- allowShrinkwrapUpdates : boolean ,
622- collectLogFile : boolean ) : Promise < void > {
627+ private _installCommonModules ( shrinkwrapIsUpToDate : boolean , options : IInstallManagerOptions ) : Promise < void > {
623628 return Promise . resolve ( ) . then ( ( ) => {
624629 console . log ( os . EOL + colors . bold ( 'Checking node_modules in ' + this . _rushConfiguration . commonTempFolder )
625630 + os . EOL ) ;
@@ -726,7 +731,7 @@ export class InstallManager {
726731 console . log ( `Running "${ this . _rushConfiguration . packageManager } prune"`
727732 + ` in ${ this . _rushConfiguration . commonTempFolder } ` ) ;
728733 const args : string [ ] = [ 'prune' ] ;
729- this . _pushConfigurationArgs ( args , collectLogFile ) ;
734+ this . _pushConfigurationArgs ( args , options ) ;
730735
731736 Utilities . executeCommandWithRetry ( MAX_INSTALL_ATTEMPTS , packageManagerFilename , args ,
732737 this . _rushConfiguration . commonTempFolder ) ;
@@ -771,11 +776,17 @@ export class InstallManager {
771776 // people would have different node_modules based on their system.
772777
773778 const installArgs : string [ ] = [ 'install' , '--no-optional' ] ;
774- this . _pushConfigurationArgs ( installArgs , collectLogFile ) ;
779+ this . _pushConfigurationArgs ( installArgs , options ) ;
775780
776781 console . log ( os . EOL + colors . bold ( `Running "${ this . _rushConfiguration . packageManager } install" in`
777782 + ` ${ this . _rushConfiguration . commonTempFolder } ` ) + os . EOL ) ;
778783
784+ if ( options . collectLogFile || options . networkConcurrency ) {
785+ // Show the full command-line when diagnostic options are specified
786+ console . log ( os . EOL + colors . green ( 'Invoking package manager: ' )
787+ + FileSystem . getRealPath ( packageManagerFilename ) + ' ' + installArgs . join ( ' ' ) + os . EOL ) ;
788+ }
789+
779790 Utilities . executeCommandWithRetry ( MAX_INSTALL_ATTEMPTS , packageManagerFilename ,
780791 installArgs ,
781792 this . _rushConfiguration . commonTempFolder ,
@@ -799,15 +810,15 @@ export class InstallManager {
799810
800811 console . log ( os . EOL + colors . bold ( 'Running "npm shrinkwrap"...' ) ) ;
801812 const npmArgs : string [ ] = [ 'shrinkwrap' ] ;
802- this . _pushConfigurationArgs ( npmArgs , collectLogFile ) ;
813+ this . _pushConfigurationArgs ( npmArgs , options ) ;
803814 Utilities . executeCommand ( this . _rushConfiguration . packageManagerToolFilename ,
804815 npmArgs , this . _rushConfiguration . commonTempFolder ) ;
805816 console . log ( '"npm shrinkwrap" completed' + os . EOL ) ;
806817
807818 this . _fixupNpm5Regression ( ) ;
808819 }
809820
810- if ( allowShrinkwrapUpdates && ! shrinkwrapIsUpToDate ) {
821+ if ( options . allowShrinkwrapUpdates && ! shrinkwrapIsUpToDate ) {
811822 // Copy (or delete) common\temp\shrinkwrap.yaml --> common\config\rush\shrinkwrap.yaml
812823 this . _syncFile ( this . _rushConfiguration . tempShrinkwrapFilename ,
813824 this . _rushConfiguration . committedShrinkwrapFilename ) ;
@@ -939,12 +950,12 @@ export class InstallManager {
939950 * Used when invoking the NPM tool. Appends the common configuration options
940951 * to the command-line.
941952 */
942- private _pushConfigurationArgs ( args : string [ ] , collectLogFile : boolean ) : void {
953+ private _pushConfigurationArgs ( args : string [ ] , options : IInstallManagerOptions ) : void {
943954 if ( this . _rushConfiguration . packageManager === 'npm' ) {
944955 args . push ( '--cache' , this . _rushConfiguration . npmCacheFolder ) ;
945956 args . push ( '--tmp' , this . _rushConfiguration . npmTmpFolder ) ;
946957
947- if ( collectLogFile ) {
958+ if ( options . collectLogFile ) {
948959 args . push ( '--verbose' ) ;
949960 }
950961 } else if ( this . _rushConfiguration . packageManager === 'pnpm' ) {
@@ -957,9 +968,13 @@ export class InstallManager {
957968 // last install flag, which encapsulates the entire installation
958969 args . push ( '--no-lock' ) ;
959970
960- if ( collectLogFile ) {
971+ if ( options . collectLogFile ) {
961972 args . push ( '--reporter' , 'ndjson' ) ;
962973 }
974+
975+ if ( options . networkConcurrency ) {
976+ args . push ( '--network-concurrency' , options . networkConcurrency . toString ( ) ) ;
977+ }
963978 }
964979 }
965980
0 commit comments