Files
CurrenciCombo/scripts/fix-frontend.sh

63 lines
1.5 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# Frontend Fix Script
echo -e "\n========================================"
echo -e " FRONTEND FIX SCRIPT"
echo -e "========================================\n"
# Step 1: Stop existing webapp
echo -e "1. Stopping existing webapp..."
if lsof -ti:3000 > /dev/null 2>&1; then
kill $(lsof -ti:3000) 2>/dev/null
echo -e " ✅ Stopped webapp process"
sleep 2
else
echo -e " No webapp process running on port 3000"
fi
# Step 2: Clear Next.js cache
echo -e "\n2. Clearing Next.js cache..."
cd webapp || exit 1
if [ -d ".next" ]; then
rm -rf .next
echo -e " ✅ Cleared .next cache"
else
echo -e " No cache to clear"
fi
# Step 3: Check/Create .env.local
echo -e "\n3. Checking environment variables..."
if [ ! -f ".env.local" ]; then
cat > .env.local << EOF
NEXT_PUBLIC_ORCH_URL=http://localhost:8080
NEXTAUTH_SECRET=dev-secret-change-in-production-min-32-chars
EOF
echo -e " ✅ Created .env.local"
else
echo -e " ✅ .env.local exists"
fi
# Step 4: Verify dependencies
echo -e "\n4. Checking dependencies..."
if [ ! -d "node_modules" ]; then
echo -e " ⚠️ node_modules not found. Installing..."
npm install
else
echo -e " ✅ Dependencies installed"
fi
# Step 5: Start webapp
echo -e "\n5. Starting webapp..."
echo -e " Starting in background..."
npm run dev &
WEBAPP_PID=$!
echo -e "\n✅ Webapp starting! (PID: $WEBAPP_PID)"
echo -e " Wait 10-15 seconds for Next.js to compile"
echo -e " Then open: http://localhost:3000"
echo -e " To stop: kill $WEBAPP_PID"
echo ""
cd ..