@beamdeploy/electron-updater
v0.1.0
Published
Electron main-process client for BeamDeploy OTA web bundle updates.
Readme
@beamdeploy/electron-updater
Electron main-process client for BeamDeploy / BeamDeploy OTA: check on launch, background zip download, apply on restart.
Install
npm install @beamdeploy/electron-updaterRequires Electron 28+ (peer dependency).
Quick start
import { app, BrowserWindow } from 'electron';
import path from 'node:path';
import {
bindElectronApp,
checkOnLaunch,
configure,
getWebRoot,
showRestartPrompt
} from '@beamdeploy/electron-updater';
bindElectronApp(app);
app.whenReady().then(async () => {
await configure({
appId: 'com.example.desktop',
updateUrl: 'https://your-host/api/check-update',
channel: 'production',
packagedWebRoot: path.join(__dirname, '../renderer'),
deviceId: 'desktop-install-001'
});
const launch = await checkOnLaunch({ currentVersion: '1.0.0' });
const webRoot = await getWebRoot();
const win = new BrowserWindow({ width: 960, height: 640 });
await win.loadFile(path.join(webRoot, 'index.html'));
if (launch.updateReady && launch.version) {
await showRestartPrompt(win, {
message: `Version ${launch.version} is ready. Restart to apply?`
});
}
});Upload bundles (CI)
Same zip layout as Capacitor web builds (index.html at archive root). Tag uploads for Electron clients:
beamdeploy bundle upload com.example.desktop 1.0.1 ./dist.zip \
--channel production \
--platform electronCreate the app with stack electron in the dashboard or API (stack: "electron" on POST /v1/apps).
API
| Export | Description |
| --- | --- |
| configure | appId, updateUrl, channel, packagedWebRoot, optional storageDir |
| bindElectronApp | Required for quitAndInstall / default native_version |
| checkOnLaunch | Promote pending bundle, check server, download if newer |
| getLatest | Raw update check (platform=electron) |
| downloadUpdate | Fetch zip, verify checksum, extract under userData/beamdeploy |
| getWebRoot | Active bundle directory or packagedWebRoot |
| showRestartPrompt | Native dialog → quitAndInstall |
| applyPendingOnStartup | Call before first window if not using checkOnLaunch |
Documentation
- Engineering reference:
docs/electron-ota.md
