@@ -12,6 +12,7 @@ import {
1212 } from '@microsoft/node-core-library' ;
1313import { Utilities } from '../utilities/Utilities' ;
1414import { ProjectCommandSet } from '../logic/ProjectCommandSet' ;
15+ import { RushConfiguration } from '../api/RushConfiguration' ;
1516
1617export class RushXCommandLine {
1718 public static launchRushX ( launcherVersion : string , isManaged : boolean ) : void {
@@ -66,13 +67,22 @@ export class RushXCommandLine {
6667 return ;
6768 }
6869
70+ // Are we in a Rush repo?
71+ let rushConfiguration : RushConfiguration | undefined = undefined ;
72+ if ( RushConfiguration . tryFindRushJsonLocation ( false ) ) {
73+ rushConfiguration = RushConfiguration . loadFromDefaultLocation ( ) ;
74+ }
75+
6976 console . log ( 'Executing: ' + JSON . stringify ( scriptBody ) + os . EOL ) ;
7077
7178 const packageFolder : string = path . dirname ( packageJsonFilePath ) ;
7279
73- const exitCode : number = Utilities . executeLifecycleCommand ( scriptBody , {
80+ const exitCode : number = Utilities . executeLifecycleCommand ( scriptBody ,
81+ {
7482 workingDirectory : packageFolder ,
75- initCwd : packageFolder ,
83+ // If there is a rush.json then use its .npmrc from the temp folder.
84+ // Otherwise look for npmrc in the project folder.
85+ initCwd : rushConfiguration ? rushConfiguration . commonTempFolder : packageFolder ,
7686 handleOutput : false
7787 }
7888 ) ;
0 commit comments