2025-09-25 14:20:30 +01:00
|
|
|
#!/bin/bash
|
2025-09-25 20:22:47 +01:00
|
|
|
|
2025-09-25 14:20:30 +01:00
|
|
|
set -e
|
|
|
|
|
|
2025-09-25 20:22:47 +01:00
|
|
|
# Check if running in GitHub Actions
|
|
|
|
|
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
2025-09-25 20:24:58 +01:00
|
|
|
echo "Running in a GitHub Actions workflow; not running 'npm install'"
|
2025-09-25 20:22:47 +01:00
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
2025-09-25 14:20:30 +01:00
|
|
|
# Check if npm install is likely needed before proceeding
|
2025-10-28 11:52:42 +00:00
|
|
|
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."
|
2025-09-25 14:20:30 +01:00
|
|
|
npm install
|
2025-09-25 20:24:58 +01:00
|
|
|
else
|
2025-10-28 11:52:42 +00:00
|
|
|
echo "Skipping 'npm install' because everything appears to be up-to-date."
|
2025-09-25 14:20:30 +01:00
|
|
|
fi
|