electron-incremental-update 1.3.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,9 @@
1
- import { U as UpdateInfo, a as UpdateJSON } from './pure-GoN_3MEj.cjs';
1
+ import { U as UpdateJSON } from './version-CffZWDhZ.cjs';
2
+ import { O as OnDownloading, U as URLHandler, I as IProvider } from './types-DxPmQmaq.cjs';
3
+ import '@subframe7536/type-utils';
2
4
 
3
5
  declare const ErrorInfo: {
4
- readonly downlaod: "Download failed";
6
+ readonly download: "Download failed";
5
7
  readonly validate: "Validate failed";
6
8
  readonly param: "Missing params";
7
9
  readonly version: "Unsatisfied version";
@@ -9,114 +11,52 @@ declare const ErrorInfo: {
9
11
  declare class UpdaterError extends Error {
10
12
  constructor(msg: typeof ErrorInfo[keyof typeof ErrorInfo], info: string);
11
13
  }
12
- type CheckResult = UpdateInfo | undefined | UpdaterError;
13
- type DownloadResult = true | UpdaterError;
14
- type DownloadingInfo = {
15
- /**
16
- * downloaded percent, 0% - 100%
17
- */
18
- percent: `${number}%`;
19
- /**
20
- * total size
21
- */
22
- total: number;
23
- /**
24
- * downloaded size
25
- */
26
- current: number;
14
+ type CheckResult<T extends UpdateJSON> = {
15
+ success: true;
16
+ data: Omit<T, 'beta'>;
17
+ } | {
18
+ success: false;
19
+ /**
20
+ * minimal version that can update
21
+ */
22
+ data: string;
23
+ } | {
24
+ success: false;
25
+ data: UpdaterError;
27
26
  };
28
- type Logger = {
27
+ type DownloadResult = {
28
+ success: true;
29
+ } | {
30
+ success: false;
31
+ data: UpdaterError;
32
+ };
33
+ interface Logger {
29
34
  info: (msg: string) => void;
30
35
  debug: (msg: string) => void;
31
36
  warn: (msg: string) => void;
32
- error: (msg: string, e?: Error) => void;
33
- };
34
- type UpdaterOverrideFunctions = {
35
- /**
36
- * custom version compare function
37
- * @param version1 old version string
38
- * @param version2 new version string
39
- * @returns if version1 < version2
40
- */
41
- isLowerVersion?: (version1: string, version2: string) => boolean | Promise<boolean>;
42
- /**
43
- * custom verify signature function
44
- * @param buffer file buffer
45
- * @param signature signature
46
- * @param cert certificate
47
- * @returns if signature is valid, returns the version or `true` , otherwise returns `false`
48
- */
49
- verifySignaure?: (buffer: Buffer, signature: string, cert: string) => string | false | Promise<string | false>;
50
- /**
51
- * custom download JSON function
52
- * @param url download url
53
- * @param header download header
54
- * @returns `UpdateJSON`
55
- */
56
- downloadJSON?: (url: string, headers: Record<string, any>) => Promise<UpdateJSON>;
57
- /**
58
- * custom download buffer function
59
- * @param url download url
60
- * @param headers download header
61
- * @param total precaculated file total size
62
- * @param onDownloading on downloading callback
63
- * @returns `Buffer`
64
- */
65
- downloadBuffer?: (url: string, headers: Record<string, any>, total: number, onDownloading?: (progress: DownloadingInfo) => void) => Promise<Buffer>;
66
- };
67
- type UpdaterDownloadConfig = {
68
- /**
69
- * download user agent
70
- * @default 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36'
71
- */
72
- userAgent?: string;
73
- /**
74
- * extra download header, `accept` and `user-agent` is set by default
75
- */
76
- extraHeader?: Record<string, string>;
77
- };
37
+ error: (msg: string, e?: unknown) => void;
38
+ }
78
39
  interface UpdaterOption {
79
40
  /**
80
41
  * public key of signature, which will be auto generated by plugin,
81
42
  * generate by `selfsigned` if not set
82
43
  */
83
44
  SIGNATURE_CERT?: string;
84
- /**
85
- * repository url, e.g. `https://github.com/electron/electron`
86
- *
87
- * you can use the `repository` in `package.json`
88
- *
89
- * if `updateJsonURL` or `releaseAsarURL` are absent,
90
- * `repository` will be used to determine the url
91
- */
92
- repository?: string;
93
- /**
94
- * URL of version info json
95
- * @default `${repository.replace('github.com', 'raw.githubusercontent.com')}/master/version.json`
96
- * @throws if `updateJsonURL` and `repository` are all not set
97
- */
98
- updateJsonURL?: string;
99
- /**
100
- * URL of release asar.gz
101
- * @default `${repository}/releases/download/v${version}/${app.name}-${version}.asar.gz`
102
- * @throws if `releaseAsarURL` and `repository` are all not set
103
- */
104
- releaseAsarURL?: string;
105
45
  /**
106
46
  * whether to receive beta update
107
47
  */
108
48
  receiveBeta?: boolean;
109
- overrideFunctions?: UpdaterOverrideFunctions;
110
- downloadConfig?: UpdaterDownloadConfig;
49
+ logger?: Logger;
111
50
  }
112
51
 
113
52
  declare class Updater {
114
53
  private CERT;
115
54
  private info?;
116
- private option;
55
+ private options;
117
56
  private asarPath;
118
57
  private gzipPath;
119
58
  private tmpFilePath;
59
+ private provider;
120
60
  /**
121
61
  * updater logger
122
62
  */
@@ -129,7 +69,15 @@ declare class Updater {
129
69
  * console.log(`download progress: ${percent}, total: ${total}, current: ${current}`)
130
70
  * }
131
71
  */
132
- onDownloading?: (progress: DownloadingInfo) => void;
72
+ onDownloading?: OnDownloading;
73
+ /**
74
+ * URL handler hook
75
+ *
76
+ * for Github, there are some {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L34 public CDN links}
77
+ * @param url source url
78
+ * @param isDownloadAsar whether is download asar
79
+ */
80
+ handleURL?: URLHandler;
133
81
  /**
134
82
  * whether receive beta version
135
83
  */
@@ -137,9 +85,10 @@ declare class Updater {
137
85
  set receiveBeta(receiveBeta: boolean);
138
86
  /**
139
87
  * initialize incremental updater
88
+ * @param provider update provider
140
89
  * @param option UpdaterOption
141
90
  */
142
- constructor(option?: UpdaterOption);
91
+ constructor(provider: IProvider, option?: UpdaterOption);
143
92
  private needUpdate;
144
93
  /**
145
94
  * this function is used to parse download data.
@@ -155,52 +104,31 @@ declare class Updater {
155
104
  private parseData;
156
105
  /**
157
106
  * check update info using default options
158
- * @returns
159
- * - Available: `{size: number, version: string}`
160
- * - Unavailable: `undefined`
161
- * - Fail: `UpdaterError`
162
107
  */
163
- checkUpdate(): Promise<CheckResult>;
108
+ checkUpdate<T extends UpdateJSON>(): Promise<CheckResult<T>>;
164
109
  /**
165
110
  * check update info using custom url
166
111
  * @param url custom download URL of `updatejson`
167
- * @returns
168
- * - Available:`{size: number, version: string}`
169
- * - Unavailable: `undefined`
170
- * - Fail: `UpdaterError`
171
112
  */
172
- checkUpdate(url: string): Promise<CheckResult>;
113
+ checkUpdate<T extends UpdateJSON>(url: string): Promise<CheckResult<T>>;
173
114
  /**
174
115
  * check update info using existing update json
175
116
  * @param data existing update json
176
- * @returns
177
- * - Available:`{size: number, version: string}`
178
- * - Unavailable: `undefined`
179
- * - Fail: `UpdaterError`
180
117
  */
181
- checkUpdate(data: UpdateJSON): Promise<CheckResult>;
118
+ checkUpdate<T extends UpdateJSON>(data: T): Promise<CheckResult<T>>;
182
119
  /**
183
120
  * download update using default options
184
- * @returns
185
- * - Success: `true`
186
- * - Fail: `UpdaterError`
187
121
  */
188
122
  download(): Promise<DownloadResult>;
189
123
  /**
190
124
  * download update using custom url
191
125
  * @param url custom download URL
192
- * @returns
193
- * - Success: `true`
194
- * - Fail: `UpdaterError`
195
126
  */
196
127
  download(url: string): Promise<DownloadResult>;
197
128
  /**
198
129
  * download update using existing `asar.gz` buffer and signature
199
130
  * @param data existing `asar.gz` buffer
200
131
  * @param sig signature
201
- * @returns
202
- * - Success: `true`
203
- * - Fail: `UpdaterError`
204
132
  */
205
133
  download(data: Buffer, sig: string): Promise<DownloadResult>;
206
134
  /**
@@ -209,63 +137,42 @@ declare class Updater {
209
137
  quitAndInstall(): void;
210
138
  }
211
139
 
212
- type Func = Required<UpdaterOverrideFunctions>;
213
- declare const downloadJSONDefault: Func['downloadJSON'];
214
- declare const downloadBufferDefault: Func['downloadBuffer'];
215
-
216
- declare const isLowerVersionDefault: Func['isLowerVersion'];
217
-
140
+ type Promisable<T> = T | Promise<T>;
218
141
  /**
219
- * create updater instance
220
- * @param option updater option
221
- * @returns updater
142
+ * hooks on rename temp asar path to `${app.name}.asar`
143
+ * @param install `() => renameSync(tempAsarPath, appNameAsarPath)`
144
+ * @param tempAsarPath temp(updated) asar path
145
+ * @param appNameAsarPath `${app.name}.asar` path
146
+ * @param logger logger
147
+ * @default install(); logger.info(`update success!`)
222
148
  */
223
- declare function createUpdater(option?: UpdaterOption): Updater;
224
-
225
- type Promisable<T> = T | Promise<T>;
226
- type OnInstallFunction = (install: VoidFunction, tempAsarPath: string, appNameAsarPath: string, logger?: Logger) => Promisable<void>;
227
- type AppOption = {
149
+ type OnInstallFunction = (install: VoidFunction, tempAsarPath: string, appNameAsarPath: string, logger: Logger) => Promisable<void>;
150
+ interface AppOption {
151
+ /**
152
+ * update provider
153
+ */
154
+ provider: IProvider;
228
155
  /**
229
156
  * updater options
230
157
  */
231
158
  updater?: (() => Promisable<Updater>) | UpdaterOption;
232
159
  /**
233
- * path of electron output dist when in development
234
- * @default '../dist-electron'
160
+ * hooks on rename temp asar path to `${app.name}.asar`
235
161
  */
236
- electronDevDistPath?: string;
162
+ onInstall?: OnInstallFunction;
237
163
  /**
238
- * relative path of main entry in electron dist
239
- * @default 'main/index.js'
164
+ * hooks before app start up
165
+ * @param mainFilePath main file path of `${app.name}.asar`
166
+ * @param logger logger
240
167
  */
241
- mainPath?: string;
168
+ beforeStart?: (mainFilePath: string, logger: Logger) => Promisable<void>;
242
169
  /**
243
- * update hooks
170
+ * hooks on app start up error
171
+ * @param err installing or startup error
172
+ * @param logger logger
244
173
  */
245
- hooks?: {
246
- /**
247
- * hooks on rename temp asar path to `${app.name}.asar`
248
- * @param install `() => renameSync(tempAsarPath, appNameAsarPath)`
249
- * @param tempAsarPath temp(updated) asar path
250
- * @param appNameAsarPath `${app.name}.asar` path
251
- * @param logger logger
252
- * @default install(); logger?.info(`update success!`)
253
- */
254
- onInstall?: OnInstallFunction;
255
- /**
256
- * hooks before start
257
- * @param appNameAsarPath path of `${app.name}.asar`
258
- * @param logger logger
259
- */
260
- beforeStart?: (appNameAsarPath: string, logger?: Logger) => Promisable<void>;
261
- /**
262
- * hooks on start up error
263
- * @param err installing or startup error
264
- * @param logger logger
265
- */
266
- onStartError?: (err: unknown, logger?: Logger) => void;
267
- };
268
- };
174
+ onStartError?: (err: unknown, logger: Logger) => void;
175
+ }
269
176
  /**
270
177
  * utils for startuping with updater
271
178
  * @param fn startup function
@@ -299,6 +206,6 @@ declare function startupWithUpdater(fn: (updater: Updater) => Promisable<void>):
299
206
  * })
300
207
  * ```
301
208
  */
302
- declare function initApp(appOptions?: AppOption): Promise<void>;
209
+ declare function initApp(appOptions: AppOption): Promise<void>;
303
210
 
304
- export { type AppOption, type CheckResult, type DownloadResult, type DownloadingInfo, ErrorInfo, type Func, type Logger, Updater, type UpdaterDownloadConfig, UpdaterError, type UpdaterOption, type UpdaterOverrideFunctions, createUpdater, downloadBufferDefault, downloadJSONDefault, initApp, isLowerVersionDefault, startupWithUpdater };
211
+ export { type AppOption, type CheckResult, type DownloadResult, ErrorInfo, type Logger, Updater, UpdaterError, type UpdaterOption, initApp, startupWithUpdater };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { U as UpdateInfo, a as UpdateJSON } from './pure-GoN_3MEj.js';
1
+ import { U as UpdateJSON } from './version-CffZWDhZ.js';
2
+ import { O as OnDownloading, U as URLHandler, I as IProvider } from './types-seJf3Wbc.js';
3
+ import '@subframe7536/type-utils';
2
4
 
3
5
  declare const ErrorInfo: {
4
- readonly downlaod: "Download failed";
6
+ readonly download: "Download failed";
5
7
  readonly validate: "Validate failed";
6
8
  readonly param: "Missing params";
7
9
  readonly version: "Unsatisfied version";
@@ -9,114 +11,52 @@ declare const ErrorInfo: {
9
11
  declare class UpdaterError extends Error {
10
12
  constructor(msg: typeof ErrorInfo[keyof typeof ErrorInfo], info: string);
11
13
  }
12
- type CheckResult = UpdateInfo | undefined | UpdaterError;
13
- type DownloadResult = true | UpdaterError;
14
- type DownloadingInfo = {
15
- /**
16
- * downloaded percent, 0% - 100%
17
- */
18
- percent: `${number}%`;
19
- /**
20
- * total size
21
- */
22
- total: number;
23
- /**
24
- * downloaded size
25
- */
26
- current: number;
14
+ type CheckResult<T extends UpdateJSON> = {
15
+ success: true;
16
+ data: Omit<T, 'beta'>;
17
+ } | {
18
+ success: false;
19
+ /**
20
+ * minimal version that can update
21
+ */
22
+ data: string;
23
+ } | {
24
+ success: false;
25
+ data: UpdaterError;
27
26
  };
28
- type Logger = {
27
+ type DownloadResult = {
28
+ success: true;
29
+ } | {
30
+ success: false;
31
+ data: UpdaterError;
32
+ };
33
+ interface Logger {
29
34
  info: (msg: string) => void;
30
35
  debug: (msg: string) => void;
31
36
  warn: (msg: string) => void;
32
- error: (msg: string, e?: Error) => void;
33
- };
34
- type UpdaterOverrideFunctions = {
35
- /**
36
- * custom version compare function
37
- * @param version1 old version string
38
- * @param version2 new version string
39
- * @returns if version1 < version2
40
- */
41
- isLowerVersion?: (version1: string, version2: string) => boolean | Promise<boolean>;
42
- /**
43
- * custom verify signature function
44
- * @param buffer file buffer
45
- * @param signature signature
46
- * @param cert certificate
47
- * @returns if signature is valid, returns the version or `true` , otherwise returns `false`
48
- */
49
- verifySignaure?: (buffer: Buffer, signature: string, cert: string) => string | false | Promise<string | false>;
50
- /**
51
- * custom download JSON function
52
- * @param url download url
53
- * @param header download header
54
- * @returns `UpdateJSON`
55
- */
56
- downloadJSON?: (url: string, headers: Record<string, any>) => Promise<UpdateJSON>;
57
- /**
58
- * custom download buffer function
59
- * @param url download url
60
- * @param headers download header
61
- * @param total precaculated file total size
62
- * @param onDownloading on downloading callback
63
- * @returns `Buffer`
64
- */
65
- downloadBuffer?: (url: string, headers: Record<string, any>, total: number, onDownloading?: (progress: DownloadingInfo) => void) => Promise<Buffer>;
66
- };
67
- type UpdaterDownloadConfig = {
68
- /**
69
- * download user agent
70
- * @default 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36'
71
- */
72
- userAgent?: string;
73
- /**
74
- * extra download header, `accept` and `user-agent` is set by default
75
- */
76
- extraHeader?: Record<string, string>;
77
- };
37
+ error: (msg: string, e?: unknown) => void;
38
+ }
78
39
  interface UpdaterOption {
79
40
  /**
80
41
  * public key of signature, which will be auto generated by plugin,
81
42
  * generate by `selfsigned` if not set
82
43
  */
83
44
  SIGNATURE_CERT?: string;
84
- /**
85
- * repository url, e.g. `https://github.com/electron/electron`
86
- *
87
- * you can use the `repository` in `package.json`
88
- *
89
- * if `updateJsonURL` or `releaseAsarURL` are absent,
90
- * `repository` will be used to determine the url
91
- */
92
- repository?: string;
93
- /**
94
- * URL of version info json
95
- * @default `${repository.replace('github.com', 'raw.githubusercontent.com')}/master/version.json`
96
- * @throws if `updateJsonURL` and `repository` are all not set
97
- */
98
- updateJsonURL?: string;
99
- /**
100
- * URL of release asar.gz
101
- * @default `${repository}/releases/download/v${version}/${app.name}-${version}.asar.gz`
102
- * @throws if `releaseAsarURL` and `repository` are all not set
103
- */
104
- releaseAsarURL?: string;
105
45
  /**
106
46
  * whether to receive beta update
107
47
  */
108
48
  receiveBeta?: boolean;
109
- overrideFunctions?: UpdaterOverrideFunctions;
110
- downloadConfig?: UpdaterDownloadConfig;
49
+ logger?: Logger;
111
50
  }
112
51
 
113
52
  declare class Updater {
114
53
  private CERT;
115
54
  private info?;
116
- private option;
55
+ private options;
117
56
  private asarPath;
118
57
  private gzipPath;
119
58
  private tmpFilePath;
59
+ private provider;
120
60
  /**
121
61
  * updater logger
122
62
  */
@@ -129,7 +69,15 @@ declare class Updater {
129
69
  * console.log(`download progress: ${percent}, total: ${total}, current: ${current}`)
130
70
  * }
131
71
  */
132
- onDownloading?: (progress: DownloadingInfo) => void;
72
+ onDownloading?: OnDownloading;
73
+ /**
74
+ * URL handler hook
75
+ *
76
+ * for Github, there are some {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L34 public CDN links}
77
+ * @param url source url
78
+ * @param isDownloadAsar whether is download asar
79
+ */
80
+ handleURL?: URLHandler;
133
81
  /**
134
82
  * whether receive beta version
135
83
  */
@@ -137,9 +85,10 @@ declare class Updater {
137
85
  set receiveBeta(receiveBeta: boolean);
138
86
  /**
139
87
  * initialize incremental updater
88
+ * @param provider update provider
140
89
  * @param option UpdaterOption
141
90
  */
142
- constructor(option?: UpdaterOption);
91
+ constructor(provider: IProvider, option?: UpdaterOption);
143
92
  private needUpdate;
144
93
  /**
145
94
  * this function is used to parse download data.
@@ -155,52 +104,31 @@ declare class Updater {
155
104
  private parseData;
156
105
  /**
157
106
  * check update info using default options
158
- * @returns
159
- * - Available: `{size: number, version: string}`
160
- * - Unavailable: `undefined`
161
- * - Fail: `UpdaterError`
162
107
  */
163
- checkUpdate(): Promise<CheckResult>;
108
+ checkUpdate<T extends UpdateJSON>(): Promise<CheckResult<T>>;
164
109
  /**
165
110
  * check update info using custom url
166
111
  * @param url custom download URL of `updatejson`
167
- * @returns
168
- * - Available:`{size: number, version: string}`
169
- * - Unavailable: `undefined`
170
- * - Fail: `UpdaterError`
171
112
  */
172
- checkUpdate(url: string): Promise<CheckResult>;
113
+ checkUpdate<T extends UpdateJSON>(url: string): Promise<CheckResult<T>>;
173
114
  /**
174
115
  * check update info using existing update json
175
116
  * @param data existing update json
176
- * @returns
177
- * - Available:`{size: number, version: string}`
178
- * - Unavailable: `undefined`
179
- * - Fail: `UpdaterError`
180
117
  */
181
- checkUpdate(data: UpdateJSON): Promise<CheckResult>;
118
+ checkUpdate<T extends UpdateJSON>(data: T): Promise<CheckResult<T>>;
182
119
  /**
183
120
  * download update using default options
184
- * @returns
185
- * - Success: `true`
186
- * - Fail: `UpdaterError`
187
121
  */
188
122
  download(): Promise<DownloadResult>;
189
123
  /**
190
124
  * download update using custom url
191
125
  * @param url custom download URL
192
- * @returns
193
- * - Success: `true`
194
- * - Fail: `UpdaterError`
195
126
  */
196
127
  download(url: string): Promise<DownloadResult>;
197
128
  /**
198
129
  * download update using existing `asar.gz` buffer and signature
199
130
  * @param data existing `asar.gz` buffer
200
131
  * @param sig signature
201
- * @returns
202
- * - Success: `true`
203
- * - Fail: `UpdaterError`
204
132
  */
205
133
  download(data: Buffer, sig: string): Promise<DownloadResult>;
206
134
  /**
@@ -209,63 +137,42 @@ declare class Updater {
209
137
  quitAndInstall(): void;
210
138
  }
211
139
 
212
- type Func = Required<UpdaterOverrideFunctions>;
213
- declare const downloadJSONDefault: Func['downloadJSON'];
214
- declare const downloadBufferDefault: Func['downloadBuffer'];
215
-
216
- declare const isLowerVersionDefault: Func['isLowerVersion'];
217
-
140
+ type Promisable<T> = T | Promise<T>;
218
141
  /**
219
- * create updater instance
220
- * @param option updater option
221
- * @returns updater
142
+ * hooks on rename temp asar path to `${app.name}.asar`
143
+ * @param install `() => renameSync(tempAsarPath, appNameAsarPath)`
144
+ * @param tempAsarPath temp(updated) asar path
145
+ * @param appNameAsarPath `${app.name}.asar` path
146
+ * @param logger logger
147
+ * @default install(); logger.info(`update success!`)
222
148
  */
223
- declare function createUpdater(option?: UpdaterOption): Updater;
224
-
225
- type Promisable<T> = T | Promise<T>;
226
- type OnInstallFunction = (install: VoidFunction, tempAsarPath: string, appNameAsarPath: string, logger?: Logger) => Promisable<void>;
227
- type AppOption = {
149
+ type OnInstallFunction = (install: VoidFunction, tempAsarPath: string, appNameAsarPath: string, logger: Logger) => Promisable<void>;
150
+ interface AppOption {
151
+ /**
152
+ * update provider
153
+ */
154
+ provider: IProvider;
228
155
  /**
229
156
  * updater options
230
157
  */
231
158
  updater?: (() => Promisable<Updater>) | UpdaterOption;
232
159
  /**
233
- * path of electron output dist when in development
234
- * @default '../dist-electron'
160
+ * hooks on rename temp asar path to `${app.name}.asar`
235
161
  */
236
- electronDevDistPath?: string;
162
+ onInstall?: OnInstallFunction;
237
163
  /**
238
- * relative path of main entry in electron dist
239
- * @default 'main/index.js'
164
+ * hooks before app start up
165
+ * @param mainFilePath main file path of `${app.name}.asar`
166
+ * @param logger logger
240
167
  */
241
- mainPath?: string;
168
+ beforeStart?: (mainFilePath: string, logger: Logger) => Promisable<void>;
242
169
  /**
243
- * update hooks
170
+ * hooks on app start up error
171
+ * @param err installing or startup error
172
+ * @param logger logger
244
173
  */
245
- hooks?: {
246
- /**
247
- * hooks on rename temp asar path to `${app.name}.asar`
248
- * @param install `() => renameSync(tempAsarPath, appNameAsarPath)`
249
- * @param tempAsarPath temp(updated) asar path
250
- * @param appNameAsarPath `${app.name}.asar` path
251
- * @param logger logger
252
- * @default install(); logger?.info(`update success!`)
253
- */
254
- onInstall?: OnInstallFunction;
255
- /**
256
- * hooks before start
257
- * @param appNameAsarPath path of `${app.name}.asar`
258
- * @param logger logger
259
- */
260
- beforeStart?: (appNameAsarPath: string, logger?: Logger) => Promisable<void>;
261
- /**
262
- * hooks on start up error
263
- * @param err installing or startup error
264
- * @param logger logger
265
- */
266
- onStartError?: (err: unknown, logger?: Logger) => void;
267
- };
268
- };
174
+ onStartError?: (err: unknown, logger: Logger) => void;
175
+ }
269
176
  /**
270
177
  * utils for startuping with updater
271
178
  * @param fn startup function
@@ -299,6 +206,6 @@ declare function startupWithUpdater(fn: (updater: Updater) => Promisable<void>):
299
206
  * })
300
207
  * ```
301
208
  */
302
- declare function initApp(appOptions?: AppOption): Promise<void>;
209
+ declare function initApp(appOptions: AppOption): Promise<void>;
303
210
 
304
- export { type AppOption, type CheckResult, type DownloadResult, type DownloadingInfo, ErrorInfo, type Func, type Logger, Updater, type UpdaterDownloadConfig, UpdaterError, type UpdaterOption, type UpdaterOverrideFunctions, createUpdater, downloadBufferDefault, downloadJSONDefault, initApp, isLowerVersionDefault, startupWithUpdater };
211
+ export { type AppOption, type CheckResult, type DownloadResult, ErrorInfo, type Logger, Updater, UpdaterError, type UpdaterOption, initApp, startupWithUpdater };