helpers.js 3.09 KB
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

require("source-map-support/register");

var _which = _interopRequireDefault(require("which"));

var _fs = _interopRequireDefault(require("fs"));

function formatEnoent(error, cmd, cwd = null) {
  try {
    _which.default.sync(cmd);

    if (cwd) {
      try {
        _fs.default.accessSync(cwd, _fs.default.R_OK);
      } catch (ign) {
        error.message = `The current working directory '${cwd}' for '${cmd}' command ` + `either does not exist or is not accessible`;
      }
    }
  } catch (ign) {
    error.message = `Command '${cmd}' not found. Is it installed?`;
  }

  return error;
}require('source-map-support').install();


//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9oZWxwZXJzLmpzIl0sIm5hbWVzIjpbImZvcm1hdEVub2VudCIsImVycm9yIiwiY21kIiwiY3dkIiwid2hpY2giLCJzeW5jIiwiZnMiLCJhY2Nlc3NTeW5jIiwiUl9PSyIsImlnbiIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQUE7O0FBQ0E7O0FBYUEsU0FBU0EsWUFBVCxDQUF1QkMsS0FBdkIsRUFBOEJDLEdBQTlCLEVBQW1DQyxHQUFHLEdBQUcsSUFBekMsRUFBK0M7QUFDN0MsTUFBSTtBQUNGQyxtQkFBTUMsSUFBTixDQUFXSCxHQUFYOztBQUNBLFFBQUlDLEdBQUosRUFBUztBQUNQLFVBQUk7QUFDRkcsb0JBQUdDLFVBQUgsQ0FBY0osR0FBZCxFQUFtQkcsWUFBR0UsSUFBdEI7QUFDRCxPQUZELENBRUUsT0FBT0MsR0FBUCxFQUFZO0FBQ1pSLFFBQUFBLEtBQUssQ0FBQ1MsT0FBTixHQUFpQixrQ0FBaUNQLEdBQUksVUFBU0QsR0FBSSxZQUFuRCxHQUNiLDRDQURIO0FBRUQ7QUFDRjtBQUNGLEdBV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