text: "use strict";
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = void 0;
  
  function _child_process() {
    const data = require("child_process");
  
    _child_process = function () {
      return data;
    };
  
    return data;
  }
  
  var _yarn = _interopRequireDefault(require("./yarn"));
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  class PackageManager {
    constructor(options) {
      this.options = options;
    }
  
    executeCommand(command, options) {
      return (0, _child_process().execSync)(command, {
        stdio: options && options.silent ? 'pipe' : 'inherit'
      });
    }
  
    shouldCallYarn() {
      return !this.options.forceNpm && _yarn.default.getYarnVersionIfAvailable() && _yarn.default.isGlobalCliUsingYarn(this.options.projectDir);
    }
  
    install(packageNames, options) {
      return this.shouldCallYarn() ? this.executeCommand(`yarn add ${packageNames.join(' ')}`, options) : this.executeCommand(`npm install ${packageNames.join(' ')} --save --save-exact`, options);
    }
  
    installDev(packageNames) {
      return this.shouldCallYarn() ? this.executeCommand(`yarn add -D ${packageNames.join(' ')}`) : this.executeCommand(`npm install ${packageNames.join(' ')} --save-dev --save-exact`);
    }
  
    uninstall(packageNames) {
      return this.shouldCallYarn() ? this.executeCommand(`yarn remove ${packageNames.join(' ')}`) : this.executeCommand(`npm uninstall ${packageNames.join(' ')} --save`);
    }
  
  }
  
  exports.default = PackageManager;