@@ -126,6 +126,9 @@ export class RushProjectConfiguration {
126126 }
127127 } ) ;
128128
129+ private static readonly _configCache : Map < RushConfigurationProject , RushProjectConfiguration | false > =
130+ new Map ( ) ;
131+
129132 public readonly project : RushConfigurationProject ;
130133
131134 /**
@@ -177,8 +180,17 @@ export class RushProjectConfiguration {
177180 public static async tryLoadForProjectAsync (
178181 project : RushConfigurationProject ,
179182 repoCommandLineConfiguration : CommandLineConfiguration | undefined ,
180- terminal : Terminal
183+ terminal : Terminal ,
184+ skipCache ?: boolean
181185 ) : Promise < RushProjectConfiguration | undefined > {
186+ // false is a signal that the project config does not exist
187+ const cacheEntry : RushProjectConfiguration | false | undefined = skipCache
188+ ? undefined
189+ : RushProjectConfiguration . _configCache . get ( project ) ;
190+ if ( cacheEntry !== undefined ) {
191+ return cacheEntry || undefined ;
192+ }
193+
182194 const rigConfig : RigConfig = await RigConfig . loadForProjectFolderAsync ( {
183195 projectFolderPath : project . projectFolder
184196 } ) ;
@@ -197,8 +209,11 @@ export class RushProjectConfiguration {
197209 repoCommandLineConfiguration ,
198210 terminal
199211 ) ;
200- return new RushProjectConfiguration ( project , rushProjectJson ) ;
212+ const result : RushProjectConfiguration = new RushProjectConfiguration ( project , rushProjectJson ) ;
213+ RushProjectConfiguration . _configCache . set ( project , result ) ;
214+ return result ;
201215 } else {
216+ RushProjectConfiguration . _configCache . set ( project , false ) ;
202217 return undefined ;
203218 }
204219 }
0 commit comments