-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathdev
More file actions
executable file
·42 lines (34 loc) · 1.17 KB
/
dev
File metadata and controls
executable file
·42 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -euo pipefail
root="$(git rev-parse --show-toplevel)"
desktop_dir="$root/desktop"
vite_port="${REASONIX_DESKTOP_VITE_PORT:-}"
if [[ $# -gt 0 && "$1" =~ ^[0-9]+$ ]]; then
vite_port="$1"
shift
fi
if [[ -z "$vite_port" ]]; then
branch="$(git -C "$root" branch --show-current || true)"
if [[ -z "$branch" ]]; then
branch="$(git -C "$root" rev-parse --short HEAD)"
fi
key="$root:$branch"
hash="$(printf "%s" "$key" | cksum | awk '{print $1}')"
vite_port=$((5173 + (hash % 100)))
fi
if (( vite_port < 1024 || vite_port > 36000 )); then
echo "dev: Vite port must be between 1024 and 36000, got $vite_port" >&2
exit 2
fi
wails_port="${REASONIX_DESKTOP_WAILS_PORT:-$((vite_port + 29000))}"
export REASONIX_DESKTOP_VITE_PORT="$vite_port"
export REASONIX_DEV=1
# pnpm v11: suppress TTY prompts and skip lockfile age checks in headless mode.
export PNPM_CONFIG_CONFIRM_MODULES_PURGE=false
export PNPM_CONFIG_MINIMUM_RELEASE_AGE=0
echo "Reasonix desktop dev"
echo " worktree: $root"
echo " vite: http://127.0.0.1:$vite_port"
echo " wails: 127.0.0.1:$wails_port"
cd "$desktop_dir"
exec wails dev -nosyncgomod -devserver "127.0.0.1:$wails_port" "$@"