generator-applicaster-starter
Version:
yeoman generator to kick start applicaster react-redux web app
99 lines (75 loc) • 4.2 kB
JavaScript
;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = require("fs");
var _fs2 = _interopRequireDefault(_fs);
var _yosay = require("yosay");
var _yosay2 = _interopRequireDefault(_yosay);
var _path = require("path");
var _path2 = _interopRequireDefault(_path);
var _lodash = require("lodash");
var _lodash2 = _interopRequireDefault(_lodash);
var _yeomanGenerator = require("yeoman-generator");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var ApplicasterStarter = function (_Base) {
_inherits(ApplicasterStarter, _Base);
function ApplicasterStarter() {
var _Object$getPrototypeO;
_classCallCheck(this, ApplicasterStarter);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(ApplicasterStarter)).call.apply(_Object$getPrototypeO, [this].concat(args)));
_this.argument('appname', { type: String, required: true });
_this.options.appname = _lodash2.default.camelCase(_this.appname);
return _this;
}
_createClass(ApplicasterStarter, [{
key: "initializing",
value: function initializing() {
this.log((0, _yosay2.default)("welcome to the Applicaster Starter Yeoman Generator !"));
}
}, {
key: "prompting",
value: function prompting() {
var _this2 = this;
return this.prompt([{
type: 'input',
name: 'desc',
message: "Please describe your app in a few words"
}, {
type: 'input',
name: 'repo',
message: "what's the repo url ?"
}, {
type: 'input',
name: 'serverPath',
message: "what is the path of your app on s3 ?"
}]).then(function (answers) {
return Object.keys(answers).forEach(function (key) {
return _this2.options[key] = answers[key];
});
});
}
}, {
key: "writing",
value: function writing() {
this.fs.copyTpl(this.templatePath(), this.destinationPath(), this.options);
}
}, {
key: "install",
value: function install() {
this.log("installing your dependencies...");
this.npmInstall();
}
}, {
key: "end",
value: function end() {
this.log((0, _yosay2.default)("you're all set :) enjoy !"));
}
}]);
return ApplicasterStarter;
}(_yeomanGenerator.Base);
module.exports = ApplicasterStarter;