Skip to content

Commit a8aaaf3

Browse files
author
Peter Ullrich
committed
this.skipGenerator
1 parent bff8511 commit a8aaaf3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
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.1.12",
2+
"version": "0.1.13",
33
"name": "dotup-typescript-yeoman-generators",
44
"author": {
55
"name": "Peter Ullrich",

src/BaseGenerator.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
2020
readonly projectInfo: ProjectInfo;
2121

2222
skipQuestions: boolean = false;
23+
skipGenerator: boolean = false;
2324
projectFiles: Project;
2425

2526
conflictedProjectFiles: Project;
@@ -204,6 +205,7 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
204205
* Where you prompt users for options(where you’d call this.prompt())
205206
*/
206207
async prompting(): Promise<void> {
208+
if (this.skipGenerator) return;
207209

208210
if (this.skipQuestions || this.questions.length < 1) {
209211
return;
@@ -267,18 +269,23 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
267269
* Saving configurations and configure the project(creating.editorconfig files and other metadata files)
268270
*/
269271
async configuring(): Promise<void> {
272+
if (this.skipGenerator) return;
270273
// tslint:disable-next-line: no-backbone-get-set-outside-model
271274
// this.config.set('answers', this.answers);
272275
// this.config.save();
273276
}
274277

275278
loadTemplateFiles(): void {
279+
if (this.skipGenerator) return;
280+
276281
this.logBlue(`Analyse template files. (${this.generatorName})`);
277282
const x = new ProjectPathAnalyser((...args) => this.templatePath(...args));
278283
this.projectFiles = x.getProjectFiles(this.projectInfo);
279284
}
280285

281286
async copyTemplateFiles(): Promise<void> {
287+
if (this.skipGenerator) return;
288+
282289
this.conflictedProjectFiles = new Project(this.projectInfo);
283290

284291
this.projectFiles.templateFiles.forEach(file => {
@@ -372,10 +379,14 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
372379
// abstract async writing(): Promise<void>;
373380
// tslint:disable-next-line: no-reserved-keywords
374381
async default(): Promise<void> {
382+
if (this.skipGenerator) return;
383+
375384
this.loadTemplateFiles();
376385
}
377386

378387
async writing(): Promise<void> {
388+
if (this.skipGenerator) return;
389+
379390
await this.copyTemplateFiles();
380391
}
381392

0 commit comments

Comments
 (0)