From 1162cf5656c7836103657739ef74298f136833cd Mon Sep 17 00:00:00 2001 From: rishabh3112 Date: Mon, 18 Mar 2019 20:25:49 +0530 Subject: [PATCH 1/4] fix(add): add handling for topScope --- packages/generators/add-generator.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/generators/add-generator.ts b/packages/generators/add-generator.ts index 977850f2167..aaf8368015b 100644 --- a/packages/generators/add-generator.ts +++ b/packages/generators/add-generator.ts @@ -161,7 +161,17 @@ export default class AddGenerator extends Generator { this.configuration.config.webpackOptions.entry = entryOptions; this.configuration.config.item = action; }); - } + } else { + if(action === 'topScope'){ + return this.prompt([ + Input("topScope", "Enter line youwant to add to topScope"), + ]) + .then((topScopeAnswer) => { + this.configuration.config.topScope.push(topScopeAnswer.topScope); + done(); + }) + } + } const temp: string = action; if (action === "resolveLoader") { action = "resolve"; From 163b309b1ce1e3fa3d4c834c9d8ed2fab79a73b5 Mon Sep 17 00:00:00 2001 From: rishabh3112 Date: Mon, 18 Mar 2019 20:40:46 +0530 Subject: [PATCH 2/4] fix(add): lint code --- packages/generators/add-generator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/generators/add-generator.ts b/packages/generators/add-generator.ts index aaf8368015b..1eb80ed5aa1 100644 --- a/packages/generators/add-generator.ts +++ b/packages/generators/add-generator.ts @@ -162,14 +162,14 @@ export default class AddGenerator extends Generator { this.configuration.config.item = action; }); } else { - if(action === 'topScope'){ + if (action === "topScope") { return this.prompt([ - Input("topScope", "Enter line youwant to add to topScope"), + Input("topScope", "Enter line you want to add to topScope"), ]) .then((topScopeAnswer) => { this.configuration.config.topScope.push(topScopeAnswer.topScope); done(); - }) + }); } } const temp: string = action; From dbc3e9e91c6c2a181c497a46441042b11dba2bfa Mon Sep 17 00:00:00 2001 From: rishabh3112 Date: Tue, 19 Mar 2019 12:27:58 +0530 Subject: [PATCH 3/4] fix(add): fix runTransform rephrase question --- packages/generators/add-generator.ts | 6 ++++-- packages/utils/scaffold.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/generators/add-generator.ts b/packages/generators/add-generator.ts index 1eb80ed5aa1..dd099f9592e 100644 --- a/packages/generators/add-generator.ts +++ b/packages/generators/add-generator.ts @@ -164,9 +164,11 @@ export default class AddGenerator extends Generator { } else { if (action === "topScope") { return this.prompt([ - Input("topScope", "Enter line you want to add to topScope"), + Input("topScope", "What do you want to add to topScope?"), ]) - .then((topScopeAnswer) => { + .then((topScopeAnswer: { + topScope: string + }) => { this.configuration.config.topScope.push(topScopeAnswer.topScope); done(); }); diff --git a/packages/utils/scaffold.ts b/packages/utils/scaffold.ts index c3ced0fc904..3edfa815991 100644 --- a/packages/utils/scaffold.ts +++ b/packages/utils/scaffold.ts @@ -44,7 +44,7 @@ export default function runTransform(transformConfig: ITransformConfig, action: const transformations: string[] = mapOptionsToTransform(config); - if (config.topScope) { + if (config.topScope && transformations.indexOf("topScope") === -1) { transformations.push("topScope"); } From d4ce6f2e458822dc85a8c86956c10aa93d141f3c Mon Sep 17 00:00:00 2001 From: rishabh3112 Date: Tue, 19 Mar 2019 12:37:55 +0530 Subject: [PATCH 4/4] fix(add): add types --- packages/generators/add-generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/generators/add-generator.ts b/packages/generators/add-generator.ts index dd099f9592e..908621ce1cc 100644 --- a/packages/generators/add-generator.ts +++ b/packages/generators/add-generator.ts @@ -167,7 +167,7 @@ export default class AddGenerator extends Generator { Input("topScope", "What do you want to add to topScope?"), ]) .then((topScopeAnswer: { - topScope: string + topScope: string; }) => { this.configuration.config.topScope.push(topScopeAnswer.topScope); done();