You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Use `electron-updater` to realize the update detection, download and installation of the electric program.
6
+
7
+
```sh
8
+
npm i electron-updater
9
+
```
10
+
11
+
### Main logic
12
+
13
+
1.##### Configuration of the update the service address and update information script:
14
+
15
+
Add a `publish` field to `electron-builder.json5` for configuring the update address and which strategy to use as the update service.
16
+
17
+
```json5
18
+
{
19
+
"publish": {
20
+
"provider":"generic",
21
+
"channel":"latest",
22
+
"url":"https://foo.com/"
23
+
}
24
+
}
25
+
```
26
+
27
+
For more information, please refer to : [electron-builder.json5...](https://github.com/electron-vite/electron-vite-react/blob/2f2880a9f19de50ff14a0785b32a4d5427477e55/electron-builder.json5#L38)
28
+
29
+
2.##### The update logic of Electron:
30
+
31
+
- Checking if an update is available;
32
+
- Checking the version of the software on the server;
33
+
- Checking if an update is available;
34
+
- Downloading the new version of the software from the server (when an update is available);
35
+
- Installation method;
36
+
37
+
For more information, please refer to : [update...](https://github.com/electron-vite/electron-vite-react/blob/main/electron/main/update.ts)
38
+
39
+
3.##### Updating UI pages in Electron:
40
+
41
+
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.
42
+
43
+
For more information, please refer to : [components/update...](https://github.com/electron-vite/electron-vite-react/blob/main/src/components/update/index.tsx)
44
+
45
+
---
46
+
47
+
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).
48
+
49
+
For more information on using `electron-updater` for Electron updates, please refer to the documentation : [auto-update](https://www.electron.build/.html)
0 commit comments