Skip to content

Commit

Permalink
fix: double prompt issue (close #25)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Aug 31, 2020
1 parent 277d5cb commit 88109df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class CoreGenerator extends Generator {
});
});

this._prompts = prompts;
this._corePrompts = prompts;
this.props = {};
}

Expand Down Expand Up @@ -264,16 +264,16 @@ class CoreGenerator extends Generator {
process.exit(-1);
}
} else {
const namePrompt = _.find(this._prompts, {name: 'appName'});
const namePrompt = _.find(this._corePrompts, {name: 'appName'});
if (namePrompt) {
namePrompt.default = this.appname;
namePrompt.when = () => !this.options.appName;
}

// Remove prompts for already defined properties
_.remove(this._prompts, (p) => this.props[p.name] !== undefined);
_.remove(this._corePrompts, (p) => this.props[p.name] !== undefined);

const props = await this.prompt(this._prompts);
const props = await this.prompt(this._corePrompts);
processProps(props);
}
}
Expand Down

0 comments on commit 88109df

Please sign in to comment.