Repository navigation
Expand file tree
/
Copy pathstart_desk.sh
More file actions
executable file
·63 lines (54 loc) · 1.63 KB
/
Copy pathstart_desk.sh
File metadata and controls
executable file
·63 lines (54 loc) · 1.63 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# start_desk.sh — One-click launcher for Coderix Desktop (Electron)
#
# Usage:
# ./start_desk.sh
#
# This script:
# 1. Frees port 5173 (kills any stale process)
# 2. Starts electron-vite dev server + Electron app
# 3. Cleans up on Ctrl+C
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m'
# ---------------------------------------------------------------------------
# 1. Free port 5173
# ---------------------------------------------------------------------------
free_port() {
local port=$1
local pids=$(lsof -ti tcp:$port 2>/dev/null)
if [ -n "$pids" ]; then
echo -e "${CYAN}Killing stale process(es) on port $port: $pids${NC}"
kill -9 $pids 2>/dev/null || true
sleep 0.5
fi
}
free_port 5173
# ---------------------------------------------------------------------------
# 2. Cleanup handler
# ---------------------------------------------------------------------------
cleanup() {
echo ""
echo -e "${CYAN}Shutting down Coderix Desktop...${NC}"
kill $ELECTRON_PID 2>/dev/null || true
wait $ELECTRON_PID 2>/dev/null || true
echo -e "${GREEN}Done.${NC}"
}
trap cleanup EXIT INT TERM
# ---------------------------------------------------------------------------
# 3. Start
# ---------------------------------------------------------------------------
echo -e "${GREEN}Starting Coderix Desktop...${NC}"
echo ""
cd "$ROOT" && pnpm --filter @coderix/desktop dev &
ELECTRON_PID=$!
echo ""
echo -e " Desktop: ${CYAN}Electron window${NC}"
echo -e " Dev URL: ${CYAN}http://localhost:5173${NC}"
echo ""
echo "Press Ctrl+C to stop."
echo ""
wait