From e4f85f5f7cb6c9def1a036477f01e136e46d2099 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 31 Jan 2024 20:32:00 +0100 Subject: [PATCH] Husky v9 (#171886) * Update Husky to v9 * Update lint-staged * Backward compatibility with Husky 8 --- .husky/install.mjs | 11 +++++++++++ .husky/post-merge | 2 ++ .husky/pre-commit | 2 ++ package.json | 6 +++--- yarn.lock | 26 +++++++++++++------------- 5 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 .husky/install.mjs diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 00000000000..d69fbd32d92 --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,11 @@ +// See: https://typicode.github.io/husky/how-to.html#ci-server-and-docker + +// Do not initialize Husky in CI environments. GitHub Actions set the CI env variable automatically. +// See: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables +if (process.env.CI === 'true') { + process.exit(0); +} + +// Initialize Husky programmatically. +const husky = (await import('husky')).default; +console.log(husky()); diff --git a/.husky/post-merge b/.husky/post-merge index 59d9c1feb96..f837e9af8cb 100755 --- a/.husky/post-merge +++ b/.husky/post-merge @@ -1,6 +1,8 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" +# TODO: Remove first 2 lines: https://github.com/AdguardTeam/AdguardFilters/pull/171886#issuecomment-1918731193 + # See https://git-scm.com/docs/githooks#_post_merge # This function checks if a file has changed between the current HEAD and the previous HEAD diff --git a/.husky/pre-commit b/.husky/pre-commit index 1122879bdac..26e5ee64f0e 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,8 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" +# TODO: Remove first 2 lines: https://github.com/AdguardTeam/AdguardFilters/pull/171886#issuecomment-1918731193 + # See https://git-scm.com/docs/githooks#_pre_commit npx lint-staged diff --git a/package.json b/package.json index c3fcfc567cc..7cd2cea44d1 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,14 @@ "homepage": "https://github.com/AdguardTeam/AdguardFilters#readme", "scripts": { "lint": "aglint", - "prepare": "husky install" + "prepare": "node .husky/install.mjs" }, "lint-staged": { "*.txt": "aglint" }, "devDependencies": { "@adguard/aglint": "^2.0.8", - "husky": "^8.0.3", - "lint-staged": "^15.2.0" + "husky": "^9.0.7", + "lint-staged": "^15.2.1" } } diff --git a/yarn.lock b/yarn.lock index f71be58ef54..12f71134e96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -386,10 +386,10 @@ human-signals@^5.0.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ== -husky@^8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" - integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== +husky@^9.0.7: + version "9.0.7" + resolved "https://registry.yarnpkg.com/husky/-/husky-9.0.7.tgz#047f24ec1b6c681206af714b4217c13ee97fff20" + integrity sha512-vWdusw+y12DUEeoZqW1kplOFqk3tedGV8qlga8/SF6a3lOiWLqGZZQvfWvY0fQYdfiRi/u1DFNpudTSV9l1aCg== ignore@^5.2.4: version "5.2.4" @@ -484,26 +484,26 @@ lilconfig@3.0.0: resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.0.0.tgz#f8067feb033b5b74dab4602a5f5029420be749bc" integrity sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g== -lint-staged@^15.2.0: - version "15.2.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.0.tgz#3111534ca58096a3c8f70b044b6e7fe21b36f859" - integrity sha512-TFZzUEV00f+2YLaVPWBWGAMq7So6yQx+GG8YRMDeOEIf95Zn5RyiLMsEiX4KTNl9vq/w+NqRJkLA1kPIo15ufQ== +lint-staged@^15.2.1: + version "15.2.1" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.1.tgz#25beb6e587f54245b20163f5efede073f12c4d1b" + integrity sha512-dhwAPnM85VdshybV9FWI/9ghTvMLoQLEXgVMx+ua2DN7mdfzd/tRfoU2yhMcBac0RHkofoxdnnJUokr8s4zKmQ== dependencies: chalk "5.3.0" commander "11.1.0" debug "4.3.4" execa "8.0.1" lilconfig "3.0.0" - listr2 "8.0.0" + listr2 "8.0.1" micromatch "4.0.5" pidtree "0.6.0" string-argv "0.3.2" yaml "2.3.4" -listr2@8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-8.0.0.tgz#aa7c230995f8ce378585f7c96c0c6d1cefa4700d" - integrity sha512-u8cusxAcyqAiQ2RhYvV7kRKNLgUvtObIbhOX2NCXqvp1UU32xIg5CT22ykS2TPKJXZWJwtK3IKLiqAGlGNE+Zg== +listr2@8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-8.0.1.tgz#4d3f50ae6cec3c62bdf0e94f5c2c9edebd4b9c34" + integrity sha512-ovJXBXkKGfq+CwmKTjluEqFi3p4h8xvkxGQQAQan22YCgef4KZ1mKGjzfGh6PL6AW5Csw0QiQPNuQyH+6Xk3hA== dependencies: cli-truncate "^4.0.0" colorette "^2.0.20"