Last active
August 1, 2016 16:47
-
-
Save kristw/61b154958bd31bbd299ff3182a7ae586 to your computer and use it in GitHub Desktop.
An example generator with yeoman-easily
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
var ye = require('yeoman-easily'); | |
var Easily = ye.Easily; | |
var commonPrompts = ye.prompts; | |
var chalk = require('chalk'); | |
module.exports = Easily.createGenerator({ | |
prompting: function () { | |
return this.easily | |
.greet('Welcome to the awesome generator!') | |
.confirmBeforeStart('Would you like to use bower?') | |
.learnPrompts(commonPrompts) | |
.prompt([ | |
'name', | |
'description', | |
'authorName', | |
'authorEmail', | |
'authorUrl', | |
'githubAccount' | |
], true); | |
}, | |
writing: function () { | |
if (this.easily.checkForConfirmation()) { | |
this.easily | |
.extendJSONWithTemplate( | |
'__package.json', | |
'package.json', | |
this.props | |
) | |
.extendJSONWithTemplate( | |
'__bower.json', | |
'bower.json', | |
this.props | |
) | |
.copyFiles('**/*', { | |
ignore: '**/__*', | |
dynamicFiles: [ | |
'src/index.html', | |
'README.md' | |
], | |
props: props | |
}) | |
.composeWithExternal( | |
'generator-license', | |
'license:app', | |
{ | |
name: this.props.authorName, | |
email: this.props.authorEmail, | |
website: this.props.authorUrl | |
} | |
); | |
} | |
}, | |
install: function () { | |
this.installDependencies(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment