mirror of
https://github.com/azukaar/Cosmos-Server.git
synced 2026-10-12 02:11:26 +00:00
35 lines
868 B
Bash
35 lines
868 B
Bash
#!/bin/bash
|
|
# Regenerate API spec + Go SDK if any Go source files are staged
|
|
|
|
echo "regenerating OpenAPI spec and Go SDK..."
|
|
bash scripts/generate-api.sh
|
|
git add api-docs/ go-sdk/client.gen.go go-sdk/version.go
|
|
|
|
# --- Pro leak check ---
|
|
errors=0
|
|
|
|
for dir in "client/src/pro"; do
|
|
count=$(find "$dir" -type f | wc -l)
|
|
if [ "$count" -ne 1 ]; then
|
|
echo "ERROR: $dir/ must contain exactly 1 file, found $count"
|
|
errors=1
|
|
fi
|
|
done
|
|
|
|
if ! grep -Pzo 'func IsPro\(\) bool \{\s*\n\s*return false\s*\n\}' src/pro/index.go > /dev/null; then
|
|
echo "ERROR: src/pro/index.go — IsPro() must return false"
|
|
errors=1
|
|
fi
|
|
|
|
if ! grep -Pq 'isPro\s*:\s*false' client/src/pro/index.js; then
|
|
echo "ERROR: client/src/pro/index.js — isPro must be false"
|
|
errors=1
|
|
fi
|
|
|
|
if [ "$errors" -ne 0 ]; then
|
|
echo "Pro leak check FAILED."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Pre-commit checks passed."
|