electron-incremental-update 1.2.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,128 +1,62 @@
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
- declare class MinimumVersionError extends Error {
4
- currentVersion: string;
5
- minVersion: string;
6
- constructor(version: string, minimumVersion: string);
7
- }
8
- declare class VerifyFailedError extends Error {
9
- signature: string;
10
- cert: string;
11
- constructor(signature: string, cert: string);
12
- }
13
- declare class DownloadError extends Error {
14
- constructor(msg: string);
5
+ declare const ErrorInfo: {
6
+ readonly download: "Download failed";
7
+ readonly validate: "Validate failed";
8
+ readonly param: "Missing params";
9
+ readonly version: "Unsatisfied version";
10
+ };
11
+ declare class UpdaterError extends Error {
12
+ constructor(msg: typeof ErrorInfo[keyof typeof ErrorInfo], info: string);
15
13
  }
16
- type CheckResult = UpdateInfo | undefined | CheckResultError;
17
- type CheckResultError = MinimumVersionError | DownloadError | TypeError | Error;
18
- type DownloadResult = true | DownloadResultError;
19
- type DownloadResultError = DownloadError | VerifyFailedError | TypeError | Error;
20
- type DownloadingInfo = {
21
- /**
22
- * downloaded percent, 0% - 100%
23
- */
24
- percent: `${number}%`;
25
- /**
26
- * total size
27
- */
28
- total: number;
29
- /**
30
- * downloaded size
31
- */
32
- 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;
33
26
  };
34
- type Logger = {
27
+ type DownloadResult = {
28
+ success: true;
29
+ } | {
30
+ success: false;
31
+ data: UpdaterError;
32
+ };
33
+ interface Logger {
35
34
  info: (msg: string) => void;
36
35
  debug: (msg: string) => void;
37
36
  warn: (msg: string) => void;
38
- error: (msg: string, e?: Error) => void;
39
- };
40
- type UpdaterOverrideFunctions = {
41
- /**
42
- * custom version compare function
43
- * @param version1 old version string
44
- * @param version2 new version string
45
- * @returns whether version1 < version2
46
- */
47
- compareVersion?: (version1: string, version2: string) => boolean | Promise<boolean>;
48
- /**
49
- * custom verify signature function
50
- * @param buffer file buffer
51
- * @param signature signature
52
- * @param cert certificate
53
- * @returns if signature is valid, returns the version or `true` , otherwise returns `false`
54
- */
55
- verifySignaure?: (buffer: Buffer, signature: string, cert: string) => string | false | Promise<string | false>;
56
- /**
57
- * custom download JSON function
58
- * @param url download url
59
- * @param header download header
60
- * @returns `UpdateJSON`
61
- */
62
- downloadJSON?: (url: string, headers: Record<string, any>) => Promise<UpdateJSON>;
63
- /**
64
- * custom download buffer function
65
- * @param url download url
66
- * @param headers download header
67
- * @param total precaculated file total size
68
- * @param onDownloading on downloading callback
69
- * @returns `Buffer`
70
- */
71
- downloadBuffer?: (url: string, headers: Record<string, any>, total: number, onDownloading?: (progress: DownloadingInfo) => void) => Promise<Buffer>;
72
- };
73
- type UpdaterDownloadConfig = {
74
- /**
75
- * download user agent
76
- * @default 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36'
77
- */
78
- userAgent?: string;
79
- /**
80
- * extra download header, `accept` and `user-agent` is set by default
81
- */
82
- extraHeader?: Record<string, string>;
83
- };
37
+ error: (msg: string, e?: unknown) => void;
38
+ }
84
39
  interface UpdaterOption {
85
40
  /**
86
41
  * public key of signature, which will be auto generated by plugin,
87
42
  * generate by `selfsigned` if not set
88
43
  */
89
44
  SIGNATURE_CERT?: string;
90
- /**
91
- * repository url, e.g. `https://github.com/electron/electron`
92
- *
93
- * you can use the `repository` in `package.json`
94
- *
95
- * if `updateJsonURL` or `releaseAsarURL` are absent,
96
- * `repository` will be used to determine the url
97
- */
98
- repository?: string;
99
- /**
100
- * URL of version info json
101
- * @default `${repository.replace('github.com', 'raw.githubusercontent.com')}/master/version.json`
102
- * @throws if `updateJsonURL` and `repository` are all not set
103
- */
104
- updateJsonURL?: string;
105
- /**
106
- * URL of release asar.gz
107
- * @default `${repository}/releases/download/v${version}/${app.name}-${version}.asar.gz`
108
- * @throws if `releaseAsarURL` and `repository` are all not set
109
- */
110
- releaseAsarURL?: string;
111
45
  /**
112
46
  * whether to receive beta update
113
47
  */
114
48
  receiveBeta?: boolean;
115
- overrideFunctions?: UpdaterOverrideFunctions;
116
- downloadConfig?: UpdaterDownloadConfig;
49
+ logger?: Logger;
117
50
  }
118
51
 
119
52
  declare class Updater {
120
53
  private CERT;
121
54
  private info?;
122
- private option;
55
+ private options;
123
56
  private asarPath;
124
57
  private gzipPath;
125
58
  private tmpFilePath;
59
+ private provider;
126
60
  /**
127
61
  * updater logger
128
62
  */
@@ -135,7 +69,15 @@ declare class Updater {
135
69
  * console.log(`download progress: ${percent}, total: ${total}, current: ${current}`)
136
70
  * }
137
71
  */
138
- 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;
139
81
  /**
140
82
  * whether receive beta version
141
83
  */
@@ -143,9 +85,10 @@ declare class Updater {
143
85
  set receiveBeta(receiveBeta: boolean);
144
86
  /**
145
87
  * initialize incremental updater
88
+ * @param provider update provider
146
89
  * @param option UpdaterOption
147
90
  */
148
- constructor(option?: UpdaterOption);
91
+ constructor(provider: IProvider, option?: UpdaterOption);
149
92
  private needUpdate;
150
93
  /**
151
94
  * this function is used to parse download data.
@@ -160,84 +103,76 @@ declare class Updater {
160
103
  */
161
104
  private parseData;
162
105
  /**
163
- * check update info
164
- *
165
- * if you want to update **offline**, you can set `data` and `sig` add update info
166
- * @param data custom download URL of `updatejson` or existing update json
167
- * @returns
168
- * - Available:`{size: number, version: string}`
169
- * - Unavailable: `undefined`
170
- * - Fail: `CheckResultError`
106
+ * check update info using default options
171
107
  */
172
- checkUpdate(data?: string | UpdateJSON): Promise<CheckResult>;
108
+ checkUpdate<T extends UpdateJSON>(): Promise<CheckResult<T>>;
173
109
  /**
174
- * download update
175
- *
176
- * if you want to update **offline**, you can set both `data` and `sig` to verify and install
177
- * @param data custom download URL of `asar.gz` or existing `asar.gz` buffer
110
+ * check update info using custom url
111
+ * @param url custom download URL of `updatejson`
112
+ */
113
+ checkUpdate<T extends UpdateJSON>(url: string): Promise<CheckResult<T>>;
114
+ /**
115
+ * check update info using existing update json
116
+ * @param data existing update json
117
+ */
118
+ checkUpdate<T extends UpdateJSON>(data: T): Promise<CheckResult<T>>;
119
+ /**
120
+ * download update using default options
121
+ */
122
+ download(): Promise<DownloadResult>;
123
+ /**
124
+ * download update using custom url
125
+ * @param url custom download URL
126
+ */
127
+ download(url: string): Promise<DownloadResult>;
128
+ /**
129
+ * download update using existing `asar.gz` buffer and signature
130
+ * @param data existing `asar.gz` buffer
178
131
  * @param sig signature
179
- * @returns
180
- * - `true`: success
181
- * - `DownloadResultError`: fail
182
132
  */
183
- download(data?: Buffer, sig?: string): Promise<DownloadResult>;
133
+ download(data: Buffer, sig: string): Promise<DownloadResult>;
184
134
  /**
185
135
  * quit App and install
186
136
  */
187
137
  quitAndInstall(): void;
188
138
  }
189
139
 
140
+ type Promisable<T> = T | Promise<T>;
190
141
  /**
191
- * create updater instance
192
- * @param option updater option
193
- * @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!`)
194
148
  */
195
- declare function createUpdater(option?: UpdaterOption): Updater;
196
-
197
- type Promisable<T> = T | Promise<T>;
198
- type OnInstallFunction = (install: VoidFunction, tempAsarPath: string, appNameAsarPath: string, logger?: Logger) => Promisable<void>;
199
- 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;
200
155
  /**
201
156
  * updater options
202
157
  */
203
158
  updater?: (() => Promisable<Updater>) | UpdaterOption;
204
159
  /**
205
- * path of electron output dist when in development
206
- * @default '../dist-electron'
160
+ * hooks on rename temp asar path to `${app.name}.asar`
207
161
  */
208
- electronDevDistPath?: string;
162
+ onInstall?: OnInstallFunction;
209
163
  /**
210
- * relative path of main entry in electron dist
211
- * @default 'main/index.js'
164
+ * hooks before app start up
165
+ * @param mainFilePath main file path of `${app.name}.asar`
166
+ * @param logger logger
212
167
  */
213
- mainPath?: string;
168
+ beforeStart?: (mainFilePath: string, logger: Logger) => Promisable<void>;
214
169
  /**
215
- * update hooks
170
+ * hooks on app start up error
171
+ * @param err installing or startup error
172
+ * @param logger logger
216
173
  */
217
- hooks?: {
218
- /**
219
- * hooks on rename temp asar path to `${app.name}.asar`
220
- * @param install `() => renameSync(tempAsarPath, appNameAsarPath)`
221
- * @param tempAsarPath temp(updated) asar path
222
- * @param appNameAsarPath `${app.name}.asar` path
223
- * @param logger logger
224
- * @default install(); logger?.info(`update success!`)
225
- */
226
- onInstall?: OnInstallFunction;
227
- /**
228
- * hooks before start
229
- * @param appNameAsarPath path of `${app.name}.asar`
230
- * @param logger logger
231
- */
232
- beforeStart?: (appNameAsarPath: string, logger?: Logger) => Promisable<void>;
233
- /**
234
- * hooks on start up error
235
- * @param err installing or startup error
236
- * @param logger logger
237
- */
238
- onStartError?: (err: unknown, logger?: Logger) => void;
239
- };
240
- };
174
+ onStartError?: (err: unknown, logger: Logger) => void;
175
+ }
241
176
  /**
242
177
  * utils for startuping with updater
243
178
  * @param fn startup function
@@ -271,6 +206,6 @@ declare function startupWithUpdater(fn: (updater: Updater) => Promisable<void>):
271
206
  * })
272
207
  * ```
273
208
  */
