init geek calc
Some checks failed
Deploy to GitHub Pages / build-and-deploy (push) Has been cancelled

This commit is contained in:
2025-10-04 10:53:41 +08:00
commit 54f427ea21
45 changed files with 4878 additions and 0 deletions

29
check-size.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Size validation script for Geek Calculator
# Checks if total bundle size is under 50KB as required
echo "Checking Geek Calculator bundle size..."
# Define the maximum allowed size in KB
MAX_SIZE_KB=50
# Use wc to calculate total size
total_size=0
for file in $(find . -type f \( -name "*.html" -o -name "*.css" -o -name "*.js" -o -name "*.webmanifest" \)); do
file_size=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null)
total_size=$((total_size + file_size))
done
# Convert bytes to KB (with rounding up)
total_size_kb=$(( (total_size + 1023) / 1024 ))
echo "Total bundle size: $total_size_kb KB"
echo "Maximum allowed size: $MAX_SIZE_KB KB"
if [ $total_size_kb -le $MAX_SIZE_KB ]; then
echo "✅ Size validation PASSED: Bundle size is under limit"
exit 0
else
echo "❌ Size validation FAILED: Bundle size exceeds limit by $((total_size_kb - MAX_SIZE_KB)) KB"
exit 1
fi