Files
test-project-161/src/components/update
Song e803167b31 refactor: upgrade deps, setup tailwind4 and correct ci (#258)
* refresh

* e2e test

* Change debugger type from 'pwa-chrome' to 'chrome'

* ci: align workflows with electron-vite-vue#540

* chore: update test, tsconfig and deps

* chore: update deps and debug config

* chore: refresh style

* docs: update readme

* docs: make linter happy

* ci: bump versions

* chore: refactor update handling and improve UI elements

* 1.0.0
2026-05-31 22:42:38 +08:00
..

electron-updater

English | 简体中文

Use electron-updater to detect, download, and install Electron app updates.

pnpm add electron-updater

Main Flow

1. Configure the update server

Add a publish field to electron-builder.json to define the update source and provider.

{
  publish: {
    provider: 'generic',
    channel: 'latest',
    url: 'https://foo.com/',
  },
}

For more information, please refer to electron-builder.json

2. Main-process update logic

This project keeps autoDownload disabled, so users start downloads manually.

  • check-update calls autoUpdater.checkForUpdates() after packaging.
  • The main process emits update-can-available when it receives update-available or update-not-available.
  • start-download begins downloading the update and forwards download progress to the renderer.
  • cancel-download stops the current download and resets the cancellation token.
  • quit-and-install installs the downloaded update and restarts the app.

For more information, please refer to update.ts

3. Renderer UI

The update page is the user-facing entry point for the flow above. Users click the page button to trigger update actions in Electron.

  • Click Check update to trigger check-update.
  • If an update is available, the page lets the user start or cancel the download.
  • After the download completes, the page switches to Install now.

For more information, please refer to components/update/index.tsx


Updates should be triggered by user action. In this project, the flow starts after the user clicks Check update.

For more information on using electron-updater for Electron updates, please refer to the documentation