274
- declare function initApp(appOptions?: AppOption): Promise<void>;
209
+ declare function initApp(appOptions: AppOption): Promise<void>;
275
210
 
276
- export { type AppOption, type CheckResult, type CheckResultError, DownloadError, type DownloadResult, type DownloadResultError, type DownloadingInfo, type Logger, MinimumVersionError, Updater, type UpdaterDownloadConfig, type UpdaterOption, type UpdaterOverrideFunctions, VerifyFailedError, createUpdater, initApp, 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,128 +1,62 @@
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
- declare class MinimumVersionError extends Error {
4
- currentVersion: string;
5
- minVersion: string;
6
- constructor(version: string, minimumVersion: string);
7
- }
8
- declare class VerifyFailedError extends Error {
9
- signature: string;
10
- cert: string;
11
- constructor(signature: string, cert: string);
12
- }
13
- declare class DownloadError extends Error {
14
- constructor(msg: string);
5
+ declare const ErrorInfo: {
6
+ readonly download: "Download failed";
7
+ readonly validate: "Validate failed";
8
+ readonly param: "Missing params";
9
+ readonly version: "Unsatisfied version";
10
+ };
11
+ declare class UpdaterError extends Error {
12
+ constructor(msg: typeof ErrorInfo[keyof typeof ErrorInfo], info: string);
15
13
  }
16
- type CheckResult = UpdateInfo | undefined | CheckResultError;
17
- type CheckResultError = MinimumVersionError | DownloadError | TypeError | Error;
18
- type DownloadResult = true | DownloadResultError;
19
- type DownloadResultError = DownloadError | VerifyFailedError | TypeError | Error;
20
- type DownloadingInfo = {
21
- /**
22
- * downloaded percent, 0% - 100%
23
- */
24
- percent: `${number}%`;
25
- /**
26
- * total size
27
- */
28
- total: number;
29
- /**
30
- * downloaded size
31
- */
32
- 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;
33
26
  };
34
- type Logger = {
27
+ type DownloadResult = {
28
+ success: true;
29
+ } | {
30
+ success: false;
31
+ data: UpdaterError;
32
+ };
33
+ interface Logger {
35
34
  info: (msg: string) => void;
36
35
  debug: (msg: string) => void;
37
36
  warn: (msg: string) => void;
38
- error: (msg: string, e?: Error) => void;
39
- };
40
- type UpdaterOverrideFunctions = {
41
- /**
42
- * custom version compare function
43
- * @param version1 old version string
44
- * @param version2 new version string
45
- * @returns whether version1 < version2
46
- */
47
- compareVersion?: (version1: string, version2: string) => boolean | Promise<boolean>;
48
- /**
49
- * custom verify signature function
50
- * @param buffer file buffer
51
- * @param signature signature
52
- * @param cert certificate
53
- * @returns if signature is valid, returns the version or `true` , otherwise returns `false`
54
- */
55
- verifySignaure?: (buffer: Buffer, signature: string, cert: string) => string | false | Promise<string | false>;
56
- /**
57
- * custom download JSON function
58
- * @param url download url
59
- * @param header download header
60
- * @returns `UpdateJSON`
61
- */
62
- downloadJSON?: (url: string, headers: Record<string, any>) => Promise<UpdateJSON>;
63
- /**
64
- * custom download buffer function
65
- * @param url download url
66
- * @param headers download header
67
- * @param total precaculated file total size
68
- * @param onDownloading on downloading callback
69
- * @returns `Buffer`
70
- */
71
- downloadBuffer?: (url: string, headers: Record<string, any>, total: number, onDownloading?: (progress: DownloadingInfo) => void) => Promise<Buffer>;
72
- };
73
- type UpdaterDownloadConfig = {
74
- /**
75
- * download user agent
76
- * @default 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36'
77
- */
78
- userAgent?: string;
79
- /**
80
- * extra download header, `accept` and `user-agent` is set by default
81
- */
82
- extraHeader?: Record<string, string>;
83
- };
37
+ error: (msg: string, e?: unknown) => void;
38
+ }
84
39
  interface UpdaterOption {
85
40
  /**
86
41
  * public key of signature, which will be auto generated by plugin,
87
42
  * generate by `selfsigned` if not set
88
43
  */
89
44
  SIGNATURE_CERT?: string;
90
- /**
91
- * repository url, e.g. `https://github.com/electron/electron`
92
- *
93
- * you can use the `repository` in `package.json`
94
- *
95
- * if `updateJsonURL` or `releaseAsarURL` are absent,
96
- * `repository` will be used to determine the url
97
- */
98
- repository?: string;
99
- /**
100
- * URL of version info json
101
- * @default `${repository.replace('github.com', 'raw.githubusercontent.com')}/master/version.json`
102
- * @throws if `updateJsonURL` and `repository` are all not set
103
- */
104
- updateJsonURL?: string;
105
- /**
106
- * URL of release asar.gz
107
- * @default `${repository}/releases/download/v${version}/${app.name}-${version}.asar.gz`
108
- * @throws if `releaseAsarURL` and `repository` are all not set
109
- */
110
- releaseAsarURL?: string;
111
45
  /**
112
46
  * whether to receive beta update
113
47
  */
114
48
  receiveBeta?: boolean;
115
- overrideFunctions?: UpdaterOverrideFunctions;
116
- downloadConfig?: UpdaterDownloadConfig;
49
+ logger?: Logger;
117
50
  }
118
51
 
119
52
  declare class Updater {
120
53
  private CERT;
121
54
  private info?;
122
- private option;
55
+ private options;
123
56
  private asarPath;
124
57
  private gzipPath;
125
58
  private tmpFilePath;
59
+ private provider;
126
60
  /**
127
61
  * updater logger
128
62
  */
@@ -135,7 +69,15 @@ declare class Updater {
135
69
  * console.log(`download progress: ${percent}, total: ${total}, current: ${current}`)
136
70
  * }
137
71
  */
138
- 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;
139
81
  /**
140
82
  * whether receive beta version
141
83
  */
@@ -143,9 +85,10 @@ declare class Updater {
143
85
  set receiveBeta(receiveBeta: boolean);
144
86
  /**
145
87
  * initialize incremental updater
88
+ * @param provider update provider
146
89
  * @param option UpdaterOption
147
90
  */
148
- constructor(option?: UpdaterOption);
91
+ constructor(provider: IProvider, option?: UpdaterOption);
149
92
  private needUpdate;
150
93
  /**
151
94
  * this function is used to parse download data.
@@ -160,84 +103,76 @@ declare class Updater {
160
103
  */
161
104
  private parseData;
162
105
  /**
163
- * check update info
164
- *
165
- * if you want to update **offline**, you can set `data` and `sig` add update info
166
- * @param data custom download URL of `updatejson` or existing update json
167
- * @returns
168
- * - Available:`{size: number, version: string}`
169
- * - Unavailable: `undefined`
170
- * - Fail: `CheckResultError`
106
+ * check update info using default options
171
107
  */
172
- checkUpdate(data?: string | UpdateJSON): Promise<CheckResult>;
108
+ checkUpdate<T extends UpdateJSON>(): Promise<CheckResult<T>>;
173
109
  /**
174
- * download update
175
- *
176
- * if you want to update **offline**, you can set both `data` and `sig` to verify and install
177
- * @param data custom download URL of `asar.gz` or existing `asar.gz` buffer
110
+ * check update info using custom url
111
+ * @param url custom download URL of `updatejson`
112
+ */
113
+ checkUpdate<T extends UpdateJSON>(url: string): Promise<CheckResult<T>>;
114
+ /**
115
+ * check update info using existing update json
116
+ * @param data existing update json
117
+ */
118
+ checkUpdate<T extends UpdateJSON>(data: T): Promise<CheckResult<T>>;
119
+ /**
120
+ * download update using default options
121
+ */
122
+ download(): Promise<DownloadResult>;
123
+ /**
124
+ * download update using custom url
125
+ * @param url custom download URL
126
+ */
127
+ download(url: string): Promise<DownloadResult>;
128
+ /**
129
+ * download update using existing `asar.gz` buffer and signature
130
+ * @param data existing `asar.gz` buffer
178
131
  * @param sig signature
179
- * @returns
180
- * - `true`: success
181
- * - `DownloadResultError`: fail
182
132
  */
183
- download(data?: Buffer, sig?: string): Promise<DownloadResult>;
133
+ download(data: Buffer, sig: string): Promise<DownloadResult>;
184
134
  /**
185
135
  * quit App and install
186
136
  */
187
137
  quitAndInstall(): void;
188
138
  }
189
139
 
140
+ type Promisable<T> = T | Promise<T>;
190
141
  /**
191
- * create updater instance
192
- * @param option updater option
193
- * @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!`)
194
148
  */
195
- declare function createUpdater(option?: UpdaterOption): Updater;
196
-
197
- type Promisable<T> = T | Promise<T>;
198
- type OnInstallFunction = (install: VoidFunction, tempAsarPath: string, appNameAsarPath: string, logger?: Logger) => Promisable<void>;
199
- 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;
200
155
  /**
201
156
  * updater options
202
157
  */
203
158
  updater?: (() => Promisable<Updater>) | UpdaterOption;
204
159
  /**
205
- * path of electron output dist when in development
206
- * @default '../dist-electron'
160
+ * hooks on rename temp asar path to `${app.name}.asar`
207
161
  */
208
- electronDevDistPath?: string;
162
+ onInstall?: OnInstallFunction;
209
163
  /**
210
- * relative path of main entry in electron dist
211
- * @default 'main/index.js'
164
+ * hooks before app start up
165
+ * @param mainFilePath main file path of `${app.name}.asar`
166
+ * @param logger logger
212
167
  */
213
- mainPath?: string;
168
+ beforeStart?: (mainFilePath: string, logger: Logger) => Promisable<void>;
214
169
  /**
215
- * update hooks
170
+ * hooks on app start up error
171
+ * @param err installing or startup error
172
+ * @param logger logger
216
173
  */
217
- hooks?: {
218
- /**
219
- * hooks on rename temp asar path to `${app.name}.asar`
220
- * @param install `() => renameSync(tempAsarPath, appNameAsarPath)`
221
- * @param tempAsarPath temp(updated) asar path
222
- * @param appNameAsarPath `${app.name}.asar` path
223
- * @param logger logger
224
- * @default install(); logger?.info(`update success!`)
225
- */
226
- onInstall?: OnInstallFunction;
227
- /**
228
- * hooks before start
229
- * @param appNameAsarPath path of `${app.name}.asar`
230
- * @param logger logger
231
- */
232
- beforeStart?: (appNameAsarPath: string, logger?: Logger) => Promisable<void>;
233
- /**
234
- * hooks on start up error
235
- * @param err installing or startup error
236
- * @param logger logger
237
- */
238
- onStartError?: (err: unknown, logger?: Logger) => void;
239
- };
240
- };
174
+ onStartError?: (err: unknown, logger: Logger) => void;
175
+ }
241
176
  /**
242
177
  * utils for startuping with updater
243
178
  * @param fn startup function
@@ -271,6 +206,6 @@ declare function startupWithUpdater(fn: (updater: Updater) => Promisable<void>):
271
206
  * })
272
207
  * ```
273
208
  */
274
- declare function initApp(appOptions?: AppOption): Promise<void>;
209
+ declare function initApp(appOptions: AppOption): Promise<void>;
275
210
 
276
- export { type AppOption, type CheckResult, type CheckResultError, DownloadError, type DownloadResult, type DownloadResultError, type DownloadingInfo, type Logger, MinimumVersionError, Updater, type UpdaterDownloadConfig, type UpdaterOption, type UpdaterOverrideFunctions, VerifyFailedError, createUpdater, initApp, startupWithUpdater };
211
+ export { type AppOption, type CheckResult, type DownloadResult, ErrorInfo, type Logger, Updater, UpdaterError, type UpdaterOption, initApp, startupWithUpdater };