Skip to content

Commit

Permalink
meta: make pre-commit use corepack yarn instead of npm run (#4495)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 authored Jun 10, 2023
1 parent 3511a55 commit 3d59e78
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
34 changes: 34 additions & 0 deletions .yarn/patches/pre-commit-npm-1.2.2-f30af83877.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/index.js b/index.js
index a20646d922945004cb737918ef6b6d063bb3c2a4..a44863e9555abdaa569f309b1197fddc8dd244a5 100644
--- a/index.js
+++ b/index.js
@@ -147,7 +147,7 @@ Hook.prototype.log = function log(lines, exit) {
* @api private
*/
Hook.prototype.initialize = function initialize() {
- ['git', 'npm'].forEach(function each(binary) {
+ ['git', 'corepack'].forEach(function each(binary) {
try { this[binary] = which.sync(binary); }
catch (e) {}
}, this);
@@ -159,9 +159,9 @@ Hook.prototype.initialize = function initialize() {
if (!this.npm) {
try {
process.env.PATH += path.delimiter + path.dirname(process.env._);
- this.npm = which.sync('npm');
+ this.npm = which.sync('corepack');
} catch (e) {
- return this.log(this.format(Hook.log.binary, 'npm'), 0);
+ return this.log(this.format(Hook.log.binary, 'corepack'), 0);
}
}

@@ -225,7 +225,7 @@ Hook.prototype.run = function runner() {
// this doesn't have the required `isAtty` information that libraries use to
// output colors resulting in script output that doesn't have any color.
//
- spawn(hooked.npm, ['run', script, '--silent'], {
+ spawn(hooked.npm, ['yarn', script], {
env: process.env,
cwd: hooked.root,
stdio: [0, 1, 2]
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
"version": "0.0.0",
"description": "Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
"lint-staged": {
"*.js": "eslint --fix",
"*.jsx": "eslint --fix",
"*.{js,mjs,cjs,jsx}": "eslint --fix",
"*.{ts,mts,cts,tsx}": "eslint --fix",
"*.md": [
"remark --silently-ignore -i .remarkignore -foq",
"eslint --fix"
],
"*.ts": "eslint --fix"
]
},
"remarkConfig": {
"plugins": [
Expand Down Expand Up @@ -172,6 +171,7 @@
"@types/eslint@^7.2.13": "^8.2.0",
"@types/react": "^17",
"@types/webpack-dev-server": "^4",
"preact": "patch:preact@npm:10.10.0#.yarn/patches/preact-npm-10.10.0-dd04de05e8.patch"
"preact": "patch:preact@npm:10.10.0#.yarn/patches/preact-npm-10.10.0-dd04de05e8.patch",
"pre-commit": "patch:pre-commit@npm:1.2.2#.yarn/patches/pre-commit-npm-1.2.2-f30af83877.patch"
}
}
13 changes: 12 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28505,7 +28505,7 @@ __metadata:
languageName: node
linkType: hard

"pre-commit@npm:^1.2.2":
"pre-commit@npm:1.2.2":
version: 1.2.2
resolution: "pre-commit@npm:1.2.2"
dependencies:
Expand All @@ -28516,6 +28516,17 @@ __metadata:
languageName: node
linkType: hard

"pre-commit@patch:pre-commit@npm:1.2.2#.yarn/patches/pre-commit-npm-1.2.2-f30af83877.patch::locator=%40uppy-dev%2Fbuild%40workspace%3A.":
version: 1.2.2
resolution: "pre-commit@patch:pre-commit@npm%3A1.2.2#.yarn/patches/pre-commit-npm-1.2.2-f30af83877.patch::version=1.2.2&hash=b54a30&locator=%40uppy-dev%2Fbuild%40workspace%3A."
dependencies:
cross-spawn: ^5.0.1
spawn-sync: ^1.0.15
which: 1.2.x
checksum: b7a00f569f72ae4a330533423aa4b1599faba9a0af5e96dfbfb210e4383378a5bc142de1db8223325cc98315a24794008eb21a067881488da988edc47656d54f
languageName: node
linkType: hard

"preact-render-to-string@npm:^5.1.0":
version: 5.2.2
resolution: "preact-render-to-string@npm:5.2.2"
Expand Down

0 comments on commit 3d59e78

Please sign in to comment.