Compare commits

...
10 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
9 changed files with 89 additions and 67 deletions
+13
View File
@@ -1,5 +1,18 @@
# 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
+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
@@ -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
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "generator-react-webpack",
"version": "3.2.2",
"version": "3.3.0",
"description": "Yeoman generator for using React with Webpack via Babel",
"keywords": [
"yeoman-generator",
+48 -39
View File
@@ -4,34 +4,48 @@ let expect = require('chai').expect;
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',
@@ -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,16 +178,16 @@ 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', () => {
+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
};
+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
};