Added changes for version 2.0

This commit is contained in:
Chris
2015-09-21 20:45:57 +02:00
parent 438341c3fe
commit 023d937877
69 changed files with 1149 additions and 18551 deletions
+36
View File
@@ -0,0 +1,36 @@
'use strict';
let generator = require('yeoman-generator');
let utils = require('../../utils/all');
module.exports = generator.NamedBase.extend({
constructor: function() {
generator.NamedBase.apply(this, arguments);
},
writing: function() {
let settings = utils.yeoman.getAllSettingsFromComponentName(this.name, this.config.get('style'));
// Create the style template
this.fs.copyTpl(
this.templatePath(`styles/Component${settings.style.suffix}`),
this.destinationPath(settings.style.path + settings.style.fileName),
settings
);
// Create the component
this.fs.copyTpl(
this.templatePath('components/Base.js'),
this.destinationPath(settings.component.path + settings.component.fileName),
settings
);
// Create the unit test
this.fs.copyTpl(
this.templatePath('tests/Base.js'),
this.destinationPath(settings.test.path + settings.test.fileName),
settings
);
}
});
@@ -0,0 +1,21 @@
'use strict';
import React from 'react/addons';
require('<%= style.webpackPath %>');
class <%= component.className %> extends React.Component {
render() {
return (
<div className="<%= style.className %>">
Please edit <%= component.path %>/<%= component.fileName %> to update this component!
</div>
);
}
}
// Uncomment properties you need
// <%= component.className %>.propTypes = {};
// <%= component.className %>.defaultProps = {};
export default <%= component.className %>;
@@ -0,0 +1,3 @@
.<%= style.className %> {
border: 1px dashed #f00;
}
@@ -0,0 +1,3 @@
.<%= style.className %> {
border: 1px dashed #f00;
}
@@ -0,0 +1,2 @@
.<%= style.className %>
border: 1px dashed #f00
@@ -0,0 +1,3 @@
.<%= style.className %> {
border: 1px dashed #f00;
}
@@ -0,0 +1,2 @@
.<%= style.className %>
border 1px dashed #f00
@@ -0,0 +1,23 @@
/*eslint-env node, mocha */
/*global expect */
/*eslint no-console: 0*/
'use strict';
// Uncomment the following lines to use the react test utilities
// import React from 'react/addons';
// const TestUtils = React.addons.TestUtils;
import createComponent from 'helpers/shallowRenderHelper';
import <%= component.className %> from '<%= component.webpackPath %>';
describe('<%= component.className %>', () => {
let component;
beforeEach(() => {
component = createComponent(<%= component.className %>);
});
it('should have its component name as default className', () => {
expect(component._store.props.className).to.equal('<%= style.className %>');
});
});