77 */ 
88
99import  {  strings  }  from  '@angular-devkit/core' ; 
10+ import  {  Collection  }  from  '@angular-devkit/schematics' ; 
11+ import  { 
12+   FileSystemCollectionDescription , 
13+   FileSystemSchematicDescription , 
14+ }  from  '@angular-devkit/schematics/tools' ; 
1015import  {  Argv  }  from  'yargs' ; 
1116import  { 
1217  CommandModuleError , 
@@ -69,7 +74,6 @@ export class GenerateCommandModule
6974      const  { 
7075        'x-deprecated' : xDeprecated , 
7176        description =  schematicDescription , 
72-         aliases =  schematicAliases , 
7377        hidden =  schematicHidden , 
7478      }  =  schemaJson ; 
7579      const  options  =  await  this . getSchematicOptions ( collection ,  schematicName ,  workflow ) ; 
@@ -79,8 +83,8 @@ export class GenerateCommandModule
7983        // When 'describe' is set to false, it results in a hidden command. 
8084        describe : hidden  ===  true  ? false  : typeof  description  ===  'string'  ? description  : '' , 
8185        deprecated : xDeprecated  ===  true  ||  typeof  xDeprecated  ===  'string'  ? xDeprecated  : false , 
82-         aliases : Array . isArray ( aliases ) 
83-           ? await  this . generateCommandAliasesStrings ( collectionName ,  aliases   as   string [ ] ) 
86+         aliases : Array . isArray ( schematicAliases ) 
87+           ? await  this . generateCommandAliasesStrings ( collectionName ,  schematicAliases ) 
8488          : undefined , 
8589        builder : ( localYargs )  =>  this . addSchemaOptionsToCommand ( localYargs ,  options ) . strict ( ) , 
8690        handler : ( options )  => 
@@ -205,13 +209,37 @@ export class GenerateCommandModule
205209        // If a schematic with this same name is already registered skip. 
206210        if  ( ! seenNames . has ( schematicName ) )  { 
207211          seenNames . add ( schematicName ) ; 
208-           const  {  aliases }  =  collection . description . schematics [ schematicName ] ; 
209-           const  schematicAliases  =  aliases  &&  new  Set ( aliases ) ; 
210212
211-           yield  {  schematicName,  schematicAliases,  collectionName } ; 
213+           yield  { 
214+             schematicName, 
215+             collectionName, 
216+             schematicAliases : this . listSchematicAliases ( collection ,  schematicName ) , 
217+           } ; 
218+         } 
219+       } 
220+     } 
221+   } 
222+ 
223+   private  listSchematicAliases ( 
224+     collection : Collection < FileSystemCollectionDescription ,  FileSystemSchematicDescription > , 
225+     schematicName : string , 
226+   ) : Set < string >  |  undefined  { 
227+     const  description  =  collection . description . schematics [ schematicName ] ; 
228+     if  ( description )  { 
229+       return  description . aliases  &&  new  Set ( description . aliases ) ; 
230+     } 
231+ 
232+     // Extended collections 
233+     if  ( collection . baseDescriptions )  { 
234+       for  ( const  base  of  collection . baseDescriptions )  { 
235+         const  description  =  base . schematics [ schematicName ] ; 
236+         if  ( description )  { 
237+           return  description . aliases  &&  new  Set ( description . aliases ) ; 
212238        } 
213239      } 
214240    } 
241+ 
242+     return  undefined ; 
215243  } 
216244
217245  /** 
0 commit comments