#!/bin/bash # Start local dev server with tunnel for rapid Saleor app development echo "🚀 Starting Saleor Core Extensions with tunnel..." echo "" # Check if localtunnel is installed if ! command -v lt &> /dev/null; then echo "❌ localtunnel not found. Installing..." npm install -g localtunnel fi # Start localtunnel in background and capture URL lt --port 3000 --print-requests & TUNNEL_PID=$! # Wait for tunnel to establish sleep 3 # Get the tunnel URL (this is a simple approach, in reality we'd parse the output) echo "" echo "⏳ Waiting for tunnel to start..." sleep 2 echo "" echo "✅ Tunnel started!" echo "" echo "📝 Use this URL in Saleor Dashboard:" echo " https://YOUR_TUNNEL_URL.loca.lt/api/manifest" echo "" echo "🔧 Starting Next.js dev server..." echo "" # Kill tunnel on exit trap "kill $TUNNEL_PID 2>/dev/null; exit" INT TERM EXIT # Start dev server npm run dev