rdkagentsun/scripts/make-app.sh
Codex df90364034 feat(desktop): clickable macOS .app without electron-builder
- scripts/make-app.sh builds a thin 'RDK Agent.app' bundle whose launcher
  execs the repo-local Electron binary with the desktop package dir
- no electron-builder / no network; double-click or 'open' to enter the GUI
- dist-macos/ ignored (build artifact)
2026-08-25 11:50:05 +08:00

49 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
# Build a clickable macOS .app bundle that launches the RDK Agent Electron app.
# This is a thin wrapper (no electron-builder / no network): the bundle's
# launcher execs the repo-local Electron binary with the desktop package dir.
set -eu
REPO="$(cd "$(dirname "$0")/.." && pwd)"
DESKTOP="$REPO/packages/rdk-agent-desktop"
ELECTRON="$DESKTOP/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron"
OUT="$REPO/dist-macos"
APP="$OUT/RDK Agent.app"
if [ ! -x "$ELECTRON" ]; then
echo "make-app: Electron binary not found at $ELECTRON (run: cd packages/rdk-agent-desktop && npm i && npm run build)" >&2
exit 1
fi
# Ensure the renderer/main are built.
(cd "$DESKTOP" && npm run build)
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cat > "$APP/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key><string>RDK Agent</string>
<key>CFBundleDisplayName</key><string>RDK Agent</string>
<key>CFBundleIdentifier</key><string>cc.d-robotics.rdk-agent</string>
<key>CFBundleVersion</key><string>0.1.0</string>
<key>CFBundleExecutable</key><string>launch</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>LSMinimumSystemVersion</key><string>11.0</string>
<key>NSHighResolutionCapable</key><true/>
</dict>
</plist>
PLIST
cat > "$APP/Contents/MacOS/launch" <<LAUNCH
#!/bin/sh
exec "$ELECTRON" "$DESKTOP"
LAUNCH
chmod +x "$APP/Contents/MacOS/launch"
echo "make-app: wrote $APP"
echo "make-app: double-click it, or: open '$APP'"