1.设置更新源
import { autoUpdater } from 'electron-updater';
autoUpdater.setFeedURL({
provider: 'generic',
// 更新源地址
url: 'http://127.0.0.1:5173'
});
# HTTP GET http://127.0.0.1:5173/latest.yml
version: 1.0.2
files:
url: http://localhost:5173/healthybd-ytj-1.0.0-Setup.exe
sha512: 5ca8d0f2e2440782d1e2f7dcb081a65430e1571a9e764c3fc74f034944499afb0422b5ffb755274f866902e0d04f8acb7e073dfc43c452de9f8566199dd1368b
path: http://localhost:5173/healthybd-ytj-1.0.0-Setup.exe
2.检测更新
import { autoUpdater } from 'electron-updater';
autoUpdater.autoDownload = true;
autoUpdater.checkForUpdatesAndNotify()
autoUpdater.forceDevUpdateConfig = true
# dev-app-update.yml
provider: generic
updaterCacheDirName: demo-updatar
const config: ForgeConfig = {
packagerConfig: {
extraResource: ['./app-update.yml'],
},
}