mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-08-30 11:23:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35ef93138c | ||
|
|
4e698c51b4 | ||
|
|
832907f2fd | ||
|
|
6344984d65 |
@@ -1,6 +1,11 @@
|
||||
# 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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
let utils = require('../../utils/all');
|
||||
const utils = require('../../utils/all');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "generator-react-webpack",
|
||||
"version": "3.2.4",
|
||||
"version": "3.3.0",
|
||||
"description": "Yeoman generator for using React with Webpack via Babel",
|
||||
"keywords": [
|
||||
"yeoman-generator",
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
@@ -101,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;
|
||||
@@ -111,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', () => {
|
||||
|
||||
+4
-4
@@ -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
@@ -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
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user