Files
scripts/utils/build-all.sh
2026-02-09 21:51:52 -08:00

62 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Load shared libraries
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../lib/init.sh"
# Build All Projects Script
# Builds all projects that have build scripts
set -e
echo "🔨 Building all projects..."
PROJECTS_DIR="."
BUILT=0
FAILED=0
build_project() {
local project=$1
if [ -f "$project/package.json" ]; then
cd "$project"
# Check if build script exists
if grep -q "\"build\"" package.json; then
echo "🔨 Building $project..."
if npm run build 2>/dev/null || pnpm build 2>/dev/null; then
echo "$project - Build successful"
((BUILT++))
else
echo "$project - Build failed"
((FAILED++))
fi
else
echo " ⏭️ $project - No build script"
fi
cd ..
fi
}
echo "📋 Building projects..."
# Build all projects with package.json
for dir in */; do
if [ -d "$dir" ] && [ "$dir" != "node_modules/" ] && [ "$dir" != ".git/" ] && [ "$dir" != "scripts/" ]; then
build_project "$dir"
fi
done
echo ""
echo "📊 Build Summary:"
echo " ✅ Built: $BUILT"
echo " ❌ Failed: $FAILED"
if [ $FAILED -gt 0 ]; then
exit 1
fi
echo "✅ All builds successful!"