var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _fileutils=require("./systemTools/fileutils");
var _exec=require("./systemTools/exec");
var _prompt=require("./systemTools/prompt");var

Config=function(){
function Config(){(0,_classCallCheck2.default)(this,Config);
this.config={};
}(0,_createClass2.default)(Config,[{key:"initializeConfig",value:function initializeConfig(





c){
this.config=c;
return c;
}},{key:"getConfig",value:function getConfig()

{
return this.config;
}},{key:"injectProjectDependency",value:function injectProjectDependency(


















dependency,version){var currentPackage,existingPath;return _regenerator.default.async(function injectProjectDependency$(_context){while(1){switch(_context.prev=_context.next){case 0:
currentPackage=this.config.files.project.package;
existingPath=this.config.paths.project.package;
currentPackage.dependencies[dependency]=version;
(0,_fileutils.writeObjectSync)(existingPath,currentPackage);_context.next=6;return _regenerator.default.awrap(
(0,_exec.npmInstall)());case 6:case"end":return _context.stop();}}},null,this);}},{key:"getProjectConfig",value:function getProjectConfig()


{
return this.config.files.project;
}},{key:"checkRequiredPackage",value:function checkRequiredPackage(

pkg){var projectConfig,_ref,confirm;return _regenerator.default.async(function checkRequiredPackage$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(
pkg){_context2.next=2;break;}return _context2.abrupt("return");case 2:
projectConfig=this.getProjectConfig();if(

projectConfig.package.dependencies[pkg]){_context2.next=11;break;}_context2.next=6;return _regenerator.default.awrap(
(0,_prompt.inquirerPrompt)({
type:'confirm',
message:"You do not have "+pkg+" installed. Do you want to add it now?"}));case 6:_ref=_context2.sent;confirm=_ref.confirm;if(!


confirm){_context2.next=11;break;}_context2.next=11;return _regenerator.default.awrap(
this.injectProjectDependency(pkg,'latest'));case 11:case"end":return _context2.stop();}}},null,this);}},{key:"command",get:function get(){return this.config.command;}},{key:"subCommand",get:function get(){return this.config.subCommand;}},{key:"rnvArguments",get:function get(){var _this$config$program=this.config.program,args=_this$config$program.args,rawArgs=_this$config$program.rawArgs;var cleanedArgs=args.filter(function(arg){return typeof arg==='string';});var missingArg=rawArgs[rawArgs.indexOf(cleanedArgs[1])+1];cleanedArgs.splice(2,0,missingArg);return cleanedArgs;}}]);return Config;}();var _default=















































new Config();exports.default=_default;