generator-bingo-dig-h5
Version:
Bingo-dig-h5 generator by BINGO.DIG
82 lines (70 loc) • 1.76 kB
JavaScript
'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
module.exports = yeoman.generators.Base.extend({
initializing: function () {
this.pkg = require('../package.json');
},
prompting: function () {
var done = this.async();
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the wondrous' + chalk.red('BingoDigH5') + ' generator!'
));
var prompts = [
{
type : 'input',
name : 'name',
message : 'Your project name',
default : this.appname // Default to current folder name
},
{
type: 'input',
name: 'author',
message: 'author name',
default: 'BINGO.DIG'
}];
this.prompt(prompts, function (props) {
this.props = props;
this.appname = this.props.name;
this.author = this.props.author;
done();
}.bind(this));
},
configuring: {
enforceFolderName: function () {
this.destinationRoot(this.appname);
this.config.save();
}
},
writing: {
app: function () {
this.mkdir('build');
this.directory(
this.templatePath('gulp'),
this.destinationPath('gulp')
);
this.directory(
this.templatePath('src'),
this.destinationPath('src')
);
},
lib: function () {
this.directory(
this.templatePath('libs'),
this.destinationPath('libs')
);
},
projectfiles: function () {
this.template('_package.json', 'package.json');
this.fs.copy(
this.templatePath('gulpfile.js'),
this.destinationPath('gulpfile.js')
);
}
},
install: function () {
this.installDependencies({ bower: false });
}
});