Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Add ability to be used as a Yeoman generator #105

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
@@ -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();
}
});
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -17,7 +17,8 @@
"template",
"webpack",
"koa",
"transmit"
"transmit",
"yeoman-generator"
],
"main": "dist/server.js",
"scripts": {
Expand Down Expand Up @@ -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"
Expand Down