projex
Version:
A command line to manage the workflow
24 lines (23 loc) • 929 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.vtexRunCommand = void 0;
const _shared_1 = require("../../../../shared/index");
const utils_1 = require("./utils");
let commandToUse = '';
const vtexRunCommand = async function (command) {
if (command === undefined) {
return _shared_1.log.error('no command to execute');
}
// Capturo el flag para saber si empleo la ultima versión siempre o no.
const SCAPECOMMAND = '--scape';
const scapeCommand = process.argv.indexOf(SCAPECOMMAND) >= 0;
commandToUse = command;
if (scapeCommand) {
commandToUse = command.replace(/\@S+/g, ' ');
commandToUse = commandToUse.replace(/\@AND+/g, '&&');
}
_shared_1.log.warn(`command to execute: ${commandToUse}`);
_shared_1.log.info('executing command...');
(0, utils_1.executeCommand)(commandToUse);
};
exports.vtexRunCommand = vtexRunCommand;