pre-commit-npm-1.2.2-f30af83877.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. diff --git a/index.js b/index.js
  2. index a20646d922945004cb737918ef6b6d063bb3c2a4..a44863e9555abdaa569f309b1197fddc8dd244a5 100644
  3. --- a/index.js
  4. +++ b/index.js
  5. @@ -147,7 +147,7 @@ Hook.prototype.log = function log(lines, exit) {
  6. * @api private
  7. */
  8. Hook.prototype.initialize = function initialize() {
  9. - ['git', 'npm'].forEach(function each(binary) {
  10. + ['git', 'corepack'].forEach(function each(binary) {
  11. try { this[binary] = which.sync(binary); }
  12. catch (e) {}
  13. }, this);
  14. @@ -159,9 +159,9 @@ Hook.prototype.initialize = function initialize() {
  15. if (!this.npm) {
  16. try {
  17. process.env.PATH += path.delimiter + path.dirname(process.env._);
  18. - this.npm = which.sync('npm');
  19. + this.npm = which.sync('corepack');
  20. } catch (e) {
  21. - return this.log(this.format(Hook.log.binary, 'npm'), 0);
  22. + return this.log(this.format(Hook.log.binary, 'corepack'), 0);
  23. }
  24. }
  25. @@ -225,7 +225,7 @@ Hook.prototype.run = function runner() {
  26. // this doesn't have the required `isAtty` information that libraries use to
  27. // output colors resulting in script output that doesn't have any color.
  28. //
  29. - spawn(hooked.npm, ['run', script, '--silent'], {
  30. + spawn(hooked.npm, ['yarn', script], {
  31. env: process.env,
  32. cwd: hooked.root,
  33. stdio: [0, 1, 2]