@@ -23,11 +23,7 @@ import {
23
23
SchematicEngine ,
24
24
UnsuccessfulWorkflowExecution ,
25
25
} from '@angular-devkit/schematics' ;
26
- import {
27
- FileSystemEngineHost ,
28
- NodeModulesEngineHost ,
29
- NodeWorkflow ,
30
- } from '@angular-devkit/schematics/tools' ;
26
+ import { NodeModulesEngineHost , NodeWorkflow } from '@angular-devkit/schematics/tools' ;
31
27
import * as minimist from 'minimist' ;
32
28
33
29
@@ -90,7 +86,6 @@ export async function main({
90
86
91
87
/** Create the DevKit Logger used through the CLI. */
92
88
const logger = createConsoleLogger ( argv [ 'verbose' ] , stdout , stderr ) ;
93
-
94
89
if ( argv . help ) {
95
90
logger . info ( getUsage ( ) ) ;
96
91
@@ -104,16 +99,18 @@ export async function main({
104
99
} = parseSchematicName ( argv . _ . shift ( ) || null ) ;
105
100
const isLocalCollection = collectionName . startsWith ( '.' ) || collectionName . startsWith ( '/' ) ;
106
101
107
-
108
102
/** If the user wants to list schematics, we simply show all the schematic names. */
109
103
if ( argv [ 'list-schematics' ] ) {
110
- const engineHost = isLocalCollection
111
- ? new FileSystemEngineHost ( normalize ( process . cwd ( ) ) )
112
- : new NodeModulesEngineHost ( ) ;
113
-
114
- const engine = new SchematicEngine ( engineHost ) ;
115
- const collection = engine . createCollection ( collectionName ) ;
116
- logger . info ( engine . listSchematicNames ( collection ) . join ( '\n' ) ) ;
104
+ try {
105
+ const engineHost = new NodeModulesEngineHost ( ) ;
106
+ const engine = new SchematicEngine ( engineHost ) ;
107
+ const collection = engine . createCollection ( collectionName ) ;
108
+ logger . info ( engine . listSchematicNames ( collection ) . join ( '\n' ) ) ;
109
+ } catch ( error ) {
110
+ logger . fatal ( error . message ) ;
111
+
112
+ return 1 ;
113
+ }
117
114
118
115
return 0 ;
119
116
}
0 commit comments