mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-08-30 11:23:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
432d5d00de | ||
|
|
685f6a75ce | ||
|
|
82a080f586 | ||
|
|
6c41164d4a | ||
|
|
9eedc6fd2f | ||
|
|
83d47bddd8 | ||
|
|
31e478f28d | ||
|
|
b95fc4344a | ||
|
|
66b85f48d8 | ||
|
|
bf2df82159 | ||
|
|
d729c3caa8 | ||
|
|
4f99a5a9db |
@@ -1,5 +1,15 @@
|
|||||||
# generator-react-webpack - Changelog
|
# generator-react-webpack - Changelog
|
||||||
|
|
||||||
|
## 2.2.4
|
||||||
|
___Upgrades:___
|
||||||
|
|
||||||
|
1. Added automatic generation of components displayName property. This makes it easier to keep track of components that reside in deep subfolders (like src/components/my/example/components/indexComponent) would become "index" as a displayName, but should instead be MyExampleComponentsIndexComponent instead.
|
||||||
|
|
||||||
|
## 2.2.3
|
||||||
|
___Fixes:___
|
||||||
|
|
||||||
|
1. Fixed .gitignore renaming (Patch provided by [VovanR](https://github.com/VovanR))
|
||||||
|
|
||||||
## 2.2.0:
|
## 2.2.0:
|
||||||
___Upgrades:___
|
___Upgrades:___
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Out of the box it comes with support for:
|
|||||||
- Ability to unit test components via Karma and Mocha/Chai
|
- Ability to unit test components via Karma and Mocha/Chai
|
||||||
|
|
||||||
## Changes in Version 2.0
|
## Changes in Version 2.0
|
||||||
Tthis generator is written in ES2015. This means it is ___not compatible with node.js versions before 4.0___.
|
This generator is written in ES2015. This means it is ___not compatible with node.js versions before 4.0___.
|
||||||
|
|
||||||
It also does __NOT__ include support for Flux-Frameworks anymore. Instead, we will use it as a base for other generators to build upon. This will make the base generator easier to use and update.
|
It also does __NOT__ include support for Flux-Frameworks anymore. Instead, we will use it as a base for other generators to build upon. This will make the base generator easier to use and update.
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ module.exports = generator.Base.extend({
|
|||||||
let excludeList = [
|
let excludeList = [
|
||||||
'LICENCE',
|
'LICENCE',
|
||||||
'README.md',
|
'README.md',
|
||||||
|
'CHANGELOG.md',
|
||||||
'node_modules',
|
'node_modules',
|
||||||
'package.json'
|
'package.json'
|
||||||
];
|
];
|
||||||
@@ -110,6 +111,9 @@ module.exports = generator.Base.extend({
|
|||||||
if(fs.lstatSync(fullPath).isDirectory()) {
|
if(fs.lstatSync(fullPath).isDirectory()) {
|
||||||
this.bulkDirectory(item, item);
|
this.bulkDirectory(item, item);
|
||||||
} else {
|
} else {
|
||||||
|
if (item === '.npmignore') {
|
||||||
|
this.copy(item, '.gitignore');
|
||||||
|
}
|
||||||
this.copy(item, item);
|
this.copy(item, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ class <%= component.className %> extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<%= component.className %>.displayName = '<%= component.displayName %>';
|
||||||
|
|
||||||
// Uncomment properties you need
|
// Uncomment properties you need
|
||||||
// <%= component.className %>.propTypes = {};
|
// <%= component.className %>.propTypes = {};
|
||||||
// <%= component.className %>.defaultProps = {};
|
// <%= component.className %>.defaultProps = {};
|
||||||
|
|
||||||
|
|
||||||
export default <%= component.className %>;
|
export default <%= component.className %>;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "generator-react-webpack",
|
"name": "generator-react-webpack",
|
||||||
"version": "2.2.0",
|
"version": "2.2.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ describe('react-webpack:app', () => {
|
|||||||
assert.file([
|
assert.file([
|
||||||
'.editorconfig',
|
'.editorconfig',
|
||||||
'.eslintrc',
|
'.eslintrc',
|
||||||
|
'.gitignore',
|
||||||
'.npmignore',
|
'.npmignore',
|
||||||
'.yo-rc.json'
|
'.yo-rc.json'
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -47,6 +47,14 @@ describe('react-webpack:component', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should have its displayName set per default', (done) => {
|
||||||
|
|
||||||
|
createGeneratedComponent('mycomponent', 'css', () => {
|
||||||
|
assert.fileContent('src/components/MycomponentComponent.js', `displayName = 'MycomponentComponent';`);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Style', () => {
|
describe('Style', () => {
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ describe('Utilities:Yeoman', () => {
|
|||||||
path: 'src/components/my/component/',
|
path: 'src/components/my/component/',
|
||||||
fileName: 'TestComponent.js',
|
fileName: 'TestComponent.js',
|
||||||
className: 'TestComponent',
|
className: 'TestComponent',
|
||||||
|
displayName: 'MyComponentTestComponent',
|
||||||
suffix: '.js'
|
suffix: '.js'
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
|
|||||||
@@ -51,7 +51,8 @@
|
|||||||
"value": "sass",
|
"value": "sass",
|
||||||
"suffix": ".sass",
|
"suffix": ".sass",
|
||||||
"packages": [
|
"packages": [
|
||||||
{ "name": "sass-loader", "version": "^1.0.1" }
|
{ "name": "sass-loader", "version": "^1.0.1" },
|
||||||
|
{ "name": "node-sass", "version": "^3.3.3" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -59,7 +60,8 @@
|
|||||||
"value": "scss",
|
"value": "scss",
|
||||||
"suffix": ".scss",
|
"suffix": ".scss",
|
||||||
"packages": [
|
"packages": [
|
||||||
{ "name": "sass-loader", "version": "^1.0.1" }
|
{ "name": "sass-loader", "version": "^1.0.1" },
|
||||||
|
{ "name": "node-sass", "version": "^3.3.3" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -67,7 +69,8 @@
|
|||||||
"value": "less",
|
"value": "less",
|
||||||
"suffix": ".less",
|
"suffix": ".less",
|
||||||
"packages": [
|
"packages": [
|
||||||
{ "name": "less-loader", "version": "^2.0.0" }
|
{ "name": "less-loader", "version": "^2.0.0" },
|
||||||
|
{ "name": "less", "version": "^2.5.3" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ let getAllSettingsFromComponentName = (componentName, style) => {
|
|||||||
let componentBaseName = _.capitalize(componentParts.pop());
|
let componentBaseName = _.capitalize(componentParts.pop());
|
||||||
let componentPartPath = componentParts.join('/');
|
let componentPartPath = componentParts.join('/');
|
||||||
|
|
||||||
|
// Get the components displayName property
|
||||||
|
let componentFullName = _.classify(_.replaceAll(componentName, '/', '_'));
|
||||||
|
|
||||||
// Configure Styles
|
// Configure Styles
|
||||||
let stylePaths = configUtils.getChoiceByKey('path', 'style');
|
let stylePaths = configUtils.getChoiceByKey('path', 'style');
|
||||||
let styleSettings = configUtils.getChoiceByKey('style', style);
|
let styleSettings = configUtils.getChoiceByKey('style', style);
|
||||||
@@ -56,6 +59,7 @@ let getAllSettingsFromComponentName = (componentName, style) => {
|
|||||||
path: `${componentPath.path}/${componentPartPath}/`,
|
path: `${componentPath.path}/${componentPartPath}/`,
|
||||||
fileName: `${componentBaseName}Component.js`,
|
fileName: `${componentBaseName}Component.js`,
|
||||||
className: `${componentBaseName}Component`,
|
className: `${componentBaseName}Component`,
|
||||||
|
displayName: `${componentFullName}Component`,
|
||||||
suffix: '.js'
|
suffix: '.js'
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
|
|||||||
Reference in New Issue
Block a user