Skip to content
This repository was archived by the owner on Jul 2, 2020. It is now read-only.
Merged
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
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
env:
node: true

globals:
Promise: true

rules:

# Trivia: stroustrup is the designer and original implementor of C++.
Expand Down
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
language: node_js
node_js:
- "0.10"
- '0.12'
script:
- npm run lint
- npm test
after_success:
- npm run coveralls
notifications:
email: false
slack:
secure: V3v+RTLnSF0V1cXRvQTsluiBusOIp2pR/54uD6CjQhv16GCjd2iB7orhbCcynMeaDR5e1eiJLybCKGeXFcfg/M/cZUk+H93nIGvK2jzj0xHAEB6cCOjEAf3BCqD9F3kX/EnMO7TgXO+5ZNK7SvcUw7qhJhYcjPgjdP9ihIwXChU=
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Springworks Yeoman Generator

[![Build Status](https://travis-ci.org/Springworks/generator-springworks.png?branch=master)](https://travis-ci.org/Springworks/generator-springworks)
[![Coverage Status](https://coveralls.io/repos/Springworks/generator-springworks/badge.png?branch=master)](https://coveralls.io/r/Springworks/generator-springworks?branch=master)
[![Dependency Status](https://david-dm.org/springworks/generator-springworks.svg)](https://david-dm.org/springworks/generator-springworks)

This generator helps to setup new projects in the Springworks organization.

Expand Down
120 changes: 120 additions & 0 deletions generators/react/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
'use strict';

var yeoman = require('yeoman-generator'),
chalk = require('chalk');


/**
* Exports the generator
*/
module.exports = yeoman.generators.Base.extend({
constructor: function() {
yeoman.generators.Base.apply(this, arguments);
this.option('skip-install', {desc: 'Skip npm install'});
},

initializing: function() {
var welcomeMessage = [
'\nSpringworks',
chalk.bold.green('React Scaffolding'),
'Generator\n'
];
this.log(welcomeMessage.join(' '));
this.currentYear = (new Date()).getFullYear();
},

// Ask the user a couple of questions
prompting: function() {
var done = this.async(),

prompts = [
{
type: 'input',
name: 'projectName',
message: 'What\'s your project name?',
default: this.appname
},
{
type: 'input',
name: 'projectDescription',
message: 'Whats\'s your project description?',
default: this.appname
}
];

this.prompt(prompts, function(answers) {
this.appname = answers.projectName.toLowerCase();
this.projectDescription = answers.projectDescription;
done();
}.bind(this));
},

// Writes configuration to the `.yo-rc.json` file
configuring: function() {
this.config.set({
projectName: this.appname,
projectDescription: this.projectDescription
});
},

// Writes a bunch of files to the destination directory
writing: {
projectfiles: function() {
this.template('_package.json', 'package.json');
this.template('_README.md', 'README.md');
},

gitFiles: function() {
this.copy('gitignore', '.gitignore');
this.copy('gitattributes', '.gitattributes');
},

lintFiles: function() {
this.copy('eslintignore', '.eslintignore');
this.copy('eslintrc', '.eslintrc');
this.copy('gjslintrc', '.gjslintrc'); // Skoog specific ;)
},

npmFiles: function() {
this.copy('npmignore', '.npmignore');
},

gulpFiles: function() {
this.copy('gulpfile', 'gulpfile.js');
this.copy('config/webpack.config.js', 'config/webpack.config.js');
this.directory('gulp', 'gulp');
},

serverFiles: function() {
this.template('config/_default.js', 'config/default.js');
this.copy('config/development.js', 'config/development.js');
this.copy('config/production.js', 'config/production.js');
this.copy('config/test.js', 'config/test.js');
this.copy('server.js', 'server.js');
this.directory('server', 'server');
},

clientFiles: function() {
this.directory('client', 'client');
}

},

// Installs dependencies and run a gulp build
install: function() {
/* istanbul ignore if */
if (!this.options['skip-install']) {
this.installDependencies({
skipInstall: false,
callback: function () {
this.spawnCommand('gulp', ['build']);
}.bind(this)
});
}
},

end: function() {
this.log(chalk.yellow('\nDon\'t forget to encrypt your config/*.js files!\n'));
}

});
7 changes: 7 additions & 0 deletions generators/react/templates/_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# # <%= _.slugify(appname) %>



## Gulp
Gulp is the build tool that will build and compile everything we need for the app. Look in
`gulp/index.js` for configuration options and in `gulp/tasks/*.js` for various tasks.
82 changes: 82 additions & 0 deletions generators/react/templates/_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "<%= _.slugify(appname) %>",
"version": "1.0.0",
"description": "<%= projectDescription %>",
"private": true,
"engines": {
"node": ">=0.10.33"
},
"scripts": {
"supervisor": "supervisor -w server ./server.js | bunyan",
"test": "NODE_ENV=test istanbul cover --report teamcity --report lcov _mocha -- --ui bdd --check-leaks --recursive --slow 200 --reporter spec --globals 'Intl,IntlPolyfill' server/test",
"lint": "eslint .",
"inspectjs": "jsinspect --threshold 30 ./lib",
"buddyjs": "buddy ./lib",
"quality": "npm run buddyjs && npm run inspectjs && npm run lint",
"test-acceptance": "NODE_ENV=test istanbul cover --report teamcity --report lcov _mocha -- --ui bdd --check-leaks --recursive --slow 200 --reporter spec --globals 'Intl,IntlPolyfill' $(find server/test/**/acceptance server/test/acceptance -name '*.js' 2>/dev/null)",
"test-changed": "NODE_ENV=test mocha --ui bdd --check-leaks --recursive --slow 200 --reporter spec --globals 'Intl,IntlPolyfill' $(git diff --name-only test | grep -E '(\\.js)$')",
"test-component": "NODE_ENV=test istanbul cover --report teamcity --report lcov _mocha -- --ui bdd --check-leaks --recursive --slow 200 --reporter spec --globals 'Intl,IntlPolyfill' $(find server/test/**/component server/test/component -name *.js 2>/dev/null)",
"test-no-cov": "NODE_ENV=test mocha --ui bdd --check-leaks --recursive --slow 200 --reporter spec --globals 'Intl,IntlPolyfill' server/test",
"test-unit": "NODE_ENV=test istanbul cover --report teamcity --report lcov _mocha -- --ui bdd --check-leaks --recursive --slow 200 --reporter spec --globals 'Intl,IntlPolyfill' $(find server/test/**/unit server/test/unit -name '*.js' 2>/dev/null)"
},
"repository": {
"type": "git",
"url": "git://github.com/Springworks/<%= _.slugify(appname) %>.git"
},
"author": "Springworks",
"bugs": {
"url": "https://github.com/Springworks/<%= _.slugify(appname) %>/issues"
},
"dependencies": {
"bluebird": "^2.9.6",
"boom": "^2.6.1",
"bootstrap": "^3.3.2",
"bunyan": "^1.3.3",
"config": "^1.10.0",
"flux": "^2.0.1",
"hapi": "^8.1.0",
"hapi-auth-basic": "^2.0.0",
"hapi-auth-cookie": "^2.0.0",
"hoek": "^2.11.0",
"jade": "^1.9.1",
"joi": "^5.1.0",
"jquery": "^2.1.3",
"react": "^0.12.2",
"react-router": "^0.11.6",
"wreck": "^5.1.0"
},
"devDependencies": {
"app-root-path": "^1.0.0",
"buddy.js": "^0.8.0",
"chai": "^1.10.0",
"chalk": "^0.5.1",
"code": "^1.3.0",
"eslint": "^0.13.0",
"gulp": "^3.8.10",
"gulp-autoprefixer": "^2.1.0",
"gulp-csscomb": "^3.0.3",
"gulp-eslint": "^0.2.2",
"gulp-gzip": "0.0.8",
"gulp-if": "^1.2.5",
"gulp-imagemin": "^2.1.0",
"gulp-less": "^2.0.1",
"gulp-minify-css": "^0.4.4",
"gulp-plumber": "^0.6.6",
"gulp-rimraf": "^0.1.1",
"gulp-size": "^1.2.0",
"gulp-uglify": "^1.1.0",
"gulp-util": "^3.0.3",
"inquirer": "^0.8.0",
"istanbul": "^0.3.5",
"jsinspect": "^0.5.0",
"jsx-loader": "^0.12.2",
"merge-stream": "^0.1.7",
"mocha": "^2.1.0",
"reactify": "^1.0.0",
"run-sequence": "^1.0.2",
"semver": "^4.2.0",
"supervisor": "^0.6.0",
"webpack": "^1.5.3",
"yargs": "^1.3.3"
}
}
4 changes: 4 additions & 0 deletions generators/react/templates/client/assets/i18n/available.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
"en",
"sv"
]
Empty file.
5 changes: 5 additions & 0 deletions generators/react/templates/client/assets/styles/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This files is the main file for all the styles.
// Only use imports in this file.

body {
}
3 changes: 3 additions & 0 deletions generators/react/templates/client/scripts/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
env:
browser: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @jsx React.DOM */
'use strict';

var React = require('react'),

Mycomponent = React.createClass({
render: function() {
return (
<h1 className="Mycomponent">
<span className="glyphicon glyphicon-heart"> ReactJS</span>
</h1>
)
}
});

module.exports = Mycomponent;
9 changes: 9 additions & 0 deletions generators/react/templates/client/scripts/login.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @jsx React.DOM */
'use strict';

var React = require('react');
window.React = React;

var MyComponent = require('./components/mycomponent.jsx');

React.render(<MyComponent />, document.getElementById('content'));
51 changes: 51 additions & 0 deletions generators/react/templates/config/_default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';


/**
* Default configuration should be as close to production config as possible.
* Any REQUIRED deviations can be added to environment-specific >env>.js files.
*
* @type {Object}
*/
module.exports = {

// Server configuration
server: {
host: 'localhost',
port: 3000,
base_uri: '',
shutdown_timeout: (1 * 1000),

template_cache: {
enabled: false
},

options: {
debug: {
request: ['error']
}
}
},

security: {
cookie_password: 'changme-1',
session_cookie_password: 'changme-2',
session_cookie_name: 'changme-3'
},

// Logging
logging: {
name: '<%= _.slugify(appname) %>',
level: 'info'
},

devel: {
long_stacktrace: false
},

// Jade config
jade: {
pretty: true,
debug: false
}
};
11 changes: 11 additions & 0 deletions generators/react/templates/config/development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';


/**
* Development configuration should be as close to production config as possible.
* Any REQUIRED deviations can be added to environment-specific >env>.js files.
*
* @type {Object}
*/
module.exports = {
};
17 changes: 17 additions & 0 deletions generators/react/templates/config/production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';


/**
* Production configuration should be as close to production config as possible.
* Any REQUIRED deviations can be added to environment-specific >env>.js files.
*
* @type {Object}
*/
module.exports = {
server: {
host: '0.0.0.0',
port: 80,
base_uri: '',
shutdown_timeout: (60 * 1000)
}
};
11 changes: 11 additions & 0 deletions generators/react/templates/config/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';


/**
* Test configuration should be as close to production config as possible.
* Any REQUIRED deviations can be added to environment-specific >env>.js files.
*
* @type {Object}
*/
module.exports = {
};
Loading