From 11a0ea46f99d9478f98ff913c6db69ffe065cf0b Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Tue, 14 Mar 2023 17:57:59 +0100 Subject: [PATCH] ci: update to husky 8.0.3 and reactivate hook --- .husky/pre-commit | 12 ++++++++++++ package-lock.json | 16 ++++++++-------- package.json | 10 +++------- 3 files changed, 23 insertions(+), 15 deletions(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..155c6be0b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,12 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +echo action source code is being reformatted and recompiled +npm run format +npm run build +if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then + echo + echo changes to action source code were detected + echo action source code changes are added to this commit + git add index.js src/ping.js dist +fi diff --git a/package-lock.json b/package-lock.json index d1a90de36..94920f538 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "devDependencies": { "@types/node": "18.15.3", "@vercel/ncc": "0.36.1", - "husky": "7.0.4", + "husky": "8.0.3", "markdown-link-check": "3.10.3", "prettier": "2.8.4" } @@ -1041,15 +1041,15 @@ } }, "node_modules/husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true, "bin": { "husky": "lib/bin.js" }, "engines": { - "node": ">=12" + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/typicode" @@ -2415,9 +2415,9 @@ } }, "husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true }, "iconv-lite": { diff --git a/package.json b/package.json index 1ec654a49..a9bd700e5 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "build": "ncc build -o dist index.js", "format": "prettier --write index.js", "check:markdown": "find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check -c md-linkcheck.json", - "update:cypress": "./scripts/update-cypress-latest.sh" + "update:cypress": "./scripts/update-cypress-latest.sh", + "prepare": "husky install" }, "repository": { "type": "git", @@ -46,16 +47,11 @@ "devDependencies": { "@types/node": "18.15.3", "@vercel/ncc": "0.36.1", - "husky": "7.0.4", + "husky": "8.0.3", "markdown-link-check": "3.10.3", "prettier": "2.8.4" }, "publishConfig": { "access": "public" - }, - "husky": { - "hooks": { - "pre-commit": "npm run format && npm run build && git add index.js dist" - } } }