Skip to content

Commit 2fc3128

Browse files
committed
Squashed commit of the following:
commit 78748a44d4c75da489517fd6ce09397530b37fdb Author: 草鞋没号 <308487730@qq.com> Date: Wed Mar 15 09:16:10 2023 +0800 chore: cleanup commit dd5ff06 Author: Jimmy <jimmyrss1102@gmail.com> Date: Tue Mar 14 21:12:33 2023 +0800 docs : add `electron-auto-update` docs
1 parent 2f2880a commit 2fc3128

File tree

5 files changed

+116
-6
lines changed

5 files changed

+116
-6
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ export default {
7070
}
7171
```
7272

73+
## 🔧 Additional features
74+
75+
1. electron-updater 👉 [see docs](src/components/update/README.md)
76+
1. playwright
77+
7378
## ❔ FAQ
7479

7580
- [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies)

README.zh-CN.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ export default {
6767
}
6868
```
6969

70-
## FAQ
70+
## 🔧 额外的功能
71+
72+
1. Electron 自动更新 👉 [阅读文档](src/components/update/README.zh-CN.md)
73+
2. Playwright 测试
74+
75+
## ❔ FAQ
7176

7277
- [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies)
7378
- [C/C++ addons, Node.js modules - Pre-Bundling](https://github.com/electron-vite/vite-plugin-electron-renderer#dependency-pre-bundling)

electron-builder.json5

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
"allowToChangeInstallationDirectory": true,
3636
"deleteAppDataOnUninstall": false
3737
},
38-
publish:{
39-
provider: 'generic',
40-
channel: 'latest',
41-
url: 'https://github.com/electron-vite/electron-vite-react/releases/download/v0.9.9/',
38+
"publish": {
39+
"provider": "generic",
40+
"channel": "latest",
41+
"url": "https://github.com/electron-vite/electron-vite-react/releases/download/v0.9.9/"
4242
}
43-
}
43+
}

src/components/update/README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# electron-updater
2+
3+
English | [简体中文](README.zh-CN.md)
4+
5+
> 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)

src/components/update/README.zh-CN.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# electron-auto-update
2+
3+
[English](README.md) | 简体中文
4+
5+
使用`electron-updater`实现electron程序的更新检测、下载和安装等功能。
6+
7+
```sh
8+
npm i electron-updater
9+
```
10+
11+
### 主要逻辑
12+
13+
1. ##### 更新地址、更新信息脚本的配置
14+
15+
`electron-builder.json5`添加`publish`字段,用来配置更新地址和使用哪种策略作为更新服务
16+
17+
``` json5
18+
{
19+
"publish": {
20+
"provider": "generic", // 提供者、提供商
21+
"channel": "latest", // 生成yml文件的名称
22+
"url": "https://foo.com/" //更新地址
23+
}
24+
}
25+
```
26+
27+
更多见 : [electron-builder.json5...](xxx)
28+
29+
2. ##### Electron更新逻辑
30+
31+
- 检测更新是否可用;
32+
33+
- 检测服务端的软件版本;
34+
35+
- 检测更新是否可用;
36+
37+
- 下载服务端新版软件(当更新可用);
38+
- 安装方式;
39+
40+
更多见 : [update...](https://github.com/electron-vite/electron-vite-react/blob/main/electron/main/update.ts)
41+
42+
3. ##### Electron更新UI页面
43+
44+
主要功能是:用户触发上述(2.)更新逻辑的UI页面。用户可以通过点击页面触发electron更新的不同功能。
45+
更多见 : [components/update.ts...](https://github.com/electron-vite/electron-vite-react/tree/main/src/components/update/index.tsx)
46+
47+
---
48+
49+
这里建议更新触发以用户操作触发(本项目的以用户点击 **更新检测** 后触发electron更新功能)
50+
51+
关于更多使用`electron-updater`进行electron更新,见文档:[auto-update](https://www.electron.build/.html)

0 commit comments

Comments
 (0)