🚧 VeloxKit is pre-release software. APIs may change before v1.0. Get started →
Documentation
APIs & Bindings
updater

updater Stable

Delivers over-the-air updates via GitHub Releases. No server required.

Requires capability: "updater"

Import

import { updater } from 'veloxkit'

updater.check(owner, repo, currentVersion)

Check GitHub Releases for a newer version.

const result = await updater.check('acme-inc', 'my-app', '1.0.0')

Parameters:

ParamTypeDescription
ownerstringGitHub organization or username
repostringRepository name
currentVersionstringCurrent semver version, e.g. '1.0.0'

Returns: Promise<UpdateCheckResult>

interface UpdateCheckResult {
  hasUpdate:     boolean   // true if latestVersion > currentVersion
  latestVersion: string    // e.g. '1.2.0'
  body:          string    // Release notes from GitHub
}

Returns immediately — no download. Compares version strings using semver ordering.

updater.update(owner, repo, binName, currentVersion)

Download and install the latest release.

const result = await updater.update('acme-inc', 'my-app', 'my-app', '1.0.0')
 
if (result.updated) {
  // Prompt user to relaunch
  console.log(`Updated to ${result.latestVersion}`)
}

Parameters:

ParamTypeDescription
ownerstringGitHub organization or username
repostringRepository name
binNamestringAsset filename prefix (see below)
currentVersionstringCurrent semver version

Returns: Promise<UpdateResult>

interface UpdateResult {
  updated:       boolean   // false if already on latest version
  latestVersion: string    // version that was installed (or already running)
}

Asset naming

The updater selects the release asset matching the current platform:

PlatformAsset name
Windows{binName}-windows.exe
macOS{binName}-macos
Linux{binName}-linux

veloxkit package produces files with exactly these suffixes.

The binary is replaced on disk. The update takes effect on next launch — the running process is not affected. Prompt the user to restart.

Full example

import { updater } from 'veloxkit'
 
const OWNER   = 'acme-inc'
const REPO    = 'my-app'
const BIN     = 'my-app'
const VERSION = '1.0.0'
 
// Check silently on launch
setTimeout(async () => {
  try {
    const check = await updater.check(OWNER, REPO, VERSION)
    if (check.hasUpdate) {
      console.log(`Update available: ${check.latestVersion}`)
      // Show UI notification to user...
    }
  } catch {
    // Network unavailable — ignore
  }
}, 5000)
 
// Install when user confirms
async function installUpdate() {
  const result = await updater.update(OWNER, REPO, BIN, VERSION)
  if (result.updated) {
    // Show "Restart to apply" dialog
  }
}

GitHub Release setup

  1. Build release artifacts with veloxkit package --target windows / macos / linux
  2. Create a GitHub Release with a semver tag (e.g. v1.2.0)
  3. Attach the platform artifacts — they must match the {binName}-{platform} pattern

The updater compares the release tag (stripping a leading v) against currentVersion.