@@ -13,8 +13,12 @@ import { ProjectPathAnalyser } from './project/ProjectPathAnalyser';
1313import { Question } from './questions/Question' ;
1414import { GeneratorOptions , MethodsToRegister , IProperty , ITypedProperty } from './Types' ;
1515import { SharedOptions } from './SharedOptions' ;
16+ import { ISharedOptionsSubscriber } from "./ISharedOptionsSubscriber" ;
1617
17- export abstract class BaseGenerator < TStep extends string > extends generator {
18+ export abstract class BaseGenerator < TStep extends string > extends generator implements ISharedOptionsSubscriber {
19+ onValue ( key : string , value : any ) : void {
20+ ( < IProperty > this . options ) [ key ] = value ;
21+ } ;
1822
1923 static counter : number = 0 ;
2024 static sharedOptions : SharedOptions < string > ;
@@ -39,13 +43,14 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
3943
4044 currentStep : TStep ;
4145
42- constructor ( args : string | string [ ] , options : GeneratorOptions < TStep > ) {
46+ constructor ( args : string | string [ ] , options : GeneratorOptions < TStep > , sharedOptions ?: SharedOptions < TStep > ) {
4347 super ( args , options ) ;
48+
4449 BaseGenerator . counter += 1 ;
45- this . generatorName = this . constructor . name ;
50+ BaseGenerator . sharedOptions = sharedOptions ; // (<IProperty>options)['sharedOptions'] ;
4651
52+ this . generatorName = this . constructor . name ;
4753 this . projectInfo = new ProjectInfo ( ) ;
48- BaseGenerator . sharedOptions = ( < IProperty > options ) [ 'sharedOptions' ] ;
4954
5055 this . setRootPath ( ) ;
5156 }
0 commit comments