mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-08-31 12:01:42 +08:00
add 'architecture' question, Reflux option, and related store and actionCreator
This commit is contained in:
+15
-2
@@ -20,6 +20,7 @@ var Generator = module.exports = function Generator() {
|
||||
this.classedFileName = this._.capitalizeFile(this.name);
|
||||
this.classedName = this._.capitalizeClass(this.name);
|
||||
this.stylesLanguage = this.config.get('styles-language');
|
||||
this.architecture = this.config.get('architecture');
|
||||
|
||||
if (typeof this.options.appPath === 'undefined') {
|
||||
this.options.appPath = this.options.appPath || 'src/scripts';
|
||||
@@ -60,6 +61,13 @@ var Generator = module.exports = function Generator() {
|
||||
util.inherits(Generator, yeoman.generators.NamedBase);
|
||||
|
||||
Generator.prototype.appTemplate = function (src, dest) {
|
||||
yeoman.generators.Base.prototype.template.apply(this, [
|
||||
path.join('javascript', src + this.scriptSuffix),
|
||||
path.join(this.options.appPath, dest) + this.scriptSuffix
|
||||
]);
|
||||
};
|
||||
|
||||
Generator.prototype.reactComponentTemplate = function (src, dest) {
|
||||
yeoman.generators.Base.prototype.template.apply(this, [
|
||||
path.join('javascript', src + this.reactSuffix),
|
||||
path.join(this.options.appPath, dest) + this.reactSuffix
|
||||
@@ -88,8 +96,13 @@ Generator.prototype.htmlTemplate = function (src, dest) {
|
||||
]);
|
||||
};
|
||||
|
||||
Generator.prototype.generateSourceAndTest = function (appTemplate, testTemplate, stylesTemplate, targetDirectory, includeStyles) {
|
||||
Generator.prototype.generateSourceAndTest = function (appTemplate, testTemplate, targetDirectory) {
|
||||
this.appTemplate(appTemplate, path.join(targetDirectory, this._.capitalizeFile(this.name)));
|
||||
this.testTemplate(testTemplate, path.join(targetDirectory, this._.capitalizeFile(this.name)));
|
||||
if(includeStyles) this.stylesTemplate(stylesTemplate, path.join(this._.capitalizeFile(this.name)));
|
||||
};
|
||||
|
||||
Generator.prototype.generateComponentTestAndStyle = function (componentTemplate, testTemplate, stylesTemplate, targetDirectory) {
|
||||
this.reactComponentTemplate(componentTemplate, path.join(targetDirectory, this._.capitalizeFile(this.name)));
|
||||
this.testTemplate(testTemplate, path.join(targetDirectory, this._.capitalizeFile(this.name)));
|
||||
this.stylesTemplate(stylesTemplate, path.join(this._.capitalizeFile(this.name)));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user