Skip to content

Commit 1d3539c

Browse files
author
Peter Ullrich
committed
sharedOptions
1 parent b25ba13 commit 1d3539c

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.3.0",
2+
"version": "0.3.1",
33
"name": "dotup-typescript-yeoman-generators",
44
"author": {
55
"name": "Peter Ullrich",

src/BaseGenerator.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ export abstract class BaseGenerator<TStep extends string> extends generator impl
4545

4646
currentStep: TStep;
4747

48-
constructor(args: string | string[], options: GeneratorOptions<TStep>, sharedOptions?: SharedOptions<TStep>) {
48+
constructor(args: string | string[], options: GeneratorOptions<TStep>) {
4949
super(args, options);
5050

5151
BaseGenerator.counter += 1;
52-
BaseGenerator.sharedOptions = sharedOptions; // (<IProperty>options)['sharedOptions'];
52+
BaseGenerator.sharedOptions = (<IProperty>options)['sharedOptions']; // (<IProperty>options)['sharedOptions'];
5353

5454
this.generatorName = this.constructor.name;
5555
this.projectInfo = new ProjectInfo();
@@ -58,8 +58,12 @@ export abstract class BaseGenerator<TStep extends string> extends generator impl
5858
}
5959

6060
compose(generator: string, passThroughAnswers: boolean = true, options?: any): void {
61-
const optArgs = passThroughAnswers ? this.answers : options;
62-
this.composeWith(require.resolve('generator'), optArgs);
61+
const optArgs = options;
62+
if(passThroughAnswers){
63+
_.merge(optArgs, this.answers);
64+
}
65+
optArgs['sharedOptions'] = this.sharedOptions;
66+
this.composeWith(require.resolve(generator), optArgs);
6367
}
6468

6569
trySubscribeSharedOption(questionName: TStep | string): void {

0 commit comments

Comments
 (0)