Skip to content

Instantly share code, notes, and snippets.

@divyanshu013
Created March 18, 2019 10:38
Show Gist options
  • Save divyanshu013/5a399b6251e617f09f0779b920b95b9e to your computer and use it in GitHub Desktop.
Save divyanshu013/5a399b6251e617f09f0779b920b95b9e to your computer and use it in GitHub Desktop.
Adding prompting to generator
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