veza/tmt/tests/frontend/bundle_size.sh
senke ad60247f33 feat: global update including storybook setup and backend fixes
- Web: Setup Storybook, added addons, configured Tailwind, added stories for UI components.
- Backend: Updated API router, database, workers, and auth in common.
- Stream Server: Removed SQLx queries and updated auth.
- Docs & Scripts: Updated documentation and recovery scripts.
2026-02-02 19:34:14 +01:00

34 lines
957 B
Bash
Executable file

#!/bin/bash
set -e
# CONTRACT: docs/BUDGETS.md
# DO NOT CHANGE THESE VALUES WITHOUT UPDATING THE CONTRACT FIRST.
MAX_TOTAL_SIZE_KB=5000 # 5MB
MAX_JS_ENTRY_KB=800 # 800KB
REPO_ROOT=$(git rev-parse --show-toplevel)
WEB_DIR="$REPO_ROOT/apps/web"
DIST_DIR="$WEB_DIR/dist"
echo "📍 Frontend Bundle Size Check (Strict)"
echo "📜 Contract: docs/BUDGETS.md"
if [ ! -d "$DIST_DIR" ]; then
echo "❌ Dist directory not found. Run build first."
exit 1
fi
# Calculate total size
TOTAL_SIZE_KB=$(du -sk "$DIST_DIR" | cut -f1)
echo "📊 Total Bundle Size: ${TOTAL_SIZE_KB}KB"
echo " Invariant Limit: ${MAX_TOTAL_SIZE_KB}KB"
if [ "$TOTAL_SIZE_KB" -gt "$MAX_TOTAL_SIZE_KB" ]; then
echo "❌ FATAL: OBESITY DETECTED."
echo " The bundle exceeds the hard limit set in the Frugality Manifesto."
echo " You must reduce the size or initiate a formal debate to change the limit."
exit 1
fi
echo "✅ Bundle adheres to strict diet."