-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·51 lines (40 loc) · 1.22 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.22 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
#!/usr/bin/env bash
set -euo pipefail
project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
web_dir="${OPENALIST_WEB_DIR:-$(dirname "$project_dir")/openalist-web}"
data_dir="${OPENALIST_DATA_DIR:-$project_dir/data-dev}"
backend_pid=""
cleanup() {
if [[ -n "$backend_pid" ]] && kill -0 "$backend_pid" 2>/dev/null; then
kill "$backend_pid" 2>/dev/null || true
wait "$backend_pid" 2>/dev/null || true
fi
}
trap cleanup EXIT INT TERM
if ! command -v go >/dev/null 2>&1; then
echo "Go is required to start the backend." >&2
exit 1
fi
if ! command -v pnpm >/dev/null 2>&1; then
echo "pnpm is required to start the frontend." >&2
exit 1
fi
if [[ ! -f "$web_dir/package.json" ]]; then
echo "Frontend repository not found at: $web_dir" >&2
echo "Set OPENALIST_WEB_DIR to its location and try again." >&2
exit 1
fi
if [[ ! -d "$web_dir/node_modules" ]]; then
echo "Frontend dependencies are missing. Run:" >&2
echo " cd $web_dir && pnpm install --frozen-lockfile" >&2
exit 1
fi
echo "Starting backend at http://localhost:5244"
echo "Starting frontend development server (Vite will print its URL)"
(
cd "$project_dir"
exec go run . server --dev --data "$data_dir"
) &
backend_pid=$!
cd "$web_dir"
pnpm dev