Compare commits

...
24 Commits
Author SHA1 Message Date
Chris 35ef93138c 3.3.0 2016-03-29 23:24:14 +02:00
Chris 4e698c51b4 Added new changelog for 3.3.0 2016-03-29 23:09:07 +02:00
Chris 832907f2fd Added minor es2015 tweaks 2016-03-29 23:01:42 +02:00
Chris 6344984d65 Added ability to save generator version for future updates 2016-03-29 23:00:55 +02:00
Chris 6b9e24c85a 3.2.4 2016-03-02 11:56:34 +01:00
Chris 561e072a9c Adjusted generated unit tests 2016-03-02 11:56:12 +01:00
Chris 56d6b9cd48 3.2.3 2016-02-23 22:14:34 +01:00
Chris 43f3bce786 Added changelog for 3.2.3 (adjusted postcss config to work with new react-webpack-template). 2016-02-23 22:14:02 +01:00
Chris f6327e1904 Merge pull request #188 from thewtex/grammar
Grammar improvement to the style prompt.
2016-01-25 08:33:00 +01:00
Matt McCormick bd5748bb89 Grammar improvement to the style prompt. 2016-01-24 10:14:47 -05:00
Chris 782a38b685 3.2.2 2016-01-13 07:57:00 +01:00
Chris 946775a22f Fix: Set correct indention for generated unit tests 2016-01-13 07:56:49 +01:00
Chris 165b4ae956 3.2.1 2015-12-28 08:21:27 +01:00
Chris cb08986a6d Updated tests for new version of react-webpack-template 2015-12-28 08:21:00 +01:00
Chris 52e7528cd2 Merge pull request #179 from stylesuxx/master
Added link to generator-react-webpack-redux to the extending section
2015-12-22 19:52:34 +01:00
stylesuxx 85c0f7f343 Added link to generator-react-webpack-redux to the extending section 2015-12-22 16:47:01 +01:00
Chris 8ee10ffd52 3.2.0 2015-12-18 08:44:52 +01:00
Chris 60bf2aae3a Adjusted generator for updated yeoman-generator to 0.22.x 2015-12-18 08:44:42 +01:00
Chris cb98c7e528 Updated sass dependencies to new versions (fixes https://github.com/newtriks/generator-react-webpack/issues/171) 2015-12-01 07:48:31 +01:00
Chris 498c1032f2 3.1.1 2015-11-24 08:42:31 +01:00
Chris 20cbcee3fe Added missing dependencies for stylus (fixes https://github.com/newtriks/generator-react-webpack/issues/170), moved additional deps to devDependencies when installing 2015-11-24 08:42:21 +01:00
Chris e74b89d8ea Fixed tests for current version (uses style-loader now) 2015-11-23 08:58:05 +01:00
Chris 4e2650f244 Updated travis configuration 2015-11-23 08:51:15 +01:00
Chris c99d3c6682 Updated travis configuration 2015-11-23 08:50:13 +01:00
14 changed files with 137 additions and 94 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
language: node_js language: node_js
sudo: false
node_js: node_js:
- '4.1.0' - '4.2.2'
before_install: before_install:
- currentfolder=${PWD##*/} - currentfolder=${PWD##*/}
- if [ "$currentfolder" != 'generator-react-webpack' ]; then cd .. && eval "mv $currentfolder generator-react-webpack" && cd generator-react-webpack; fi - if [ "$currentfolder" != 'generator-react-webpack' ]; then cd .. && eval "mv $currentfolder generator-react-webpack" && cd generator-react-webpack; fi
+29
View File
@@ -1,5 +1,34 @@
# generator-react-webpack - Changelog # generator-react-webpack - Changelog
## 3.3.0
1. Added new yeoman key "generatedWithVersion". Will be used for backwards compatibility of new major releases.
## 3.2.4
1. Added whitespaces to generated unit tests (made problems when using it with various eslint rules)
## 3.2.3
1. Adjusted postcss to work with react-webpack-template 1.4 upwards
2. Improved styling output (provided by [thewtex](https://github.com/thewtex))
## 3.2.2
1. Cleaned up formatting of unit tests
## 3.2.1
1. Updated tests for new version of react-webpack-template
## 3.2.0
1. Updated yeoman-generator package to new version 0.22.1 (some methods like generator.NamedBase are now deprecated!)
## 3.1.1
1. Added bugfix for https://github.com/newtriks/generator-react-webpack/issues/170
## 3.1.0 ## 3.1.0
1. Added support for postcss (Patch provided by [stylesuxx](https://github.com/stylesuxx)) 1. Added support for postcss (Patch provided by [stylesuxx](https://github.com/stylesuxx))
+1
View File
@@ -26,6 +26,7 @@ If you have built a generator using generator-react-webpack, tell us and we will
## Generators that extend generator-react-webpack ## Generators that extend generator-react-webpack
- [Generator-React-Webpack-Alt](https://github.com/weblogixx/generator-react-webpack-alt) (Adds ability to create actions, stores and sources for [alt.js](http://alt.js.org)) - [Generator-React-Webpack-Alt](https://github.com/weblogixx/generator-react-webpack-alt) (Adds ability to create actions, stores and sources for [alt.js](http://alt.js.org))
- [Generator-React-Webpack-Redux](https://github.com/stylesuxx/generator-react-webpack-redux) (Adds ability to create actions and reducers for [Redux](https://github.com/rackt/redux))
--- ---
+6 -3
View File
@@ -4,6 +4,7 @@ let utils = require('../../utils/all');
let prompts = require('./prompts'); let prompts = require('./prompts');
let path = require('path'); let path = require('path');
let fs = require('fs'); let fs = require('fs');
const packageInfo = require('../../package.json');
// Set the base root directory for our files // Set the base root directory for our files
let baseRootPath = path.dirname(require.resolve('react-webpack-template')); let baseRootPath = path.dirname(require.resolve('react-webpack-template'));
@@ -47,12 +48,14 @@ module.exports = generator.Base.extend({
this.appName = props.appName; this.appName = props.appName;
this.style = props.style; this.style = props.style;
this.postcss = props.postcss this.postcss = props.postcss
this.generatedWithVersion = packageInfo.version.split('.').unshift();
// Set needed keys into config // Set needed keys into config
this.config.set('appName', this.appName); this.config.set('appName', this.appName);
this.config.set('appPath', this.appPath); this.config.set('appPath', this.appPath);
this.config.set('style', this.style); this.config.set('style', this.style);
this.config.set('postcss', this.postcss); this.config.set('postcss', this.postcss);
this.config.set('generatedWithVersion', this.generatedWithVersion);
this.config.save(); this.config.save();
@@ -83,7 +86,7 @@ module.exports = generator.Base.extend({
if(styleConfig && styleConfig.packages) { if(styleConfig && styleConfig.packages) {
for(let dependency of styleConfig.packages) { for(let dependency of styleConfig.packages) {
packageSettings.dependencies[dependency.name] = dependency.version; packageSettings.devDependencies[dependency.name] = dependency.version;
} }
} }
@@ -92,7 +95,7 @@ module.exports = generator.Base.extend({
if(this.postcss && postcssConfig && postcssConfig.packages) { if(this.postcss && postcssConfig && postcssConfig.packages) {
for(let dependency of postcssConfig.packages) { for(let dependency of postcssConfig.packages) {
packageSettings.dependencies[dependency.name] = dependency.version; packageSettings.devDependencies[dependency.name] = dependency.version;
} }
} }
@@ -138,7 +141,7 @@ module.exports = generator.Base.extend({
install: function() { install: function() {
if(this.postcss) { if(this.postcss) {
let postcss = require('./postcss'); let postcss = require('./postcss');
postcss.write(path.join(this.destinationRoot(), 'cfg/base.js')); postcss.write(path.join(this.destinationRoot(), 'cfg/defaults.js'));
} }
if(!this.options['skip-install']) { if(!this.options['skip-install']) {
+2 -2
View File
@@ -1,5 +1,5 @@
'use strict'; 'use strict';
let utils = require('../../utils/all'); const utils = require('../../utils/all');
module.exports = [ module.exports = [
{ {
@@ -11,7 +11,7 @@ module.exports = [
{ {
type: 'list', type: 'list',
name: 'style', name: 'style',
message: 'Which styles language you want to use?', message: 'Which style language do you want to use?',
choices: utils.config.getChoices('style'), choices: utils.config.getChoices('style'),
default: utils.config.getDefaultChoice('style') default: utils.config.getDefaultChoice('style')
}, },
+3 -3
View File
@@ -2,11 +2,11 @@
let generator = require('yeoman-generator'); let generator = require('yeoman-generator');
let utils = require('../../utils/all'); let utils = require('../../utils/all');
module.exports = generator.NamedBase.extend({ module.exports = generator.Base.extend({
constructor: function() { constructor: function() {
generator.NamedBase.apply(this, arguments); generator.Base.apply(this, arguments);
this.argument('name', { type: String, required: true });
this.option('stateless', { this.option('stateless', {
desc: 'Create a stateless component instead of a full one', desc: 'Create a stateless component instead of a full one',
defaults: false defaults: false
+10 -10
View File
@@ -1,6 +1,6 @@
/*eslint-env node, mocha */ /* eslint-env node, mocha */
/*global expect */ /* global expect */
/*eslint no-console: 0*/ /* eslint no-console: 0 */
'use strict'; 'use strict';
// Uncomment the following lines to use the react test utilities // Uncomment the following lines to use the react test utilities
@@ -10,13 +10,13 @@ import createComponent from 'helpers/shallowRenderHelper';
import <%= component.className %> from '<%= component.webpackPath %>'; import <%= component.className %> from '<%= component.webpackPath %>';
describe('<%= component.className %>', () => { describe('<%= component.className %>', () => {
let component; let component;
beforeEach(() => { beforeEach(() => {
component = createComponent(<%= component.className %>); component = createComponent(<%= component.className %>);
}); });
it('should have its component name as default className', () => { it('should have its component name as default className', () => {
expect(component.props.className).to.equal('<%= style.className %>'); expect(component.props.className).to.equal('<%= style.className %>');
}); });
}); });
+5 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "generator-react-webpack", "name": "generator-react-webpack",
"version": "3.1.0", "version": "3.3.0",
"description": "Yeoman generator for using React with Webpack via Babel", "description": "Yeoman generator for using React with Webpack via Babel",
"keywords": [ "keywords": [
"yeoman-generator", "yeoman-generator",
@@ -42,7 +42,7 @@
"dependencies": { "dependencies": {
"react-webpack-template": "^1.0.0", "react-webpack-template": "^1.0.0",
"underscore.string": "^3.2.2", "underscore.string": "^3.2.2",
"yeoman-generator": "^0.21.0", "yeoman-generator": "^0.22.0",
"yeoman-welcome": "^1.0.1", "yeoman-welcome": "^1.0.1",
"esprima": "^2.7.0", "esprima": "^2.7.0",
"esprima-walk": "^0.1.0", "esprima-walk": "^0.1.0",
@@ -50,7 +50,9 @@
}, },
"devDependencies": { "devDependencies": {
"chai": "^3.2.0", "chai": "^3.2.0",
"mocha": "^2.3.2" "mocha": "^2.3.2",
"yeoman-assert": "^2.1.1",
"yeoman-test": "^1.0.0"
}, },
"engines": { "engines": {
"node": ">=4.0.0", "node": ">=4.0.0",
+52 -44
View File
@@ -1,37 +1,51 @@
'use strict'; 'use strict';
let path = require('path'); let path = require('path');
let expect = require('chai').expect; let expect = require('chai').expect;
let assert = require('yeoman-generator').assert; let assert = require('yeoman-assert');
let helpers = require('yeoman-generator').test let helpers = require('yeoman-test');
// Default globals, used in all tests
const defaultPrompts = require('../../../generators/app/prompts.js');
let generator;
const generatorBase = path.join(__dirname, '../../../generators/app');
/**
* Global before load function. Run in the before callbacks
* @param {Object} prompts List of prompts to use
* @param {Function} done Done callback
*/
const beforeLoad = (prompts, done) => {
helpers.run(generatorBase)
.inTmpDir()
.withOptions({
'skip-welcome-message': true,
'skip-install': true
})
.withPrompts(prompts)
.on('ready', (instance) => {
generator = instance;
})
.on('end', done);
};
describe('react-webpack:app', () => { describe('react-webpack:app', () => {
let defaultPrompts = require('../../../generators/app/prompts.js');
let prompts = {}; let prompts = {};
for(let p of defaultPrompts) { for(let p of defaultPrompts) {
prompts[p.name] = p.default; prompts[p.name] = p.default;
} }
let generator;
let generatorBase = path.join(__dirname, '../../../generators/app');
before((done) => { before((done) => {
beforeLoad(prompts, done);
helpers.run(generatorBase)
.inTmpDir()
.withOptions({
'skip-welcome-message': true,
'skip-install': true
})
.withPrompts(prompts)
.on('ready', (instance) => {
generator = instance;
})
.on('end', done);
}); });
describe('#config', () => { describe('#config', () => {
it('should set the generatedWith key to the current generator major version', () => {
expect(generator.config.get('generatedWithVersion')).to.equal(3);
});
it('should use "css" as default style language', () => { it('should use "css" as default style language', () => {
expect(generator.config.get('style')).to.equal('css'); expect(generator.config.get('style')).to.equal('css');
}); });
@@ -65,6 +79,7 @@ describe('react-webpack:app', () => {
assert.file([ assert.file([
'cfg/base.js', 'cfg/base.js',
'cfg/defaults.js',
'cfg/dev.js', 'cfg/dev.js',
'cfg/dist.js', 'cfg/dist.js',
'cfg/test.js', 'cfg/test.js',
@@ -77,8 +92,8 @@ describe('react-webpack:app', () => {
assert.file([ assert.file([
'src/actions/README.md', 'src/actions/README.md',
'src/index.js',
'src/components/Main.js', 'src/components/Main.js',
'src/components/run.js',
'src/favicon.ico', 'src/favicon.ico',
'src/images/yeoman.png', 'src/images/yeoman.png',
'src/index.html', 'src/index.html',
@@ -100,9 +115,8 @@ describe('react-webpack:app', () => {
}); });
}); });
describe('react-webpack:app non-default-prompts', () => { describe('react-webpack:app with PostCSS support', () => {
let defaultPrompts = require('../../../generators/app/prompts.js');
let prompts = {}; let prompts = {};
for(let p of defaultPrompts) { for(let p of defaultPrompts) {
prompts[p.name] = p.default; prompts[p.name] = p.default;
@@ -110,29 +124,23 @@ describe('react-webpack:app non-default-prompts', () => {
prompts.postcss = true; prompts.postcss = true;
let generator;
let generatorBase = path.join(__dirname, '../../../generators/app');
before((done) => { before((done) => {
beforeLoad(prompts, done);
helpers.run(generatorBase)
.inTmpDir()
.withOptions({
'skip-welcome-message': true,
'skip-install': true
})
.withPrompts(prompts)
.on('ready', (instance) => {
generator = instance;
})
.on('end', done);
}); });
describe('#config', () => { describe('#config', () => {
it('should set the generatedWith key to the current generator major version', () => {
expect(generator.config.get('generatedWithVersion')).to.equal(3);
});
it('should use "css" as default style language', () => { it('should use "css" as default style language', () => {
expect(generator.config.get('style')).to.equal('css'); expect(generator.config.get('style')).to.equal('css');
}); });
it('should enable "PostCSS"', () => {
expect(generator.config.get('postcss')).to.equal(true);
});
}); });
describe('#createFiles', () => { describe('#createFiles', () => {
@@ -159,6 +167,7 @@ describe('react-webpack:app non-default-prompts', () => {
assert.file([ assert.file([
'cfg/base.js', 'cfg/base.js',
'cfg/defaults.js',
'cfg/dev.js', 'cfg/dev.js',
'cfg/dist.js', 'cfg/dist.js',
'cfg/test.js', 'cfg/test.js',
@@ -169,25 +178,24 @@ describe('react-webpack:app non-default-prompts', () => {
it('should insert the postcss loader into the style pipes', () => { it('should insert the postcss loader into the style pipes', () => {
assert.fileContent('cfg/base.js', 'loader: \'style!css!postcss-loader\''); assert.fileContent('cfg/defaults.js', 'loader: \'style-loader!css-loader!postcss-loader\'');
//assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader\''); assert.fileContent('cfg/defaults.js', 'loader: \'style-loader!css-loader!postcss-loader!sass-loader?outputStyle=expanded&indentedSyntax\'');
assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader!sass-loader?outputStyle=expanded&indentedSyntax\''); assert.fileContent('cfg/defaults.js', 'loader: \'style-loader!css-loader!postcss-loader!sass-loader?outputStyle=expanded\'');
assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader!sass-loader?outputStyle=expanded\''); assert.fileContent('cfg/defaults.js', 'loader: \'style-loader!css-loader!postcss-loader!less-loader\'');
assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader!less-loader\''); assert.fileContent('cfg/defaults.js', 'loader: \'style-loader!css-loader!postcss-loader!stylus-loader\'');
assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader!stylus-loader\'');
}); });
it('should append the postcss function to the base config', () => { it('should append the postcss function to the base config', () => {
assert.fileContent('cfg/base.js', ',\n postcss: function () {\n return [];\n }'); assert.fileContent('cfg/defaults.js', ',\n postcss: function () {\n return [];\n }');
}); });
it('should generate required source files', () => { it('should generate required source files', () => {
assert.file([ assert.file([
'src/actions/README.md', 'src/actions/README.md',
'src/index.js',
'src/components/Main.js', 'src/components/Main.js',
'src/components/run.js',
'src/favicon.ico', 'src/favicon.ico',
'src/images/yeoman.png', 'src/images/yeoman.png',
'src/index.html', 'src/index.html',
+2 -2
View File
@@ -1,7 +1,7 @@
'use strict'; 'use strict';
let path = require('path'); let path = require('path');
let assert = require('yeoman-generator').assert; let assert = require('yeoman-assert');
let helpers = require('yeoman-generator').test let helpers = require('yeoman-test');
describe('react-webpack:component', () => { describe('react-webpack:component', () => {
+4 -4
View File
@@ -1,9 +1,9 @@
'use strict'; 'use strict';
let config = require('./config'); const config = require('./config');
let yeoman = require('./yeoman'); const yeoman = require('./yeoman');
module.exports = { module.exports = {
config: config, config,
yeoman: yeoman yeoman
}; };
+4 -7
View File
@@ -57,12 +57,9 @@ let getDefaultChoice = (setting) => {
return config && config.default !== undefined && config.default.length > 0 ? config.default : null; return config && config.default !== undefined && config.default.length > 0 ? config.default : null;
} }
// getChoices
// getDefault
module.exports = { module.exports = {
getSetting: getSetting, getSetting,
getChoices: getChoices, getChoices,
getChoiceByKey: getChoiceByKey, getChoiceByKey,
getDefaultChoice: getDefaultChoice getDefaultChoice
}; };
+7 -5
View File
@@ -63,8 +63,8 @@
"value": "sass", "value": "sass",
"suffix": ".sass", "suffix": ".sass",
"packages": [ "packages": [
{ "name": "sass-loader", "version": "^1.0.1" }, { "name": "sass-loader", "version": "^3.1.2" },
{ "name": "node-sass", "version": "^3.3.3" } { "name": "node-sass", "version": "^3.4.2" }
] ]
}, },
{ {
@@ -72,8 +72,8 @@
"value": "scss", "value": "scss",
"suffix": ".scss", "suffix": ".scss",
"packages": [ "packages": [
{ "name": "sass-loader", "version": "^1.0.1" }, { "name": "sass-loader", "version": "^3.1.2" },
{ "name": "node-sass", "version": "^3.3.3" } { "name": "node-sass", "version": "^3.4.2" }
] ]
}, },
{ {
@@ -90,7 +90,9 @@
"value": "stylus", "value": "stylus",
"suffix": ".styl", "suffix": ".styl",
"packages": [ "packages": [
{ "name": "stylus-loader", "version": "^0.5.0" } { "name": "stylus-loader", "version": "^0.5.0" },
{ "name": "stylus", "version": "~0.49.2" },
{ "name": "nib", "version": "~1.0.4" }
] ]
} }
], ],
+10 -10
View File
@@ -1,8 +1,8 @@
'use strict'; 'use strict';
let path = require('path'); const path = require('path');
let configUtils = require('./config'); const configUtils = require('./config');
let _ = require('underscore.string'); const _ = require('underscore.string');
// Needed directory paths // Needed directory paths
const baseName = path.basename(process.cwd()); const baseName = path.basename(process.cwd());
@@ -157,11 +157,11 @@ let getDestinationClassName = (name, type, suffix) => {
}; };
module.exports = { module.exports = {
getBaseDir: getBaseDir, getBaseDir,
getAllSettingsFromComponentName: getAllSettingsFromComponentName, getAllSettingsFromComponentName,
getAppName: getAppName, getAppName,
getCleanedPathName: getCleanedPathName, getCleanedPathName,
getComponentStyleName: getComponentStyleName, getComponentStyleName,
getDestinationPath: getDestinationPath, getDestinationPath,
getDestinationClassName: getDestinationClassName getDestinationClassName
}; };