mirror of
https://github.com/react-webpack-generators/generator-react-webpack.git
synced 2025-12-08 18:01:59 +00:00
add protection against creating an action/store with no name
This commit is contained in:
parent
80ddea2248
commit
7242c7030f
@ -3,8 +3,11 @@ var util = require('util');
|
|||||||
var ScriptBase = require('../script-base.js');
|
var ScriptBase = require('../script-base.js');
|
||||||
|
|
||||||
var ActionGenerator = module.exports = function ActionGenerator(args, options, config) {
|
var ActionGenerator = module.exports = function ActionGenerator(args, options, config) {
|
||||||
|
if (!args[0]) console.log('\n Please specify a name for this action creator \n');
|
||||||
|
else {
|
||||||
args[0] += 'ActionCreators';
|
args[0] += 'ActionCreators';
|
||||||
ScriptBase.apply(this, arguments);
|
ScriptBase.apply(this, arguments)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
util.inherits(ActionGenerator, ScriptBase);
|
util.inherits(ActionGenerator, ScriptBase);
|
||||||
|
|||||||
@ -13,6 +13,8 @@ ComponentGenerator.prototype.createComponentFile = function createComponentFile(
|
|||||||
|
|
||||||
this.es6 = this.options.es6;
|
this.es6 = this.options.es6;
|
||||||
|
|
||||||
|
console.log('Creating a component');
|
||||||
|
|
||||||
this.generateComponentTestAndStyle(
|
this.generateComponentTestAndStyle(
|
||||||
'Component',
|
'Component',
|
||||||
'spec/Component',
|
'spec/Component',
|
||||||
|
|||||||
@ -82,7 +82,6 @@ Generator.prototype.testTemplate = function (src, dest) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Generator.prototype.stylesTemplate = function (src, dest) {
|
Generator.prototype.stylesTemplate = function (src, dest) {
|
||||||
console.log(src);
|
|
||||||
yeoman.generators.Base.prototype.template.apply(this, [
|
yeoman.generators.Base.prototype.template.apply(this, [
|
||||||
src + this.stylesSuffix,
|
src + this.stylesSuffix,
|
||||||
path.join(this.options.stylesPath, dest) + this.stylesSuffix
|
path.join(this.options.stylesPath, dest) + this.stylesSuffix
|
||||||
|
|||||||
@ -3,9 +3,12 @@ var util = require('util');
|
|||||||
var ScriptBase = require('../script-base.js');
|
var ScriptBase = require('../script-base.js');
|
||||||
|
|
||||||
var StoreGenerator = module.exports = function StoreGenerator(args, options, config) {
|
var StoreGenerator = module.exports = function StoreGenerator(args, options, config) {
|
||||||
|
if (!args[0]) console.log('\n Please specify a name for this store \n');
|
||||||
|
else {
|
||||||
args[0] += 'Store';
|
args[0] += 'Store';
|
||||||
ScriptBase.apply(this, arguments);
|
ScriptBase.apply(this, arguments)
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
util.inherits(StoreGenerator, ScriptBase);
|
util.inherits(StoreGenerator, ScriptBase);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user