@@ -79,6 +79,13 @@ 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+ networkConcurrency : number | undefined ;
88+
8289 /**
8390 * Whether or not to collect verbose logs from the package manager.
8491 * If specified when using PNPM, the logs will be in /common/temp/pnpm.log
@@ -239,8 +246,7 @@ export class InstallManager {
239246 }
240247 }
241248
242- return this . _installCommonModules ( shrinkwrapIsUpToDate ,
243- options . allowShrinkwrapUpdates , options . collectLogFile )
249+ return this . _installCommonModules ( shrinkwrapIsUpToDate , options )
244250 . then ( ( ) => {
245251 if ( ! options . noLink ) {
246252 const linkManager : BaseLinkManager = LinkManagerFactory . getLinkManager ( this . _rushConfiguration ) ;
@@ -616,10 +622,7 @@ export class InstallManager {
616622 /**
617623 * Runs "npm install" in the common folder.
618624 */
619- private _installCommonModules (
620- shrinkwrapIsUpToDate : boolean ,
621- allowShrinkwrapUpdates : boolean ,
622- collectLogFile : boolean ) : Promise < void > {
625+ private _installCommonModules ( shrinkwrapIsUpToDate : boolean , options : IInstallManagerOptions ) : Promise < void > {
623626 return Promise . resolve ( ) . then ( ( ) => {
624627 console . log ( os . EOL + colors . bold ( 'Checking node_modules in ' + this . _rushConfiguration . commonTempFolder )
625628 + os . EOL ) ;
@@ -726,7 +729,7 @@ export class InstallManager {
726729 console . log ( `Running "${ this . _rushConfiguration . packageManager } prune"`
727730 + ` in ${ this . _rushConfiguration . commonTempFolder } ` ) ;
728731 const args : string [ ] = [ 'prune' ] ;
729- this . _pushConfigurationArgs ( args , collectLogFile ) ;
732+ this . _pushConfigurationArgs ( args , options ) ;
730733
731734 Utilities . executeCommandWithRetry ( MAX_INSTALL_ATTEMPTS , packageManagerFilename , args ,
732735 this . _rushConfiguration . commonTempFolder ) ;
@@ -771,7 +774,7 @@ export class InstallManager {
771774 // people would have different node_modules based on their system.
772775
773776 const installArgs : string [ ] = [ 'install' , '--no-optional' ] ;
774- this . _pushConfigurationArgs ( installArgs , collectLogFile ) ;
777+ this . _pushConfigurationArgs ( installArgs , options ) ;
775778
776779 console . log ( os . EOL + colors . bold ( `Running "${ this . _rushConfiguration . packageManager } install" in`
777780 + ` ${ this . _rushConfiguration . commonTempFolder } ` ) + os . EOL ) ;
@@ -799,15 +802,15 @@ export class InstallManager {
799802
800803 console . log ( os . EOL + colors . bold ( 'Running "npm shrinkwrap"...' ) ) ;
801804 const npmArgs : string [ ] = [ 'shrinkwrap' ] ;
802- this . _pushConfigurationArgs ( npmArgs , collectLogFile ) ;
805+ this . _pushConfigurationArgs ( npmArgs , options ) ;
803806 Utilities . executeCommand ( this . _rushConfiguration . packageManagerToolFilename ,
804807 npmArgs , this . _rushConfiguration . commonTempFolder ) ;
805808 console . log ( '"npm shrinkwrap" completed' + os . EOL ) ;
806809
807810 this . _fixupNpm5Regression ( ) ;
808811 }
809812
810- if ( allowShrinkwrapUpdates && ! shrinkwrapIsUpToDate ) {
813+ if ( options . allowShrinkwrapUpdates && ! shrinkwrapIsUpToDate ) {
811814 // Copy (or delete) common\temp\shrinkwrap.yaml --> common\config\rush\shrinkwrap.yaml
812815 this . _syncFile ( this . _rushConfiguration . tempShrinkwrapFilename ,
813816 this . _rushConfiguration . committedShrinkwrapFilename ) ;
@@ -939,12 +942,12 @@ export class InstallManager {
939942 * Used when invoking the NPM tool. Appends the common configuration options
940943 * to the command-line.
941944 */
942- private _pushConfigurationArgs ( args : string [ ] , collectLogFile : boolean ) : void {
945+ private _pushConfigurationArgs ( args : string [ ] , options : IInstallManagerOptions ) : void {
943946 if ( this . _rushConfiguration . packageManager === 'npm' ) {
944947 args . push ( '--cache' , this . _rushConfiguration . npmCacheFolder ) ;
945948 args . push ( '--tmp' , this . _rushConfiguration . npmTmpFolder ) ;
946949
947- if ( collectLogFile ) {
950+ if ( options . collectLogFile ) {
948951 args . push ( '--verbose' ) ;
949952 }
950953 } else if ( this . _rushConfiguration . packageManager === 'pnpm' ) {
@@ -957,9 +960,13 @@ export class InstallManager {
957960 // last install flag, which encapsulates the entire installation
958961 args . push ( '--no-lock' ) ;
959962
960- if ( collectLogFile ) {
963+ if ( options . collectLogFile ) {
961964 args . push ( '--reporter' , 'ndjson' ) ;
962965 }
966+
967+ if ( options . networkConcurrency ) {
968+ args . push ( '--network-concurrency' , options . networkConcurrency . toString ( ) ) ;
969+ }
963970 }
964971 }
965972
0 commit comments