var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvHooksRun=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _inquirer=_interopRequireDefault(require("inquirer"));
var _logger=require("../../core/systemManager/logger");
var _buildHooks=require("../../core/projectManager/buildHooks");
var _taskManager=require("../../core/taskManager");
var _fileutils=require("../../core/systemManager/fileutils");
var _constants=require("../../core/constants");


var taskRnvHooksRun=function taskRnvHooksRun(c,parentTask,originTask){var _c$program;var hookName,showHookList,hooksList,_await$inquirer$promp,selectedHook;return _regenerator.default.async(function taskRnvHooksRun$(_context){while(1){switch(_context.prev=_context.next){case 0:
(0,_logger.logTask)('taskRnvHooksRun');if(!

(0,_fileutils.fsExistsSync)(c.paths.project.config)){_context.next=6;break;}_context.next=4;return _regenerator.default.awrap(
(0,_taskManager.executeTask)(c,_constants.TASK_PROJECT_CONFIGURE,_constants.TASK_HOOKS_RUN,originTask));case 4:_context.next=7;break;case 6:

(0,_logger.logInfo)('Your are running your buildHook outside of renative project');case 7:_context.next=9;return _regenerator.default.awrap(



(0,_buildHooks.buildHooks)(c));case 9:if(

c.buildHooks){_context.next=11;break;}return _context.abrupt("return",
Promise.reject('Build hooks have not been compiled properly!'));case 11:


hookName=(_c$program=c.program)==null?void 0:_c$program.exeMethod;
showHookList=false;
if(!hookName||hookName===true){
showHookList=true;
}else if(!c.buildHooks[hookName]){
showHookList=true;
}if(!

showHookList){_context.next=21;break;}
hooksList=Object.keys(c.buildHooks);_context.next=18;return _regenerator.default.awrap(

_inquirer.default.prompt({
name:'selectedHook',
type:'list',
message:'Pick an available hook:',
choices:hooksList}));case 18:_await$inquirer$promp=_context.sent;selectedHook=_await$inquirer$promp.selectedHook;

hookName=selectedHook;case 21:_context.next=23;return _regenerator.default.awrap(

c.buildHooks[hookName](c));case 23:return _context.abrupt("return",


true);case 24:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvHooksRun=taskRnvHooksRun;var _default=


{
description:'Run specific build hook',
fn:taskRnvHooksRun,
task:_constants.TASK_HOOKS_RUN,
params:_constants.PARAMS.withBase([_constants.PARAM_KEYS.exeMethod]),
platforms:[],
skipAppConfig:true,
skipPlatforms:true,
forceBuildHookRebuild:true,
isGlobalScope:true};exports.default=_default;
//# sourceMappingURL=task.rnv.hooks.run.js.map