Last active
November 30, 2016 21:52
-
-
Save kenwheeler/7a043557ac2c911b76f65233b9fae26f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
module.exports = { | |
destination: { | |
default: function (data) { | |
return data.packageName; | |
} | |
}, | |
prompts: { | |
packageName: { | |
message: "Package / GitHub project name (e.g., 'whiz-bang-component')", | |
validate: function (val) { | |
return /^([a-z0-9]+\-?)+$/.test(val.trim()) || "Must be lower + dash-cased string"; | |
} | |
}, | |
enableRedux: { | |
type: "confirm", | |
message: "Do you want to include Redux?", | |
}, | |
}, | |
derived: { | |
componentPath: function (data, cb) { cb(null, data.packageName); }, | |
componentName: function (data, cb) { | |
// PascalCase (with first character capitalized). | |
var name = data.packageName | |
.replace(/^\s+|\s+$/g, "") | |
.replace(/(^|[-_ ])+(.)/g, function (match, first, second) { | |
return second.toUpperCase(); | |
}); | |
cb(null, name); | |
} | |
} | |
}; | |
// Directory | |
// app/ | |
// components/ | |
// {{enableRedux}}container.js | |
// config/ | |
// {{enableRedux}}redux/ | |
// reducers/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment