diff --git a/demo.sh b/demo.sh deleted file mode 100755 index 64b10fe..0000000 --- a/demo.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -echo "🚀 Starting GoCheck Demo" -echo "========================" - -# Start the server in the background -echo "Starting server..." -./gocheck & -SERVER_PID=$! - -# Wait for server to start -sleep 2 - -echo "" -echo "✅ Server is running at http://localhost:8080" -echo "" -echo "🌐 Open your browser and go to: http://localhost:8080" -echo "" -echo "📋 Demo Features:" -echo " • Create a new checklist" -echo " • Add items to your checklist" -echo " • Check/uncheck items" -echo " • Edit item content" -echo " • Lock items to prevent conflicts" -echo " • Create hierarchical items (sub-items)" -echo " • Real-time collaboration (open multiple browser tabs)" -echo "" -echo "🔧 API Testing:" -echo " • Create checklist: POST /api/checklists" -echo " • Add item: POST /api/checklists/{uuid}/items" -echo " • Get items: GET /api/checklists/{uuid}/items" -echo " • Update item: PATCH /api/checklists/{uuid}/items/{id}" -echo " • Delete item: DELETE /api/checklists/{uuid}/items/{id}" -echo " • Lock item: POST /api/checklists/{uuid}/items/{id}/lock" -echo " • Real-time updates: GET /api/checklists/{uuid}/sse" -echo "" -echo "Press Ctrl+C to stop the server" -echo "" - -# Wait for user to stop -trap "echo ''; echo '🛑 Stopping server...'; kill $SERVER_PID; exit" INT -wait \ No newline at end of file diff --git a/dev.sh b/dev.sh index 2cce932..9b3efa5 100755 --- a/dev.sh +++ b/dev.sh @@ -1,8 +1,65 @@ #!/bin/bash +# Function to cleanup processes +cleanup() { + echo "" + echo "🛑 Shutting down processes..." + + # Kill child processes + if [ ! -z "$AIR_PID" ]; then + echo " Stopping Air server (PID: $AIR_PID)..." + kill $AIR_PID 2>/dev/null || true + fi + + if [ ! -z "$VITE_PID" ]; then + echo " Stopping Vite server (PID: $VITE_PID)..." + kill $VITE_PID 2>/dev/null || true + fi + + # Kill any remaining processes + pkill -f "gocheck" 2>/dev/null || true + pkill -f "vite" 2>/dev/null || true + pkill -f "esbuild" 2>/dev/null || true + pkill -f "air" 2>/dev/null || true + + echo "✅ All processes stopped" + exit 0 +} + +# Set up signal handlers +trap cleanup SIGINT SIGTERM + +# Kill any existing processes +echo "🔄 Cleaning up existing processes..." +pkill -f "gocheck" 2>/dev/null || true +pkill -f "vite" 2>/dev/null || true +pkill -f "esbuild" 2>/dev/null || true +pkill -f "air" 2>/dev/null || true +sleep 1 + +# Verify processes are killed +if pgrep -f "gocheck\|vite\|esbuild\|air" > /dev/null; then + echo "⚠️ Some processes are still running. Force killing..." + pkill -9 -f "gocheck" 2>/dev/null || true + pkill -9 -f "vite" 2>/dev/null || true + pkill -9 -f "esbuild" 2>/dev/null || true + pkill -9 -f "air" 2>/dev/null || true + sleep 1 +fi + +echo "✅ Process cleanup completed" + # Run the server +echo "🚀 Starting Go server with Air..." air & +AIR_PID=$! # Run the frontend +echo "🎨 Starting frontend development server..." sleep 2 -cd frontend && npm run dev \ No newline at end of file +cd frontend && npm run dev & +VITE_PID=$! + +# Wait for both processes +echo "📡 Development servers running. Press Ctrl+C to stop." +wait \ No newline at end of file