Desktop Installer Package Generation Guide
Prerequisites
```bash
Ensure dependencies are installed
pnpm install
`
1. Build the Frontend
```bash
npx vite build
`
- Output artifacts to the dist/ directory
- Completes in approximately 20 seconds
2. Package the Installer
```bash
npx electron-builder --win --config electron-builder.yml
`
- Output artifacts to the release8/ directory
- Completes in approximately 10-15 minutes
- Generated installer: release8/LRAgent-Setup-1.1.0-win-x64.exe (approx. 173MB)
3. One-Step Command (Build + Package)
```bash
npx vite build && npx electron-builder --win --config electron-builder.yml
`
Key Configuration Files
| File | Purpose |
|---|---|
| electron-builder.yml | Packaging configuration (App ID, output directory, included files, NSIS settings) |
| electron-app/main.js | Electron main process entry (starts embedded Node service + loads frontend window) |
| package.json | Version number (version field, currently 1.1.0) |
Directory Structure
`
bossagents/
├── dist/ # Frontend build artifacts (vite build output)
├── electron-app/main.js # Electron main process
├── electron-builder.yml # Packaging configuration
├── server/ # Backend service (included in build)
├── release8/ # Installer output directory (excluded by .gitignore)
│ └── LRAgent-Setup-1.1.0-win-x64.exe
└── package.json # Version number
`
Update version number
Edit the version field in package.json and electron-builder.yml, then rebuild the installer.
Build installer without rebuilding frontend
`bash
npx electron-builder --win --config electron-builder.yml
`
Build for other platforms
`bash
macOS
npx electron-builder --mac --config electron-builder.yml
Linux
npx electron-builder --linux --config electron-builder.yml
`
Common issues
| Issue | Solution |
|---|---|
| Build timeout | Increase timeout; NSIS compression for a 173MB app takes 10-15 minutes |
| `file source doesn't exist` warning | Some DB files missing; does not affect build, can be ignored |
| better-sqlite3 binding missing | Downgraded to node:sqlite; does not affect build or runtime |
BossAgents