@@ -23,11 +23,7 @@ import {
2323 SchematicEngine ,
2424 UnsuccessfulWorkflowExecution ,
2525} 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' ;
3127import * as minimist from 'minimist' ;
3228
3329
@@ -90,7 +86,6 @@ export async function main({
9086
9187 /** Create the DevKit Logger used through the CLI. */
9288 const logger = createConsoleLogger ( argv [ 'verbose' ] , stdout , stderr ) ;
93-
9489 if ( argv . help ) {
9590 logger . info ( getUsage ( ) ) ;
9691
@@ -104,16 +99,18 @@ export async function main({
10499 } = parseSchematicName ( argv . _ . shift ( ) || null ) ;
105100 const isLocalCollection = collectionName . startsWith ( '.' ) || collectionName . startsWith ( '/' ) ;
106101
107-
108102 /** If the user wants to list schematics, we simply show all the schematic names. */
109103 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+ }
117114
118115 return 0 ;
119116 }
0 commit comments