25 lines
710 B
Bash
Executable File
25 lines
710 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
cd "$ROOT_DIR/frontend"
|
|
|
|
if [[ ! -d node_modules ]]; then
|
|
npm install --registry=https://registry.npmmirror.com
|
|
fi
|
|
|
|
if [[ -n "${PORTLESS_URL:-}" && -n "${PORT:-}" ]]; then
|
|
exec npm run dev -- --host "${HOST:-127.0.0.1}" --port "$PORT" --strictPort
|
|
fi
|
|
|
|
if [[ "${PORTLESS:-1}" != "0" ]] && command -v portless >/dev/null 2>&1; then
|
|
exec portless run --name wygj-admin --force bash "$ROOT_DIR/scripts/dev-frontend.sh"
|
|
fi
|
|
|
|
if [[ "${PORTLESS:-1}" != "0" ]]; then
|
|
echo "portless is not available; falling back to http://127.0.0.1:5173/." >&2
|
|
fi
|
|
|
|
exec npm run dev -- --host 127.0.0.1 --port 5173 --strictPort
|