Skip to content

Commit

Permalink
v6.1.0 (#233)
Browse files Browse the repository at this point in the history
* fix(core): revert defaulting with github username due to context issues - #226
  • Loading branch information
prescottprue authored Jun 12, 2020
1 parent add35ed commit 087f706
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 39 deletions.
8 changes: 0 additions & 8 deletions examples/react-firebase/.babelrc

This file was deleted.

43 changes: 13 additions & 30 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,36 +270,19 @@ module.exports = class extends Generator {
)
)

function runPrompts(githubUsername) {
// Set github username as default
const [firstPrompt, ...restOfPrompts] = prompts
const modifiedPrompts = [
{ ...firstPrompt, default: githubUsername || '' },
...restOfPrompts
]
return this.prompt(modifiedPrompts).then((props) => {
this.answers = props
// Map features array to answerNames
if (props.otherFeatures) {
featureChoices.forEach((choice) => {
const matching = props.otherFeatures.find(
(feature) => choice.name === feature
)
this.answers[choice.answerName] = !!matching
})
}
this.data = Object.assign({}, this.initialData, this.answers)
})
}
const boundRunPrompts = runPrompts.bind(this)

// Run prompts regardless of if getting github username is successful
return this.user.github
.username()
.then(boundRunPrompts)
.catch(() => {
boundRunPrompts()
})
return this.prompt(prompts).then((props) => {
this.answers = props
// Map features array to answerNames
if (props.otherFeatures) {
featureChoices.forEach((choice) => {
const matching = props.otherFeatures.find(
(feature) => choice.name === feature
)
this.answers[choice.answerName] = !!matching
})
}
this.data = Object.assign({}, this.initialData, this.answers)
})
}

writing() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-react-firebase",
"version": "6.0.0",
"version": "6.1.0",
"description": "React and Firebase (with option for Redux) starter project generator.",
"main": "generators/index.js",
"scripts": {
Expand Down

0 comments on commit 087f706

Please sign in to comment.