From 550e8b7a084258889d09692314e92d34e672d25f Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Thu, 11 Dec 2025 21:45:43 +1100 Subject: [PATCH 1/2] chore: add package.json node engine to pre commit version check --- .husky/pre-commit | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index a91fe08c1..aebc54620 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -3,17 +3,17 @@ if [ -f .tool-versions ] && [ -f .nvmrc ]; then # Extract node version from .tool-versions TOOL_VERSION=$(grep "^node" .tool-versions | cut -d' ' -f2) - # Extract version from .nvmrc - NVMRC_VERSION=$(tr -d '\n\r' < .nvmrc) + NVMRC_VERSION=$(tr -d '\n\r' <.nvmrc) + # Extract version from package.json > engines.node + PACKAGE_VERSION=$(grep -A 1 '"engines"' package.json | grep '"node"' | cut -d'"' -f4) - # Compare versions (trim whitespace) - if [ "$TOOL_VERSION" != "$NVMRC_VERSION" ]; then + if [ "$TOOL_VERSION" != "$NVMRC_VERSION" ] || [ "$TOOL_VERSION" != "$PACKAGE_VERSION" ]; then echo "❌ Node version mismatch!" echo " .tool-versions: $TOOL_VERSION" echo " .nvmrc: $NVMRC_VERSION" + echo " package.json: $PACKAGE_VERSION" echo " Please ensure both files have the same version." exit 1 fi fi - From 3d8c62d6ebd8654118212a2e4bd3135a6a7f23f7 Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Fri, 12 Dec 2025 08:25:10 +1100 Subject: [PATCH 2/2] chore: update pre-commit node version check message --- .husky/pre-commit | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index aebc54620..8146924e3 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,6 @@ #!/bin/sh +# Validates all sources of the project's node version are the same if [ -f .tool-versions ] && [ -f .nvmrc ]; then # Extract node version from .tool-versions TOOL_VERSION=$(grep "^node" .tool-versions | cut -d' ' -f2) @@ -13,7 +14,7 @@ if [ -f .tool-versions ] && [ -f .nvmrc ]; then echo " .tool-versions: $TOOL_VERSION" echo " .nvmrc: $NVMRC_VERSION" echo " package.json: $PACKAGE_VERSION" - echo " Please ensure both files have the same version." + echo " Please ensure all files have the same node version." exit 1 fi fi