brewInstall.js 971 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.brewInstall = brewInstall;
  6. function _execa() {
  7. const data = _interopRequireDefault(require("execa"));
  8. _execa = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. var _common = require("../commands/doctor/healthchecks/common");
  14. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. async function brewInstall({
  16. pkg,
  17. label,
  18. loader,
  19. onSuccess,
  20. onFail
  21. }) {
  22. loader.start(label);
  23. try {
  24. await (0, _execa().default)('brew', ['install', pkg]);
  25. if (typeof onSuccess === 'function') {
  26. return onSuccess();
  27. }
  28. return loader.succeed();
  29. } catch (error) {
  30. if (typeof onFail === 'function') {
  31. return onFail();
  32. }
  33. (0, _common.logError)({
  34. healthcheck: label || pkg,
  35. loader,
  36. error,
  37. command: `brew install ${pkg}`
  38. });
  39. }
  40. }
  41. //# sourceMappingURL=brewInstall.js.map