Last active
March 21, 2019 16:30
-
-
Save misterdev/12846aa5529765430886cb2ed6892e34 to your computer and use it in GitHub Desktop.
2
This file contains 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'); | |
// => We import the helper functions | |
const { List, Input } = require('@webpack-cli/webpack-scaffold'); | |
module.exports = class WebpackGenerator extends Generator { | |
constructor(args, opts) { /* ... */ } | |
prompting() { | |
return this.prompt([ | |
// => Input, asks the user to write a response | |
Input('name', 'How do you want to name your project? (my-vue-project)'), | |
Input('inFolder', 'Which folder will your source code be in? (src)'), | |
Input('entry', 'Which is the entry point of your app? (main)'), | |
Input('outFolder', 'Which folder will your generated bundles be in? (dist)'), | |
Input('publicFolder', 'Which folder will your public assets be in? (public)'), | |
// => List, lets the user select it's preferred choice from a list (e.g. yarn, npm) | |
List('manager', 'Which package manager do you prefer?', ['yarn', 'npm']) | |
]).then (answers => { | |
// => answers will contain the user's responses | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment