From 3784733987eb2183f6c04c4e4c483aa8d000ee1b Mon Sep 17 00:00:00 2001 From: Jamie Nelson Date: Tue, 13 Oct 2026 21:43:46 +1100 Subject: [PATCH] fix(pre-commit): run bundled CLI directly --- scripts/pre-commit-hook.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/pre-commit-hook.sh b/scripts/pre-commit-hook.sh index e4277a01..fc655f59 100755 --- a/scripts/pre-commit-hook.sh +++ b/scripts/pre-commit-hook.sh @@ -1,13 +1,17 @@ #!/bin/sh set -eu -if ! command -v node >/dev/null 2>&1 || ! command -v npx >/dev/null 2>&1; then - echo "github-action-readme-generator pre-commit hook requires Node.js and npm/npx." >&2 +if ! command -v node >/dev/null 2>&1; then + echo "github-action-readme-generator pre-commit hook requires Node.js." >&2 exit 1 fi script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) -package_json="$script_dir/../package.json" -version=$(node -e 'const fs = require("node:fs"); const p = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); process.stdout.write(p.version);' "$package_json") +cli="$script_dir/../dist/bin/index.js" -exec npx --yes "github-action-readme-generator@$version" "$@" +if [ ! -f "$cli" ]; then + echo "github-action-readme-generator bundled CLI is missing; use a published release tag." >&2 + exit 1 +fi + +exec node "$cli" "$@"