@@ -194,6 +194,15 @@ export function readNxJson(): NxJson {
194
194
return config ;
195
195
}
196
196
197
+ export function workspaceLayout ( ) : { appsDir : string ; libsDir : string } {
198
+ const nxJson = readNxJson ( ) ;
199
+ const appsDir =
200
+ ( nxJson . workspaceLayout && nxJson . workspaceLayout . appsDir ) || 'apps' ;
201
+ const libsDir =
202
+ ( nxJson . workspaceLayout && nxJson . workspaceLayout . libsDir ) || 'libs' ;
203
+ return { appsDir, libsDir } ;
204
+ }
205
+
197
206
// TODO: Make this list extensible
198
207
export function rootWorkspaceFileNames ( ) : string [ ] {
199
208
return [ `package.json` , workspaceFileName ( ) , `nx.json` , `tsconfig.json` ] ;
@@ -227,12 +236,11 @@ export function readWorkspaceFiles(): FileData[] {
227
236
// Add known workspace files and directories
228
237
files . push ( ...allFilesInDir ( appRootPath , false ) ) ;
229
238
files . push ( ...allFilesInDir ( `${ appRootPath } /tools` ) ) ;
230
-
231
- // Add files for workspace projects
232
- Object . keys ( workspaceJson . projects ) . forEach ( ( projectName ) => {
233
- const project = workspaceJson . projects [ projectName ] ;
234
- files . push ( ...allFilesInDir ( `${ appRootPath } /${ project . root } ` ) ) ;
235
- } ) ;
239
+ const wl = workspaceLayout ( ) ;
240
+ files . push ( ...allFilesInDir ( `${ appRootPath } /${ wl . appsDir } ` ) ) ;
241
+ if ( wl . appsDir !== wl . libsDir ) {
242
+ files . push ( ...allFilesInDir ( `${ appRootPath } /${ wl . libsDir } ` ) ) ;
243
+ }
236
244
performance . mark ( 'read workspace files:end' ) ;
237
245
performance . measure (
238
246
'read workspace files' ,
0 commit comments