Compare commits

..
19 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
13 changed files with 126 additions and 89 deletions
+25
View File
@@ -1,5 +1,30 @@
# 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
+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
- [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))
---
+4 -1
View File
@@ -4,6 +4,7 @@ let utils = require('../../utils/all');
let prompts = require('./prompts');
let path = require('path');
let fs = require('fs');
const packageInfo = require('../../package.json');
// Set the base root directory for our files
let baseRootPath = path.dirname(require.resolve('react-webpack-template'));
@@ -47,12 +48,14 @@ module.exports = generator.Base.extend({
this.appName = props.appName;
this.style = props.style;
this.postcss = props.postcss
this.generatedWithVersion = packageInfo.version.split('.').unshift();
// Set needed keys into config
this.config.set('appName', this.appName);
this.config.set('appPath', this.appPath);
this.config.set('style', this.style);
this.config.set('postcss', this.postcss);
this.config.set('generatedWithVersion', this.generatedWithVersion);
this.config.save();
@@ -138,7 +141,7 @@ module.exports = generator.Base.extend({
install: function() {
if(this.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']) {
+2 -2
View File
@@ -1,5 +1,5 @@
'use strict';
let utils = require('../../utils/all');
const utils = require('../../utils/all');
module.exports = [
{
@@ -11,7 +11,7 @@ module.exports = [
{
type: 'list',
name: 'style',
message: 'Which styles language you want to use?',
message: 'Which style language do you want to use?',
choices: utils.config.getChoices('style'),
default: utils.config.getDefaultChoice('style')
},
+3 -3
View File
@@ -2,11 +2,11 @@
let generator = require('yeoman-generator');
let utils = require('../../utils/all');
module.exports = generator.NamedBase.extend({
module.exports = generator.Base.extend({
constructor: function() {
generator.NamedBase.apply(this, arguments);
generator.Base.apply(this, arguments);
this.argument('name', { type: String, required: true });
this.option('stateless', {
desc: 'Create a stateless component instead of a full one',
defaults: false
+10 -10
View File
@@ -1,6 +1,6 @@
/*eslint-env node, mocha */
/*global expect */
/*eslint no-console: 0*/
/* eslint-env node, mocha */
/* global expect */
/* eslint no-console: 0 */
'use strict';
// 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 %>';
describe('<%= component.className %>', () => {
let component;
let component;
beforeEach(() => {
component = createComponent(<%= component.className %>);
});
beforeEach(() => {
component = createComponent(<%= component.className %>);
});
it('should have its component name as default className', () => {
expect(component.props.className).to.equal('<%= style.className %>');
});
it('should have its component name as default className', () => {
expect(component.props.className).to.equal('<%= style.className %>');
});
});
+5 -3
View File
@@ -1,6 +1,6 @@
{
"name": "generator-react-webpack",
"version": "3.1.1",
"version": "3.3.0",
"description": "Yeoman generator for using React with Webpack via Babel",
"keywords": [
"yeoman-generator",
@@ -42,7 +42,7 @@
"dependencies": {
"react-webpack-template": "^1.0.0",
"underscore.string": "^3.2.2",
"yeoman-generator": "^0.21.0",
"yeoman-generator": "^0.22.0",
"yeoman-welcome": "^1.0.1",
"esprima": "^2.7.0",
"esprima-walk": "^0.1.0",
@@ -50,7 +50,9 @@
},
"devDependencies": {
"chai": "^3.2.0",
"mocha": "^2.3.2"
"mocha": "^2.3.2",
"yeoman-assert": "^2.1.1",
"yeoman-test": "^1.0.0"
},
"engines": {
"node": ">=4.0.0",
+52 -43
View File
@@ -1,37 +1,51 @@
'use strict';
let path = require('path');
let expect = require('chai').expect;
let assert = require('yeoman-generator').assert;
let helpers = require('yeoman-generator').test
let assert = require('yeoman-assert');
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', () => {
let defaultPrompts = require('../../../generators/app/prompts.js');
let prompts = {};
for(let p of defaultPrompts) {
prompts[p.name] = p.default;
}
let generator;
let generatorBase = path.join(__dirname, '../../../generators/app');
before((done) => {
helpers.run(generatorBase)
.inTmpDir()
.withOptions({
'skip-welcome-message': true,
'skip-install': true
})
.withPrompts(prompts)
.on('ready', (instance) => {
generator = instance;
})
.on('end', done);
beforeLoad(prompts, done);
});
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', () => {
expect(generator.config.get('style')).to.equal('css');
});
@@ -65,6 +79,7 @@ describe('react-webpack:app', () => {
assert.file([
'cfg/base.js',
'cfg/defaults.js',
'cfg/dev.js',
'cfg/dist.js',
'cfg/test.js',
@@ -77,8 +92,8 @@ describe('react-webpack:app', () => {
assert.file([
'src/actions/README.md',
'src/index.js',
'src/components/Main.js',
'src/components/run.js',
'src/favicon.ico',
'src/images/yeoman.png',
'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 = {};
for(let p of defaultPrompts) {
prompts[p.name] = p.default;
@@ -110,29 +124,23 @@ describe('react-webpack:app non-default-prompts', () => {
prompts.postcss = true;
let generator;
let generatorBase = path.join(__dirname, '../../../generators/app');
before((done) => {
helpers.run(generatorBase)
.inTmpDir()
.withOptions({
'skip-welcome-message': true,
'skip-install': true
})
.withPrompts(prompts)
.on('ready', (instance) => {
generator = instance;
})
.on('end', done);
beforeLoad(prompts, done);
});
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', () => {
expect(generator.config.get('style')).to.equal('css');
});
it('should enable "PostCSS"', () => {
expect(generator.config.get('postcss')).to.equal(true);
});
});
describe('#createFiles', () => {
@@ -159,6 +167,7 @@ describe('react-webpack:app non-default-prompts', () => {
assert.file([
'cfg/base.js',
'cfg/defaults.js',
'cfg/dev.js',
'cfg/dist.js',
'cfg/test.js',
@@ -169,24 +178,24 @@ describe('react-webpack:app non-default-prompts', () => {
it('should insert the postcss loader into the style pipes', () => {
assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader\'');
assert.fileContent('cfg/base.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\'');
assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader!less-loader\'');
assert.fileContent('cfg/base.js', 'loader: \'style-loader!css-loader!postcss-loader!stylus-loader\'');
assert.fileContent('cfg/defaults.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/defaults.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/defaults.js', 'loader: \'style-loader!css-loader!postcss-loader!stylus-loader\'');
});
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', () => {
assert.file([
'src/actions/README.md',
'src/index.js',
'src/components/Main.js',
'src/components/run.js',
'src/favicon.ico',
'src/images/yeoman.png',
'src/index.html',
+2 -2
View File
@@ -1,7 +1,7 @@
'use strict';
let path = require('path');
let assert = require('yeoman-generator').assert;
let helpers = require('yeoman-generator').test
let assert = require('yeoman-assert');
let helpers = require('yeoman-test');
describe('react-webpack:component', () => {
+4 -4
View File
@@ -1,9 +1,9 @@
'use strict';
let config = require('./config');
let yeoman = require('./yeoman');
const config = require('./config');
const yeoman = require('./yeoman');
module.exports = {
config: config,
yeoman: yeoman
config,
yeoman
};
+4 -7
View File
@@ -57,12 +57,9 @@ let getDefaultChoice = (setting) => {
return config && config.default !== undefined && config.default.length > 0 ? config.default : null;
}
// getChoices
// getDefault
module.exports = {
getSetting: getSetting,
getChoices: getChoices,
getChoiceByKey: getChoiceByKey,
getDefaultChoice: getDefaultChoice
getSetting,
getChoices,
getChoiceByKey,
getDefaultChoice
};
+4 -4
View File
@@ -63,8 +63,8 @@
"value": "sass",
"suffix": ".sass",
"packages": [
{ "name": "sass-loader", "version": "^1.0.1" },
{ "name": "node-sass", "version": "^3.3.3" }
{ "name": "sass-loader", "version": "^3.1.2" },
{ "name": "node-sass", "version": "^3.4.2" }
]
},
{
@@ -72,8 +72,8 @@
"value": "scss",
"suffix": ".scss",
"packages": [
{ "name": "sass-loader", "version": "^1.0.1" },
{ "name": "node-sass", "version": "^3.3.3" }
{ "name": "sass-loader", "version": "^3.1.2" },
{ "name": "node-sass", "version": "^3.4.2" }
]
},
{
+10 -10
View File
@@ -1,8 +1,8 @@
'use strict';
let path = require('path');
let configUtils = require('./config');
let _ = require('underscore.string');
const path = require('path');
const configUtils = require('./config');
const _ = require('underscore.string');
// Needed directory paths
const baseName = path.basename(process.cwd());
@@ -157,11 +157,11 @@ let getDestinationClassName = (name, type, suffix) => {
};
module.exports = {
getBaseDir: getBaseDir,
getAllSettingsFromComponentName: getAllSettingsFromComponentName,
getAppName: getAppName,
getCleanedPathName: getCleanedPathName,
getComponentStyleName: getComponentStyleName,
getDestinationPath: getDestinationPath,
getDestinationClassName: getDestinationClassName
getBaseDir,
getAllSettingsFromComponentName,
getAppName,
getCleanedPathName,
getComponentStyleName,
getDestinationPath,
getDestinationClassName
};