Skip to content

Commit

Permalink
Answer stored inside config should take precedence over suggestions. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed May 18, 2021
1 parent ce12e7f commit c1c847d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,8 @@ class Generator extends Base {
const value = questionStorage.getPath(name);
if (value !== undefined) {
question.default = value;
return [name, value];
}

return [name, value];
}

return undefined;
Expand All @@ -550,18 +549,18 @@ class Generator extends Base {

// Pre-fill answers with storage values.
const answers = {};
questions
.map(getAnswerFromStorage)
.filter((a) => a)
.forEach(([key, value]) => {
answers[key] = value;
});

questions = promptSuggestion.prefillQuestions(
this._globalConfig,
questions
);
questions = promptSuggestion.prefillQuestions(this.config, questions);
questions
.map(getAnswerFromStorage)
.filter((a) => a)
.forEach(([key, value]) => {
answers[key] = value;
});

return this.env.adapter.prompt(questions, answers).then((answers) => {
Object.entries(storageForQuestion).forEach(([name, questionStorage]) => {
Expand Down

0 comments on commit c1c847d

Please sign in to comment.