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
This commit is contained in:
Song authored and GitHub committed 2026-05-31 22:42:38 +08:00
1 parent 86250a53d6
commit e803167b31
39 files changed
+855 -916

No files matched your search

+34 -28
View File
@@ -2,48 +2,54 @@
English | [简体中文](README.zh-CN.md)
> Use `electron-updater` to realize the update detection, download and installation of the electric program.
> Use `electron-updater` to detect, download, and install Electron app updates.
```sh
npm i electron-updater
pnpm add electron-updater
```
### Main logic
## Main Flow
1. ##### Configuration of the update the service address and update information script:
### 1. Configure the update server
Add a `publish` field to `electron-builder.json5` for configuring the update address and which strategy to use as the update service.
Add a `publish` field to `electron-builder.json` to define the update source and provider.
``` json5
{
"publish": {
"provider": "generic",
"channel": "latest",
"url": "https://foo.com/"
}
}
```
```json5
{
publish: {
provider: 'generic',
channel: 'latest',
url: 'https://foo.com/',
},
}
```
For more information, please refer to : [electron-builder.json5...](https://github.com/electron-vite/electron-vite-react/blob/2f2880a9f19de50ff14a0785b32a4d5427477e55/electron-builder.json5#L38)
For more information, please refer to [electron-builder.json](https://github.com/electron-vite/electron-vite-react/blob/main/electron-builder.json)
2. ##### The update logic of Electron:
### 2. Main-process update logic
- Checking if an update is available;
- Checking the version of the software on the server;
- Checking if an update is available;
- Downloading the new version of the software from the server (when an update is available);
- Installation method;
This project keeps `autoDownload` disabled, so users start downloads manually.
For more information, please refer to : [update...](https://github.com/electron-vite/electron-vite-react/blob/main/electron/main/update.ts)
- `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.
3. ##### Updating UI pages in Electron:
For more information, please refer to [update.ts](https://github.com/electron-vite/electron-vite-react/blob/main/electron/main/update.ts)
The main function is to provide a UI page for users to trigger the update logic mentioned in (2.) above. Users can click on the page to trigger different update functions in Electron.
For more information, please refer to : [components/update...](https://github.com/electron-vite/electron-vite-react/blob/main/src/components/update/index.tsx)
### 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](https://github.com/electron-vite/electron-vite-react/blob/main/src/components/update/index.tsx)
---
Here it is recommended to trigger updates through user actions (in this project, Electron update function is triggered after the user clicks on the "Check for updates" button).
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 : [auto-update](https://www.electron.build/.html)
For more information on using `electron-updater` for Electron updates, please refer to the [documentation](https://www.electron.build)