_scripts/generate-search.sh#!/bin/bashecho "🔨 Building site..."npm run build || exit 1echo ""echo "🚀 Starting server..."npm run start &SERVER_PID=$!# Give the server a moment to fail if there's an immediate errorsleep 2# Check if the server process is still runningif ! ps -p $SERVER_PID > /dev/null 2>&1; thenecho "❌ Server failed to start (process died immediately)"echo "💡 Check if port 3000 is already in use or if there are other startup errors"exit 1fiecho "⏳ Waiting for server to be ready..."MAX_ATTEMPTS=30ATTEMPT=0while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; doif curl -s http://localhost:3000 > /dev/null 2>&1; thenecho "✅ Server is ready!"echo ""breakfi# Check if server process died during startupif ! ps -p $SERVER_PID > /dev/null 2>&1; thenecho "❌ Server process died during startup"echo "💡 Check if port 3000 is already in use or if there are other startup errors"exit 1fiATTEMPT=$((ATTEMPT + 1))sleep 1doneif [ $ATTEMPT -eq $MAX_ATTEMPTS ]; thenecho "❌ Server failed to start"kill $SERVER_PID 2>/dev/nullexit 1fi# Run the crawlernode _scripts/generate-search.mjs# Kill the serverecho ""echo "🛑 Stopping server..."kill $SERVER_PID 2>/dev/nullwait $SERVER_PID 2>/dev/nullecho "✅ Done!"