chore(dev): run mobile uni through portless
This commit is contained in:
@@ -10,7 +10,7 @@ if [[ ! -d node_modules ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${PORTLESS:-1}" != "0" ]] && command -v portless >/dev/null 2>&1; then
|
||||
exec portless run --name wygj-admin bash -lc 'npm run dev -- --host "${HOST:-127.0.0.1}" --port "$PORT" --strictPort'
|
||||
exec portless run --name wygj-admin --force bash -lc 'npm run dev -- --host "${HOST:-127.0.0.1}" --port "$PORT" --strictPort'
|
||||
fi
|
||||
|
||||
if [[ "${PORTLESS:-1}" != "0" ]]; then
|
||||
|
||||
+29
-7
@@ -8,7 +8,7 @@ usage() {
|
||||
cat <<'EOF'
|
||||
Usage: ./scripts/dev.sh [start|stop|restart|status|--reset]
|
||||
|
||||
Starts MySQL, Redis, MinIO, Qdrant, backend, admin frontend and legacy mobile fallback.
|
||||
Starts MySQL, Redis, MinIO, Qdrant, backend, admin frontend and current mobile-uni frontend.
|
||||
start start local demo services
|
||||
stop stop backend and frontend dev processes
|
||||
restart stop backend and frontend, then start again
|
||||
@@ -130,6 +130,10 @@ using_portless_admin() {
|
||||
using_portless
|
||||
}
|
||||
|
||||
using_portless_mobile() {
|
||||
using_portless
|
||||
}
|
||||
|
||||
backend_url() {
|
||||
if using_portless_backend; then
|
||||
echo "https://wygj-api.localhost/"
|
||||
@@ -146,6 +150,14 @@ admin_url() {
|
||||
fi
|
||||
}
|
||||
|
||||
mobile_url() {
|
||||
if using_portless_mobile; then
|
||||
echo "https://wygj-mobile-uni.localhost/h5/"
|
||||
else
|
||||
echo "http://127.0.0.1:5174/h5/user"
|
||||
fi
|
||||
}
|
||||
|
||||
stop_dev() {
|
||||
stop_launchctl_job local.wygj.backend.dev
|
||||
stop_launchctl_job local.wygj.admin.dev
|
||||
@@ -153,6 +165,7 @@ stop_dev() {
|
||||
stop_port 8080
|
||||
stop_portless_route wygj-admin
|
||||
stop_port 5173
|
||||
stop_portless_route wygj-mobile-uni
|
||||
stop_port 5174
|
||||
}
|
||||
|
||||
@@ -209,7 +222,9 @@ fi
|
||||
if ! using_portless_admin; then
|
||||
ensure_port_free 5173
|
||||
fi
|
||||
ensure_port_free 5174
|
||||
if ! using_portless_mobile; then
|
||||
ensure_port_free 5174
|
||||
fi
|
||||
|
||||
if [[ "$RESET" == true ]]; then
|
||||
./scripts/reset-dev-db.sh
|
||||
@@ -221,7 +236,7 @@ trap cleanup INT TERM EXIT
|
||||
|
||||
if using_portless_backend; then
|
||||
portless alias --remove wygj-api >/dev/null 2>&1 || true
|
||||
portless run --name wygj-api ./scripts/dev-backend.sh &
|
||||
portless run --name wygj-api --force ./scripts/dev-backend.sh &
|
||||
else
|
||||
./scripts/dev-backend.sh &
|
||||
fi
|
||||
@@ -230,15 +245,22 @@ PIDS+=("$!")
|
||||
./scripts/dev-frontend.sh &
|
||||
PIDS+=("$!")
|
||||
|
||||
./scripts/dev-mobile.sh &
|
||||
if using_portless_mobile; then
|
||||
portless alias --remove wygj-mobile-uni >/dev/null 2>&1 || true
|
||||
portless run --name wygj-mobile-uni --force npm --prefix mobile-uni run dev &
|
||||
else
|
||||
./scripts/dev-mobile.sh &
|
||||
fi
|
||||
PIDS+=("$!")
|
||||
|
||||
echo "Backend: $(backend_url)"
|
||||
echo "Admin: $(admin_url)"
|
||||
echo "Legacy mobile fallback: http://127.0.0.1:5174/h5/user"
|
||||
echo "Current user side: https://wygj-mobile-uni.localhost/h5/ (run: cd mobile-uni && portless run --name wygj-mobile-uni npm run dev)"
|
||||
echo "Mobile: $(mobile_url)"
|
||||
if using_portless_mobile; then
|
||||
echo "Legacy mobile fallback: PORTLESS=0 ./scripts/dev.sh"
|
||||
fi
|
||||
echo "Qdrant: http://127.0.0.1:6333/"
|
||||
echo "Press Ctrl+C to stop backend, admin frontend and legacy mobile frontend."
|
||||
echo "Press Ctrl+C to stop backend, admin frontend and mobile frontend."
|
||||
|
||||
while :; do
|
||||
for pid in "${PIDS[@]}"; do
|
||||
|
||||
Reference in New Issue
Block a user