diff --git a/generators/app/index.js b/generators/app/index.js new file mode 100644 index 0000000..c050647 --- /dev/null +++ b/generators/app/index.js @@ -0,0 +1,34 @@ +'use strict'; +var yeoman = require('yeoman-generator'); +var chalk = require('chalk'); +var yosay = require('yosay'); +var path = require('path'); + +var sourcePath = path.join(__dirname, '../..'); + +module.exports = yeoman.Base.extend({ + paths: function() { + this.sourceRoot(sourcePath); + }, + + prompting: function () { + this.log(yosay( + 'Welcome to the dandy ' + chalk.red('React Isomorphic Starterkit') + ' generator!' + )); + }, + + writing: function () { + this.fs.copy(this.templatePath('configs'), this.destinationPath('configs')); + this.fs.copy(this.templatePath('dist'), this.destinationPath('dist')); + this.fs.copy(this.templatePath('src'), this.destinationPath('src')); + this.fs.copy(this.templatePath('static'), this.destinationPath('static')); + this.fs.copy(this.templatePath('.gitignore'), this.destinationPath('.gitignore')); + this.fs.copy(this.templatePath('package.json'), this.destinationPath('package.json')); + this.fs.copy(this.templatePath('LICENSE.md'), this.destinationPath('LICENSE.md')); + this.fs.copy(this.templatePath('README.md'), this.destinationPath('README.md')); + }, + + install: function () { + this.npmInstall(); + } +}); diff --git a/package.json b/package.json index be0989c..683f751 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-isomorphic-starterkit", + "name": "generator-react-isomorphic-starterkit", "description": "Isomorphic starterkit with server-side React rendering.", "version": "5.1.3", "license": "BSD-3-Clause", @@ -17,7 +17,8 @@ "template", "webpack", "koa", - "transmit" + "transmit", + "yeoman-generator" ], "main": "dist/server.js", "scripts": { @@ -59,7 +60,9 @@ "json-loader": "0.5.4", "just-wait": "1.0.3", "webpack": "1.12.11", - "webpack-dev-server": "1.14.1" + "webpack-dev-server": "1.14.1", + "yeoman-generator": "^0.22.5", + "yosay": "^1.1.0" }, "engines": { "node": ">=0.10.32"