From d6409b7826f5076151a188b96ca4266f64b3e390 Mon Sep 17 00:00:00 2001 From: pedr Date: Thu, 24 Apr 2025 05:02:35 -0300 Subject: [PATCH] Chore: Fixes #11972: Update Husky (#12046) --- .husky/pre-commit | 1 + .../patches/husky-npm-3.1.0-5cc13e4e34.patch | 33 -------- package.json | 10 +-- yarn.lock | 76 ++----------------- 4 files changed, 11 insertions(+), 109 deletions(-) create mode 100644 .husky/pre-commit delete mode 100644 .yarn/patches/husky-npm-3.1.0-5cc13e4e34.patch diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000000..4c0a95f7d8 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +corepack yarn lint-staged \ No newline at end of file diff --git a/.yarn/patches/husky-npm-3.1.0-5cc13e4e34.patch b/.yarn/patches/husky-npm-3.1.0-5cc13e4e34.patch deleted file mode 100644 index 8c5a1e0d65..0000000000 --- a/.yarn/patches/husky-npm-3.1.0-5cc13e4e34.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/lib/runner/index.js b/lib/runner/index.js -index 87e3b3957619728e3ed1ca61e2d83df1c49f928f..6d5ab905415da0577341c8f5b67d4806adcf7549 100644 ---- a/lib/runner/index.js -+++ b/lib/runner/index.js -@@ -68,15 +68,19 @@ function run([, scriptPath, hookName = '', HUSKY_GIT_PARAMS], getStdinFn = get_s - return 0; - } - catch (err) { -- const noVerifyMessage = [ -- 'commit-msg', -- 'pre-commit', -- 'pre-rebase', -- 'pre-push' -- ].includes(hookName) -- ? '(add --no-verify to bypass)' -- : '(cannot be bypassed with --no-verify due to Git specs)'; -- console.log(`husky > ${hookName} hook failed ${noVerifyMessage}`); -+ // We do not want to print this "add --no-verify to bypass" message because that's -+ // literally what some developers do instead of trying to fix the errors. -+ -+ // const noVerifyMessage = [ -+ // 'commit-msg', -+ // 'pre-commit', -+ // 'pre-rebase', -+ // 'pre-push' -+ // ].includes(hookName) -+ // ? '(add --no-verify to bypass)' -+ // : '(cannot be bypassed with --no-verify due to Git specs)'; -+ -+ console.log(`husky > ${hookName} hook failed (Please fix the errors listed above and try again)`); - return err.code; - } - }); diff --git a/package.json b/package.json index d59774c516..90fe9cf6b5 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "linter-precommit": "eslint --resolve-plugins-relative-to . --fix --ext .js --ext .jsx --ext .ts --ext .tsx", "linter": "eslint --resolve-plugins-relative-to . --fix --quiet --ext .js --ext .jsx --ext .ts --ext .tsx", "packageJsonLint": "node ./packages/tools/packageJsonLint.js", - "postinstall": "gulp build", + "postinstall": "husky && gulp build", "postPreReleasesToForum": "node ./packages/tools/postPreReleasesToForum", "publishAll": "git pull && yarn buildParallel && lerna version --yes --no-private --no-git-tag-version && gulp completePublishAll", "releaseAndroid": "PATH=\"/usr/local/opt/openjdk@17/bin:$PATH\" node packages/tools/release-android.js", @@ -64,11 +64,6 @@ "watch": "yarn workspaces foreach --parallel --verbose --interlaced --jobs 999 run watch", "watchWebsite": "nodemon --delay 1 --watch Assets/WebsiteAssets --watch packages/tools/website --watch packages/tools/website/utils --watch packages/doc-builder/build --ext md,ts,js,mustache,css,tsx,gif,png,svg --exec \"node packages/tools/website/build.js && http-server --port 8077 ../joplin-website/docs -a localhost\"" }, - "husky": { - "hooks": { - "pre-commit": "corepack yarn lint-staged" - } - }, "devDependencies": { "@crowdin/cli": "3", "@joplin/utils": "~2.12", @@ -86,7 +81,7 @@ "fs-extra": "11.2.0", "glob": "10.4.5", "gulp": "4.0.2", - "husky": "3.1.0", + "husky": "9.1.7", "lerna": "3.22.1", "lint-staged": "15.2.8", "madge": "7.0.0", @@ -108,7 +103,6 @@ "app-builder-lib@24.4.0": "patch:app-builder-lib@npm%3A24.4.0#./.yarn/patches/app-builder-lib-npm-24.4.0-05322ff057.patch", "nanoid": "patch:nanoid@npm%3A3.3.7#./.yarn/patches/nanoid-npm-3.3.7-98824ba130.patch", "pdfjs-dist": "patch:pdfjs-dist@npm%3A3.11.174#./.yarn/patches/pdfjs-dist-npm-3.11.174-67f2fee6d6.patch", - "husky": "patch:husky@npm%3A3.1.0#./.yarn/patches/husky-npm-3.1.0-5cc13e4e34.patch", "chokidar@^2.0.0": "3.5.3", "react-native@0.74.1": "patch:react-native@npm%3A0.74.1#./.yarn/patches/react-native-npm-0.74.1-754c02ae9e.patch", "rn-fetch-blob@0.12.0": "patch:rn-fetch-blob@npm%3A0.12.0#./.yarn/patches/rn-fetch-blob-npm-0.12.0-cf02e3c544.patch", diff --git a/yarn.lock b/yarn.lock index c1026b701b..56501a845c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20197,7 +20197,7 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^5.0.5, cosmiconfig@npm:^5.1.0, cosmiconfig@npm:^5.2.1": +"cosmiconfig@npm:^5.0.5, cosmiconfig@npm:^5.1.0": version: 5.2.1 resolution: "cosmiconfig@npm:5.2.1" dependencies: @@ -26414,13 +26414,6 @@ __metadata: languageName: node linkType: hard -"get-stdin@npm:^7.0.0": - version: 7.0.0 - resolution: "get-stdin@npm:7.0.0" - checksum: a24ab2cf8ee35bf5d3460c0d8145f2624715d864485789b7101a7cf1b6c1ce0a57319e25304872074121fa60e7104f1af3583a7014e9974c84c61d0702beae24 - languageName: node - linkType: hard - "get-stdin@npm:^8.0.0": version: 8.0.0 resolution: "get-stdin@npm:8.0.0" @@ -28325,47 +28318,12 @@ __metadata: languageName: node linkType: hard -"husky@npm:3.1.0": - version: 3.1.0 - resolution: "husky@npm:3.1.0" - dependencies: - chalk: ^2.4.2 - ci-info: ^2.0.0 - cosmiconfig: ^5.2.1 - execa: ^1.0.0 - get-stdin: ^7.0.0 - opencollective-postinstall: ^2.0.2 - pkg-dir: ^4.2.0 - please-upgrade-node: ^3.2.0 - read-pkg: ^5.2.0 - run-node: ^1.0.0 - slash: ^3.0.0 +"husky@npm:9.1.7": + version: 9.1.7 + resolution: "husky@npm:9.1.7" bin: - husky-run: ./run.js - husky-upgrade: ./lib/upgrader/bin.js - checksum: 15a8eeb5ca8286f4e1f64cbc55ffb2295c407ba9da84a88128471a886e6fb6cf7a2b5ea0db5f0715e185d7251fc09700baf3bc95f63cb80accc5d253d69c141f - languageName: node - linkType: hard - -"husky@patch:husky@npm%3A3.1.0#./.yarn/patches/husky-npm-3.1.0-5cc13e4e34.patch::locator=root%40workspace%3A.": - version: 3.1.0 - resolution: "husky@patch:husky@npm%3A3.1.0#./.yarn/patches/husky-npm-3.1.0-5cc13e4e34.patch::version=3.1.0&hash=d9603f&locator=root%40workspace%3A." - dependencies: - chalk: ^2.4.2 - ci-info: ^2.0.0 - cosmiconfig: ^5.2.1 - execa: ^1.0.0 - get-stdin: ^7.0.0 - opencollective-postinstall: ^2.0.2 - pkg-dir: ^4.2.0 - please-upgrade-node: ^3.2.0 - read-pkg: ^5.2.0 - run-node: ^1.0.0 - slash: ^3.0.0 - bin: - husky-run: ./run.js - husky-upgrade: ./lib/upgrader/bin.js - checksum: b29b08a1e9be6037d0eb3dd875c22ffba1f375532a89e4320d31cb5ea37ffca4b487ef903a8b867ccfb2ece6a1ca87c65bc202d932f92cfb7d6f017c76bb1294 + husky: bin.js + checksum: c2412753f15695db369634ba70f50f5c0b7e5cb13b673d0826c411ec1bd9ddef08c1dad89ea154f57da2521d2605bd64308af748749b27d08c5f563bcd89975f languageName: node linkType: hard @@ -36617,7 +36575,7 @@ __metadata: languageName: node linkType: hard -"opencollective-postinstall@npm:^2.0.2, opencollective-postinstall@npm:^2.0.3": +"opencollective-postinstall@npm:^2.0.3": version: 2.0.3 resolution: "opencollective-postinstall@npm:2.0.3" bin: @@ -37997,15 +37955,6 @@ __metadata: languageName: node linkType: hard -"please-upgrade-node@npm:^3.2.0": - version: 3.2.0 - resolution: "please-upgrade-node@npm:3.2.0" - dependencies: - semver-compare: ^1.0.0 - checksum: d87c41581a2a022fbe25965a97006238cd9b8cbbf49b39f78d262548149a9d30bd2bdf35fec3d810e0001e630cd46ef13c7e19c389dea8de7e64db271a2381bb - languageName: node - linkType: hard - "plist@npm:^3.0.4, plist@npm:^3.0.5": version: 3.1.0 resolution: "plist@npm:3.1.0" @@ -42045,7 +41994,7 @@ __metadata: glob: 10.4.5 gulp: 4.0.2 http-server: 14.1.1 - husky: 3.1.0 + husky: 9.1.7 lerna: 3.22.1 lint-staged: 15.2.8 madge: 7.0.0 @@ -42136,15 +42085,6 @@ __metadata: languageName: node linkType: hard -"run-node@npm:^1.0.0": - version: 1.0.0 - resolution: "run-node@npm:1.0.0" - bin: - run-node: run-node - checksum: 99a0846de16d64c81e7cce487b8d7a77907d7ff69e229ad154cc7ee33ded6f82f71309f47de33cc4c206de6c7b7c37f641d7b6488bb85cc0bfe4da6d8b029242 - languageName: node - linkType: hard - "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0"