generator-nodejs-common
Version:
66 lines (57 loc) • 1.55 kB
JavaScript
'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
module.exports = yeoman.generators.Base.extend({
prompting: function () {
var done = this.async();
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the kryptonian ' + chalk.red('NodejsCommon') + ' generator!'
));
var prompts = [{
type: 'confirm',
name: 'someOption',
message: 'Would you like to enable this option?',
default: true
}];
this.prompt(prompts, function (props) {
this.props = props;
// To access props later use this.props.someOption;
done();
}.bind(this));
},
writing: {
app: function () {
this.fs.copy(
this.templatePath('_package.json'),
this.destinationPath('package.json')
);
this.fs.copy(
this.templatePath('_bower.json'),
this.destinationPath('bower.json')
);
},
projectfiles: function () {
// this.fs.copy(
// this.templatePath('editorconfig'),
// this.destinationPath('.editorconfig')
// );
this.fs.copy(
this.templatePath('config/_env.json'),
this.destinationPath('config/env.json')
);
this.fs.copy(
this.templatePath('_.gitignore'),
this.destinationPath('.gitignore')
);
this.fs.copy(
this.templatePath('_.jshintrc'),
this.destinationPath('.jshintrc')
);
}
},
install: function () {
this.installDependencies();
}
});