Created
March 18, 2019 10:38
-
-
Save divyanshu013/5a399b6251e617f09f0779b920b95b9e to your computer and use it in GitHub Desktop.
Adding prompting to generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Generator = require('yeoman-generator'); | |
module.exports = class extends Generator { | |
// ... | |
async prompting() { | |
this.log('Generator starting... 🤖'); | |
this.answers = await this.prompt([ | |
{ | |
type: 'list', | |
name: 'type', | |
message: 'What shall we create today?', | |
choices: ['screen', 'redux-module'], | |
}, | |
{ | |
type: 'input', | |
name: 'name', | |
message: 'Input the name for this module', | |
validate: input => Boolean(input.length), | |
}, | |
]); | |
} | |
// ... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment