Last active
March 23, 2016 23:48
-
-
Save nicoespeon/76f229641fd534e25407 to your computer and use it in GitHub Desktop.
Blog - Plop — a micro-generator to ease your daily life - setGenerator
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
| module.exports = ( plop ) => { | |
| // We declare a new generator called "module" | |
| plop.setGenerator( "module", { | |
| // Succintly describes what generator does. | |
| description: "Create a new module", | |
| // Get inputs from the user. | |
| // That's Inquirer.js doing the job behind the hood. | |
| prompts: [ | |
| { | |
| type: "input", | |
| name: "name", | |
| message: "What is your module name?" | |
| } | |
| ], | |
| // List of actions to take. | |
| // Here we "add" new files from our templates. | |
| actions: [ | |
| { | |
| type: "add", | |
| path: "app/modules/{{camelCase name}}.js", | |
| templateFile: "plop-templates/module.js" | |
| }, | |
| { | |
| type: "add", | |
| path: "app/tests/{{camelCase name}}.tests.js", | |
| templateFile: "plop-templates/module.tests.js" | |
| } | |
| ] | |
| } ); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment