- scripts/preflight.sh: app+server tsc, eslint, i18n, vitest; installed as .githooks/pre-push (scripts/install-hooks.sh) and run by auto-deploy before Netlify. Failures record preflight-failed and ops-health flags them. - update-deps.sh: if the blanket npm update fails, restore the lock and retry patch-level packages one at a time, keeping those that pass a fast gate; the final npm test + smoke still gates the result, otherwise revert + 3-day retry. - release.sh/deps set SKIP_PREFLIGHT=1 (they run the full npm test themselves).
32 lines
1 KiB
Bash
Executable file
32 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Fast gate for manual pushes and the auto-deploy timer:
|
|
# typecheck (app + servers) → lint → i18n → unit tests. Does NOT build; the
|
|
# deploy script builds and boots the bundle afterwards.
|
|
#
|
|
# Run manually: scripts/preflight.sh
|
|
# Bypass once: SKIP_PREFLIGHT=1 git push (or git push --no-verify)
|
|
set -euo pipefail
|
|
|
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$REPO"
|
|
if [ -d "$HOME/.nvm/versions/node" ]; then
|
|
NODE_BIN="$(ls -d "$HOME"/.nvm/versions/node/*/bin 2>/dev/null | sort -V | tail -1)"
|
|
[ -n "$NODE_BIN" ] && export PATH="$NODE_BIN:$PATH"
|
|
fi
|
|
export PATH="$HOME/go/bin:$PATH"
|
|
|
|
[ -d node_modules ] || { echo "preflight: node_modules missing — run npm ci" >&2; exit 1; }
|
|
|
|
echo "preflight: typecheck"
|
|
npx tsc --noEmit
|
|
npx tsc -p cvm-server/tsconfig.json
|
|
npx tsc -p ai-proxy/tsconfig.json
|
|
npx tsc -p push-service/tsconfig.json
|
|
echo "preflight: lint"
|
|
npx eslint
|
|
echo "preflight: i18n"
|
|
node scripts/check-i18n.mjs
|
|
echo "preflight: unit tests"
|
|
npx vitest run --reporter=dot --silent
|
|
echo "preflight: OK"
|