mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Pi Mobile (apps/mobile in pi-private) is replaced by p2 (apps/p2). The Android APK workflow and its pre-commit check go; the hook runs p2's own check when apps/p2 exists (only in pi-private).
63 lines
1.5 KiB
Bash
Executable file
63 lines
1.5 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Get list of staged files before running check
|
|
STAGED_FILES=$(git diff --cached --name-only)
|
|
|
|
node scripts/check-lockfile-commit.mjs
|
|
if [ $? -ne 0 ]; then
|
|
exit 1
|
|
fi
|
|
|
|
# Run the check script (formatting, linting, and type checking)
|
|
echo "Running formatting, linting, and type checking..."
|
|
npm run check
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Checks failed. Please fix the errors before committing."
|
|
exit 1
|
|
fi
|
|
|
|
# p2 has its own check (own biome.json, TypeScript 5.9; apps/ is outside the root Biome and tsc configs).
|
|
# apps/ exists only in pi-private.
|
|
if [ -d apps/p2 ]; then
|
|
for file in $STAGED_FILES; do
|
|
case "$file" in
|
|
apps/p2/*|packages/*|package.json|package-lock.json|tsconfig.json|tsconfig.base.json)
|
|
echo "Checking apps/p2..."
|
|
npm --prefix apps/p2 run check
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ apps/p2 checks failed."
|
|
exit 1
|
|
fi
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
fi
|
|
|
|
RUN_BROWSER_SMOKE=0
|
|
for file in $STAGED_FILES; do
|
|
case "$file" in
|
|
packages/ai/*|packages/web-ui/*|package.json|package-lock.json)
|
|
RUN_BROWSER_SMOKE=1
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ $RUN_BROWSER_SMOKE -eq 1 ]; then
|
|
echo "Running browser smoke check..."
|
|
npm run check:browser-smoke
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Browser smoke check failed."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Restage files that were previously staged and may have been modified by formatting
|
|
for file in $STAGED_FILES; do
|
|
if [ -f "$file" ]; then
|
|
git add "$file"
|
|
fi
|
|
done
|
|
|
|
echo "✅ All pre-commit checks passed!"
|