var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvPluginUpdate=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _inquirer=_interopRequireDefault(require("inquirer"));
var _fileutils=require("../core/systemManager/fileutils");


var _logger=require("../core/systemManager/logger");



var _pluginManager=require("../core/pluginManager");
var _engineManager=require("../core/engineManager");
var _constants=require("../core/constants");


var taskRnvPluginUpdate=function taskRnvPluginUpdate(c,parentTask,originTask){var o,_await$inquirer$promp,confirm,plugins;return _regenerator.default.async(function taskRnvPluginUpdate$(_context){while(1){switch(_context.prev=_context.next){case 0:
(0,_logger.logTask)('taskRnvPluginUpdate');_context.next=3;return _regenerator.default.awrap(

(0,_engineManager.executeTask)(c,_constants.TASK_PROJECT_CONFIGURE,_constants.TASK_PLUGIN_UPDATE,originTask));case 3:

o=(0,_pluginManager.getPluginList)(c,true);_context.next=6;return _regenerator.default.awrap(



_inquirer.default.prompt({
name:'confirm',
type:'confirm',
message:'Above installed plugins will be updated with RNV'}));case 6:_await$inquirer$promp=_context.sent;confirm=_await$inquirer$promp.confirm;


if(confirm){
plugins=c.buildConfig.plugins;
Object.keys(plugins).forEach(function(key){

c.files.project.config.plugins[key]=o.json[key];
});

(0,_fileutils.writeFileSync)(c.paths.project.config,c.files.project.config);

(0,_logger.logSuccess)('Plugins updated successfully!');
}case 9:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvPluginUpdate=taskRnvPluginUpdate;var _default=


{
description:'Update specific plugin to latest supported version (rnv)',
fn:taskRnvPluginUpdate,
task:'plugin update',
params:_constants.PARAMS.withBase(),
platforms:[]};exports.default=_default;
//# sourceMappingURL=task.rnv.plugin.update.js.map