Skip to content

Commit

Permalink
chore: update electron builder / updater
Browse files Browse the repository at this point in the history
  • Loading branch information
meowtec committed Aug 21, 2022
1 parent 7320206 commit 0112bcb
Show file tree
Hide file tree
Showing 4 changed files with 974 additions and 1,100 deletions.
5 changes: 2 additions & 3 deletions modules/backend/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import { autoUpdater } from 'electron-updater'
import log from 'electron-log'
import {
IpcChannel,
IUpdateInfo,
} from '../common/types'
import app from './app'

autoUpdater.logger = log
autoUpdater.autoDownload = false

autoUpdater.on('update-available', async (info: IUpdateInfo) => {
log.info('update available', info.version, info.path)
autoUpdater.on('update-available', async (info) => {
log.info('update available', info.version, info.files)

await app.ready

Expand Down
17 changes: 5 additions & 12 deletions modules/common/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { UpdateInfo } from 'electron-updater'

// eslint-disable-next-line @typescript-eslint/ban-types
export type Empty = {}

Expand Down Expand Up @@ -85,16 +87,7 @@ export interface IBackendState {
aloneMode: boolean
}

export interface IUpdateInfo {
path: string
githubArtifactName: string
releaseName: string
releaseNotes: string
releaseDate: string
sha512: string
stagingPercentage: number
version: string
}
export type IUpdateInfo = UpdateInfo

export interface IDefaultOptions {
jpg: IOptimizeOptions
Expand All @@ -104,7 +97,7 @@ export interface IDefaultOptions {

export interface IGlobals {
activeId?: string
updateInfo?: IUpdateInfo
updateInfo?: UpdateInfo
optionsVisible: boolean
defaultOptions: IDefaultOptions
}
Expand All @@ -131,5 +124,5 @@ export interface MainIpcPayload {
[IpcChannel.SAVE]: SaveType;
[IpcChannel.SAVED]: SaveType;
[IpcChannel.FILE_SELECTED]: IImageFile[];
[IpcChannel.APP_UPDATE]: IUpdateInfo;
[IpcChannel.APP_UPDATE]: UpdateInfo;
}
Loading

0 comments on commit 0112bcb

Please sign in to comment.