freshyo/typecheck
2026-09-06 18:05:20 +05:30

43 lines
967 B
Bash
Executable file

#!/usr/bin/env bash
# Typechecks every app/package that has a tsconfig.
# packages/shared and packages/ui have no tsconfig of their own — they are
# typechecked transitively via the consumers below.
set -u
cd "$(dirname "$0")"
targets=(
apps/backend
apps/user-ui
apps/admin-ui
apps/web-ui
apps/fallback-ui
packages/db_helper_sqlite
packages/db_helper_postgres
packages/migrator
packages/web-components
)
log="$(mktemp)"
failed=0
for target in "${targets[@]}"; do
if [ ! -f "$target/tsconfig.json" ]; then
printf '⏭ %-32s (no tsconfig)\n' "$target"
continue
fi
printf '▶ %-32s ' "$target"
if (cd "$target" && npx tsc --noEmit >"$log" 2>&1); then
echo '✅ clean'
else
errors=$(grep -c 'error TS' "$log" || true)
echo "${errors} error(s)"
head -20 "$log"
failed=1
fi
done
rm -f "$log"
if [ "$failed" -ne 0 ]; then
echo '❌ typecheck failed'
exit 1
fi
echo '✅ all packages typecheck clean'