"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.commandExecutor = commandExecutor;

var _constants = require("../../shared/constants");

var _watchRun = require("../../shared/fileUtils/watchRun");

function commandExecutor(options) {
  const {
    extraArgs = []
  } = options;
  const index = extraArgs.indexOf('-w');
  const canWatch = index !== -1;

  if (canWatch) {
    extraArgs.splice(index, 1);
  }

  let [src, target] = extraArgs;
  src = (0, _constants.joinWithAppPath)(src || 'src');
  target = (0, _constants.joinWithAppPath)(target || 'es');
  (0, _watchRun.watchRun)({
    options,
    src,
    target,
    canWatch,
    mode: 'es'
  });
}