dev.sh 292 Bytes
#!/usr/bin/env bash
set -e

PORT="${PORT:-3010}"

# Kill whatever is holding the port
pid=$(lsof -ti tcp:"$PORT" 2>/dev/null || true)
if [ -n "$pid" ]; then
  echo "Killing process $pid on port $PORT…"
  kill -9 $pid
  sleep 0.5
fi

echo "Starting server on port $PORT…"
exec npm run dev