@@ -15,7 +15,7 @@ import {
15
15
} from '@angular-devkit/schematics/tools' ;
16
16
import type { CheckboxQuestion , Question } from 'inquirer' ;
17
17
import { Argv } from 'yargs' ;
18
- import { getProjectByCwd , getProjectsByPath , getSchematicDefaults } from '../utilities/config' ;
18
+ import { getProjectByCwd , getSchematicDefaults } from '../utilities/config' ;
19
19
import { isTTY } from '../utilities/tty' ;
20
20
import {
21
21
CommandModule ,
@@ -364,32 +364,23 @@ export abstract class SchematicsCommandModule
364
364
return undefined ;
365
365
}
366
366
367
- const projectNames = getProjectsByPath ( workspace , process . cwd ( ) , workspace . basePath ) ;
367
+ const projectName = getProjectByCwd ( workspace ) ;
368
+ if ( projectName ) {
369
+ return projectName ;
370
+ }
368
371
369
- if ( projectNames . length === 1 ) {
370
- return projectNames [ 0 ] ;
371
- } else {
372
- if ( projectNames . length > 1 ) {
372
+ const defaultProjectName = workspace . extensions [ 'defaultProject' ] ;
373
+ if ( typeof defaultProjectName === 'string' && defaultProjectName ) {
374
+ if ( ! this . defaultProjectDeprecationWarningShown ) {
373
375
logger . warn ( tags . oneLine `
374
- Two or more projects are using identical roots.
375
- Unable to determine project using current working directory.
376
- Using default workspace project instead.
377
- ` ) ;
378
- }
379
-
380
- const defaultProjectName = workspace . extensions [ 'defaultProject' ] ;
381
- if ( typeof defaultProjectName === 'string' && defaultProjectName ) {
382
- if ( ! this . defaultProjectDeprecationWarningShown ) {
383
- logger . warn ( tags . oneLine `
384
376
DEPRECATED: The 'defaultProject' workspace option has been deprecated.
385
377
The project to use will be determined from the current working directory.
386
378
` ) ;
387
379
388
- this . defaultProjectDeprecationWarningShown = true ;
389
- }
390
-
391
- return defaultProjectName ;
380
+ this . defaultProjectDeprecationWarningShown = true ;
392
381
}
382
+
383
+ return defaultProjectName ;
393
384
}
394
385
395
386
return undefined ;
0 commit comments