mirror of
https://github.com/Sea-Haven-Industries/engineering-handbook.git
synced 2026-09-30 23:13:14 +00:00
Catches lock file drift locally before it breaks CI. Includes install instructions in git-workflow.md.
19 lines
573 B
Bash
Executable file
19 lines
573 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Pre-push hook: verify npm ci passes before pushing Node.js projects.
|
|
# Catches lock file drift that would break CI.
|
|
#
|
|
# Install: cp hooks/pre-push .git/hooks/pre-push && chmod +x .git/hooks/pre-push
|
|
|
|
set -euo pipefail
|
|
|
|
if [[ ! -f package-lock.json ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "pre-push: running npm ci..."
|
|
if ! npm ci --ignore-scripts --no-audit --no-fund 2>/dev/null; then
|
|
echo "pre-push: npm ci failed — lock file may be out of sync."
|
|
echo "Run: rm -rf node_modules package-lock.json && npm install"
|
|
exit 1
|
|
fi
|
|
echo "pre-push: npm ci passed."
|