#!/usr/bin/env sh # Fail if apps/web/src/types/api.gen.ts is stale vs docs/openapi.yaml. set -eu ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)" cd "$ROOT/apps/web" tmp="$(mktemp)" trap 'rm -f "$tmp"' EXIT pnpm exec openapi-typescript ../../docs/openapi.yaml -o "$tmp" if ! diff -q src/types/api.gen.ts "$tmp" >/dev/null; then echo "api.gen.ts is stale — run: pnpm --filter @evobgp/web run openapi:gen" >&2 diff -u src/types/api.gen.ts "$tmp" | head -n 80 >&2 || true exit 1 fi echo "api.gen.ts is up to date"