summaryrefslogtreecommitdiffhomepage
path: root/bin/windows-pkg
blob: 693168c0b072da363657913a96bbdc74d2d49521 (plain)
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
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
FRONTEND_DIR="$PROJECT_DIR/packages/frontend"
DEST="/mnt/c/Users/micro/OneDrive/Documents/Dispatch"

# Install deps (includes electron + electron-builder as devDependencies)
cd "$PROJECT_DIR"
bun install

# Build frontend and package for Windows (use production port)
cd "$FRONTEND_DIR"
VITE_API_URL="http://localhost:18390" bun run dist:win

# Find the output directory
WIN_BUILD=$(ls -d "$FRONTEND_DIR/release/win-unpacked" 2>/dev/null || true)

if [ -z "$WIN_BUILD" ]; then
	echo "Build failed: no win-unpacked directory found in release/" >&2
	exit 1
fi

# Copy to Windows Documents
rm -rf "$DEST"
mkdir -p "$DEST"
cp -r "$WIN_BUILD"/. "$DEST"/

echo "Windows build copied to: C:\\Users\\micro\\OneDrive\\Documents\\Dispatch"
echo "Run Dispatch.exe from that folder."