From 20900ee769aaf64e8af1ce6dc1a9940a855ed404 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 28 Oct 2025 11:52:42 +0000 Subject: [PATCH] Build: Run npm install when `package-lock.json` out of date --- scripts/check-node-modules.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/check-node-modules.sh b/scripts/check-node-modules.sh index 3fc2c7437..f476d244f 100755 --- a/scripts/check-node-modules.sh +++ b/scripts/check-node-modules.sh @@ -9,9 +9,15 @@ if [ "$GITHUB_ACTIONS" = "true" ]; then fi # Check if npm install is likely needed before proceeding -if [ ! -d node_modules ] || [ package-lock.json -nt node_modules/.package-lock.json ]; then - echo "Running 'npm install' because 'node_modules/.package-lock.json' appears to be outdated..." +if [ ! -d node_modules ]; then + echo "Running 'npm install' because 'node_modules' directory is missing." + npm install +elif [ package.json -nt package-lock.json ]; then + echo "Running 'npm install' because 'package-lock.json' appears to be outdated." + npm install +elif [ package-lock.json -nt node_modules/.package-lock.json ]; then + echo "Running 'npm install' because 'node_modules/.package-lock.json' appears to be outdated." npm install else - echo "Skipping 'npm install' because 'node_modules/.package-lock.json' appears to be up-to-date." + echo "Skipping 'npm install' because everything appears to be up-to-date." fi