electron-incremental-update 0.8.1 → 0.8.3
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/README.md +90 -87
- package/dist/{chunk-4TION32M.mjs → chunk-7R4GHFED.mjs} +15 -9
- package/dist/{chunk-Q2K52LOG.mjs → chunk-GXZSAUBR.mjs} +0 -1
- package/dist/index.d.mts +40 -30
- package/dist/index.d.ts +40 -30
- package/dist/index.js +55 -47
- package/dist/index.mjs +34 -37
- package/dist/utils.d.mts +8 -1
- package/dist/utils.d.ts +8 -1
- package/dist/utils.js +26 -9
- package/dist/utils.mjs +3 -1
- package/dist/vite.d.mts +0 -1
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +39 -17
- package/dist/vite.mjs +20 -12
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
## electron incremental updater
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This project provide a vite plugin, `Updater` class and some useful functions to generate incremental update.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
There will be two asar in production, `app.asar` and `main.asar` (if "main" is your app's name).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The `app.asar` is used to load `main.asar` and initialize the `updater`. Also, all the **native modules**, which are set as `dependencies` in `package.json`, will be packaged into `app.asar` by `electron-builder`, [see usage](#use-native-modules).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
using RSA + Signature to sign the new `main.asar` downloaded from remote and replace the old one when verified
|
|
9
|
+
The new `main.asar` downloaded from remote will be verified by presigned RSA + Signature. When pass the check and restart, the old `main.asar` will be replaced by the new one. Hooks like `beforeDoUpdate` are provided.
|
|
12
10
|
|
|
13
11
|
- inspired by Obsidian's update strategy
|
|
14
12
|
|
|
15
13
|
### notice
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
- this plugin is developed with [vite-plugin-electron](https://github.com/electron-vite/vite-plugin-electron), and may be effect in other electron vite frameworks
|
|
16
|
+
- **all options are documented in the jsdoc**
|
|
17
|
+
- entry file's EOL will force to `\n`
|
|
20
18
|
|
|
21
19
|
## install
|
|
22
20
|
|
|
@@ -33,7 +31,7 @@ yarn add electron-incremental-update
|
|
|
33
31
|
pnpm add electron-incremental-update
|
|
34
32
|
```
|
|
35
33
|
|
|
36
|
-
##
|
|
34
|
+
## setup
|
|
37
35
|
|
|
38
36
|
base on [electron-vite-vue](https://github.com/electron-vite/electron-vite-vue)
|
|
39
37
|
|
|
@@ -52,7 +50,6 @@ src
|
|
|
52
50
|
|
|
53
51
|
### setup app
|
|
54
52
|
|
|
55
|
-
|
|
56
53
|
```ts
|
|
57
54
|
// electron/app.ts
|
|
58
55
|
import { getGithubReleaseCdnGroup, initApp, parseGithubCdnURL } from 'electron-incremental-update'
|
|
@@ -74,80 +71,11 @@ initApp({ onStart: console.log })
|
|
|
74
71
|
})
|
|
75
72
|
```
|
|
76
73
|
|
|
77
|
-
### usage in main process
|
|
78
|
-
|
|
79
|
-
To utilize the electron `net` module for requesting update information, the `checkUpdate` and `download` functions must be called after the app is ready by default.
|
|
80
|
-
|
|
81
|
-
However, you have the option to customize the download function when creating the updater.
|
|
82
|
-
|
|
83
|
-
**NOTE: There can only be one function and should be default export in the entry file**
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
// electron/main/index.ts
|
|
87
|
-
import type { StartupWithUpdater, Updater } from 'electron-incremental-update'
|
|
88
|
-
import { getEntryVersion, getProductAsarPath, getProductVersion } from 'electron-incremental-update'
|
|
89
|
-
import { app } from 'electron'
|
|
90
|
-
import { name } from '../../package.json'
|
|
91
|
-
|
|
92
|
-
const startup: StartupWithUpdater = (updater: Updater) => {
|
|
93
|
-
await app.whenReady()
|
|
94
|
-
console.log('\ncurrent:')
|
|
95
|
-
console.log(`\tasar path: ${getProductAsarPath(name)}`)
|
|
96
|
-
console.log(`\tentry: ${getEntryVersion()}`)
|
|
97
|
-
console.log(`\tapp: ${getProductVersion(name)}`)
|
|
98
|
-
updater.onDownloading = ({ percent }) => {
|
|
99
|
-
console.log(percent)
|
|
100
|
-
}
|
|
101
|
-
updater.logger = console
|
|
102
|
-
updater.checkUpdate().then(async (result) => {
|
|
103
|
-
if (result === undefined) {
|
|
104
|
-
console.log('Update Unavailable')
|
|
105
|
-
} else if (result instanceof Error) {
|
|
106
|
-
console.error(result)
|
|
107
|
-
} else {
|
|
108
|
-
console.log('new version: ', result.version)
|
|
109
|
-
const { response } = await dialog.showMessageBox({
|
|
110
|
-
type: 'info',
|
|
111
|
-
buttons: ['Download', 'Later'],
|
|
112
|
-
message: 'Application update available!',
|
|
113
|
-
})
|
|
114
|
-
response === 0 && console.log(await updater.download())
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
export default startup
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### use native modules
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
// db.ts
|
|
125
|
-
import { requireNative } from 'electron-incremental-update'
|
|
126
|
-
|
|
127
|
-
const Database = requireNative<typeof import('better-sqlite3')>('better-sqlite3')
|
|
128
|
-
const db = new Database(':memory:')
|
|
129
|
-
db.exec(
|
|
130
|
-
'DROP TABLE IF EXISTS employees; '
|
|
131
|
-
+ 'CREATE TABLE IF NOT EXISTS employees (name TEXT, salary INTEGER)',
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
db.prepare('INSERT INTO employees VALUES (:n, :s)').run({
|
|
135
|
-
n: 'James',
|
|
136
|
-
s: 50000,
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
const r = db.prepare('SELECT * from employees').all()
|
|
140
|
-
console.log(r)
|
|
141
|
-
// [ { name: 'James', salary: 50000 } ]
|
|
142
|
-
|
|
143
|
-
db.close()
|
|
144
|
-
```
|
|
145
|
-
|
|
146
74
|
### setup vite.config.ts
|
|
147
75
|
|
|
148
|
-
make sure the plugin is set in the **last** build task
|
|
76
|
+
make sure the plugin is set in the **last** build task
|
|
149
77
|
|
|
150
|
-
- set it to preload
|
|
78
|
+
- for `vite-plugin-electron`, set it to `preload` (the second object in the plugin option array)
|
|
151
79
|
|
|
152
80
|
```ts
|
|
153
81
|
// vite.config.ts
|
|
@@ -177,10 +105,14 @@ export default defineConfig(({ command }) => {
|
|
|
177
105
|
// ...
|
|
178
106
|
}
|
|
179
107
|
},
|
|
108
|
+
// when using vite-plugin-electron-renderer
|
|
109
|
+
{
|
|
110
|
+
// ...
|
|
111
|
+
}
|
|
180
112
|
]),
|
|
181
|
-
// ...
|
|
113
|
+
// ...
|
|
182
114
|
],
|
|
183
|
-
// ...
|
|
115
|
+
// ...
|
|
184
116
|
}
|
|
185
117
|
})
|
|
186
118
|
```
|
|
@@ -194,7 +126,7 @@ export default defineConfig(({ command }) => {
|
|
|
194
126
|
}
|
|
195
127
|
```
|
|
196
128
|
|
|
197
|
-
### electron-builder
|
|
129
|
+
### config electron-builder
|
|
198
130
|
|
|
199
131
|
```js
|
|
200
132
|
const { name } = require('./package.json')
|
|
@@ -225,7 +157,78 @@ module.exports = {
|
|
|
225
157
|
extraResources: [
|
|
226
158
|
{ from: `release/${target}`, to: target }, // <- asar file
|
|
227
159
|
],
|
|
228
|
-
publish: null,
|
|
160
|
+
publish: null, // <- disable publish
|
|
229
161
|
// ...
|
|
230
162
|
}
|
|
231
|
-
```
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Usage
|
|
166
|
+
|
|
167
|
+
### use in main process
|
|
168
|
+
|
|
169
|
+
To use electron's `net` module for updating, the `checkUpdate` and `download` functions must be called after the app is ready by default.
|
|
170
|
+
|
|
171
|
+
However, you have the option to customize the download function when creating the updater.
|
|
172
|
+
|
|
173
|
+
**NOTE: There can only be one function and should be default export in the entry file**
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
// electron/main/index.ts
|
|
177
|
+
import type { StartupWithUpdater, Updater } from 'electron-incremental-update'
|
|
178
|
+
import { getEntryVersion, getProductAsarPath, getProductVersion } from 'electron-incremental-update'
|
|
179
|
+
import { app } from 'electron'
|
|
180
|
+
import { name } from '../../package.json'
|
|
181
|
+
|
|
182
|
+
const startup: StartupWithUpdater = (updater: Updater) => {
|
|
183
|
+
await app.whenReady()
|
|
184
|
+
console.log('\ncurrent:')
|
|
185
|
+
console.log(`\tasar path: ${getProductAsarPath(name)}`)
|
|
186
|
+
console.log(`\tentry: ${getEntryVersion()}`)
|
|
187
|
+
console.log(`\tapp: ${getProductVersion(name)}`)
|
|
188
|
+
updater.onDownloading = ({ percent }) => {
|
|
189
|
+
console.log(percent)
|
|
190
|
+
}
|
|
191
|
+
updater.logger = console
|
|
192
|
+
updater.checkUpdate().then(async (result) => {
|
|
193
|
+
if (result === undefined) {
|
|
194
|
+
console.log('Update Unavailable')
|
|
195
|
+
} else if (result instanceof Error) {
|
|
196
|
+
console.error(result)
|
|
197
|
+
} else {
|
|
198
|
+
console.log('new version: ', result.version)
|
|
199
|
+
const { response } = await dialog.showMessageBox({
|
|
200
|
+
type: 'info',
|
|
201
|
+
buttons: ['Download', 'Later'],
|
|
202
|
+
message: 'Application update available!',
|
|
203
|
+
})
|
|
204
|
+
response === 0 && console.log(await updater.download())
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
export default startup
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### use native modules
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
// db.ts
|
|
215
|
+
import { requireNative } from 'electron-incremental-update'
|
|
216
|
+
|
|
217
|
+
const Database = requireNative<typeof import('better-sqlite3')>('better-sqlite3')
|
|
218
|
+
const db = new Database(':memory:')
|
|
219
|
+
db.exec(
|
|
220
|
+
'DROP TABLE IF EXISTS employees; '
|
|
221
|
+
+ 'CREATE TABLE IF NOT EXISTS employees (name TEXT, salary INTEGER)',
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
db.prepare('INSERT INTO employees VALUES (:n, :s)').run({
|
|
225
|
+
n: 'James',
|
|
226
|
+
s: 50000,
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
const r = db.prepare('SELECT * from employees').all()
|
|
230
|
+
console.log(r)
|
|
231
|
+
// [ { name: 'James', salary: 50000 } ]
|
|
232
|
+
|
|
233
|
+
db.close()
|
|
234
|
+
```
|
|
@@ -6,15 +6,20 @@ import {
|
|
|
6
6
|
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
8
|
import { gunzip, gzip } from "node:zlib";
|
|
9
|
-
import
|
|
9
|
+
import Electron from "electron";
|
|
10
|
+
var info = {
|
|
11
|
+
dev: !Electron.app?.isPackaged,
|
|
12
|
+
platform: process.platform === "win32" ? "win" : process.platform === "darwin" ? "mac" : "linux",
|
|
13
|
+
appPath: Electron.app?.getAppPath()
|
|
14
|
+
};
|
|
10
15
|
function getProductAsarPath(name) {
|
|
11
|
-
return
|
|
16
|
+
return info.dev ? join(dirname(info.appPath), `${name}.asar`) : "dev.asar";
|
|
12
17
|
}
|
|
13
18
|
function getEntryVersion() {
|
|
14
|
-
return app.getVersion();
|
|
19
|
+
return Electron.app.getVersion();
|
|
15
20
|
}
|
|
16
21
|
function getProductVersion(name) {
|
|
17
|
-
return
|
|
22
|
+
return info.dev ? readFileSync(join(getProductAsarPath(name), "version"), "utf-8") : getEntryVersion();
|
|
18
23
|
}
|
|
19
24
|
var NoSuchNativeModuleError = class extends Error {
|
|
20
25
|
moduleName;
|
|
@@ -24,7 +29,7 @@ var NoSuchNativeModuleError = class extends Error {
|
|
|
24
29
|
}
|
|
25
30
|
};
|
|
26
31
|
function requireNative(packageName) {
|
|
27
|
-
const path =
|
|
32
|
+
const path = info.dev ? join(info.appPath, "node_modules", packageName) : packageName;
|
|
28
33
|
try {
|
|
29
34
|
return __require(path);
|
|
30
35
|
} catch (error) {
|
|
@@ -68,15 +73,15 @@ function getGithubReleaseCdnGroup() {
|
|
|
68
73
|
];
|
|
69
74
|
}
|
|
70
75
|
function restartApp() {
|
|
71
|
-
app.relaunch();
|
|
72
|
-
app.quit();
|
|
76
|
+
Electron.app.relaunch();
|
|
77
|
+
Electron.app.quit();
|
|
73
78
|
}
|
|
74
79
|
function waitAppReady(duration = 1e3) {
|
|
75
80
|
return new Promise((resolve, reject) => {
|
|
76
81
|
const timeout = setTimeout(() => {
|
|
77
82
|
reject(new Error("app is not ready"));
|
|
78
83
|
}, duration);
|
|
79
|
-
app.whenReady().then(() => {
|
|
84
|
+
Electron.app.whenReady().then(() => {
|
|
80
85
|
clearTimeout(timeout);
|
|
81
86
|
resolve();
|
|
82
87
|
});
|
|
@@ -140,13 +145,14 @@ function parseVersion(version) {
|
|
|
140
145
|
ret.stage = stage;
|
|
141
146
|
ret.stageVersion = Number(_v) || -1;
|
|
142
147
|
}
|
|
143
|
-
if (isNaN(major) || isNaN(minor) || isNaN(patch) || isNaN(ret.stageVersion)) {
|
|
148
|
+
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) {
|
|
144
149
|
throw new TypeError(`invalid version: ${version}`);
|
|
145
150
|
}
|
|
146
151
|
return ret;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
export {
|
|
155
|
+
info,
|
|
150
156
|
getProductAsarPath,
|
|
151
157
|
getEntryVersion,
|
|
152
158
|
getProductVersion,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/crypto.ts
|
|
2
2
|
import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createSign, createVerify } from "node:crypto";
|
|
3
|
-
import { Buffer } from "node:buffer";
|
|
4
3
|
function encrypt(plainText, key2, iv) {
|
|
5
4
|
const cipher = createCipheriv("aes-256-cbc", key2, iv);
|
|
6
5
|
let encrypted = cipher.update(plainText, "utf8", "base64url");
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
1
|
import { UpdateJSON } from './updateJson.mjs';
|
|
3
2
|
|
|
4
3
|
declare class MinimumVersionError extends Error {
|
|
@@ -14,31 +13,6 @@ declare class VerifyFailedError extends Error {
|
|
|
14
13
|
declare class DownloadError extends Error {
|
|
15
14
|
constructor(msg: string);
|
|
16
15
|
}
|
|
17
|
-
declare class IncrementalUpdater implements Updater {
|
|
18
|
-
private info?;
|
|
19
|
-
private option;
|
|
20
|
-
private asarPath;
|
|
21
|
-
private gzipPath;
|
|
22
|
-
private tmpFilePath;
|
|
23
|
-
logger?: Logger;
|
|
24
|
-
onDownloading?: (progress: DownloadingInfo) => void;
|
|
25
|
-
get productName(): string;
|
|
26
|
-
set productName(name: string);
|
|
27
|
-
get receiveBeta(): boolean;
|
|
28
|
-
set receiveBeta(receiveBeta: boolean);
|
|
29
|
-
constructor(option: UpdaterOption);
|
|
30
|
-
private needUpdate;
|
|
31
|
-
private parseData;
|
|
32
|
-
checkUpdate(data?: string | UpdateJSON): Promise<CheckResultType>;
|
|
33
|
-
download(data?: string | Buffer, sig?: string): Promise<DownloadResult>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* create updater instance
|
|
37
|
-
* @param option updater option
|
|
38
|
-
* @returns updater
|
|
39
|
-
*/
|
|
40
|
-
declare function createUpdater(option: UpdaterOption): IncrementalUpdater;
|
|
41
|
-
|
|
42
16
|
type CheckResultError = MinimumVersionError | DownloadError | TypeError | Error;
|
|
43
17
|
type DownloadResultError = DownloadError | VerifyFailedError | TypeError | Error;
|
|
44
18
|
type CheckResultType = {
|
|
@@ -67,7 +41,13 @@ type Logger = {
|
|
|
67
41
|
error: (msg: string, e?: Error) => void;
|
|
68
42
|
};
|
|
69
43
|
interface Updater {
|
|
44
|
+
/**
|
|
45
|
+
* the name of the product, also the basename of the asar
|
|
46
|
+
*/
|
|
70
47
|
productName: string;
|
|
48
|
+
/**
|
|
49
|
+
* whether receive beta version
|
|
50
|
+
*/
|
|
71
51
|
receiveBeta: boolean;
|
|
72
52
|
/**
|
|
73
53
|
* check update info
|
|
@@ -94,6 +74,11 @@ interface Updater {
|
|
|
94
74
|
* @param data log info
|
|
95
75
|
*/
|
|
96
76
|
logger?: Logger;
|
|
77
|
+
/**
|
|
78
|
+
* download progress function
|
|
79
|
+
* @param progress download progress info
|
|
80
|
+
* @returns void
|
|
81
|
+
*/
|
|
97
82
|
onDownloading?: (progress: DownloadingInfo) => void;
|
|
98
83
|
}
|
|
99
84
|
type UpdaterOverrideFunctions = {
|
|
@@ -115,7 +100,6 @@ type UpdaterOverrideFunctions = {
|
|
|
115
100
|
/**
|
|
116
101
|
* custom download JSON function
|
|
117
102
|
* @param url download url
|
|
118
|
-
* @param updater updater, to trigger events
|
|
119
103
|
* @param header download header
|
|
120
104
|
* @returns `UpdateJSON`
|
|
121
105
|
*/
|
|
@@ -123,8 +107,9 @@ type UpdaterOverrideFunctions = {
|
|
|
123
107
|
/**
|
|
124
108
|
* custom download buffer function
|
|
125
109
|
* @param url download url
|
|
126
|
-
* @param
|
|
127
|
-
* @param
|
|
110
|
+
* @param headers download header
|
|
111
|
+
* @param total precaculated file total size
|
|
112
|
+
* @param onDownloading on downloading callback
|
|
128
113
|
* @returns `Buffer`
|
|
129
114
|
*/
|
|
130
115
|
downloadBuffer?: (url: string, headers: Record<string, any>, total: number, onDownloading?: (progress: DownloadingInfo) => void) => Promise<Buffer>;
|
|
@@ -190,6 +175,31 @@ interface UpdaterOption {
|
|
|
190
175
|
downloadConfig?: UpdaterDownloadConfig;
|
|
191
176
|
}
|
|
192
177
|
|
|
178
|
+
declare class IncrementalUpdater implements Updater {
|
|
179
|
+
private info?;
|
|
180
|
+
private option;
|
|
181
|
+
private asarPath;
|
|
182
|
+
private gzipPath;
|
|
183
|
+
private tmpFilePath;
|
|
184
|
+
logger?: Logger;
|
|
185
|
+
onDownloading?: (progress: DownloadingInfo) => void;
|
|
186
|
+
get productName(): string;
|
|
187
|
+
set productName(name: string);
|
|
188
|
+
get receiveBeta(): boolean;
|
|
189
|
+
set receiveBeta(receiveBeta: boolean);
|
|
190
|
+
constructor(option: UpdaterOption);
|
|
191
|
+
private needUpdate;
|
|
192
|
+
private parseData;
|
|
193
|
+
checkUpdate(data?: string | UpdateJSON): Promise<CheckResultType>;
|
|
194
|
+
download(data?: string | Buffer, sig?: string): Promise<DownloadResult>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* create updater instance
|
|
198
|
+
* @param option updater option
|
|
199
|
+
* @returns updater
|
|
200
|
+
*/
|
|
201
|
+
declare function createUpdater(option: UpdaterOption): IncrementalUpdater;
|
|
202
|
+
|
|
193
203
|
type Promisable<T> = T | Promise<T>;
|
|
194
204
|
type AppOption = {
|
|
195
205
|
/**
|
|
@@ -251,4 +261,4 @@ type SetUpdater = {
|
|
|
251
261
|
*/
|
|
252
262
|
declare function initApp(appOptions?: AppOption): SetUpdater;
|
|
253
263
|
|
|
254
|
-
export { AppOption,
|
|
264
|
+
export { AppOption, IncrementalUpdater, StartupWithUpdater, Updater, UpdaterOption, createUpdater, initApp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
1
|
import { UpdateJSON } from './updateJson.js';
|
|
3
2
|
|
|
4
3
|
declare class MinimumVersionError extends Error {
|
|
@@ -14,31 +13,6 @@ declare class VerifyFailedError extends Error {
|
|
|
14
13
|
declare class DownloadError extends Error {
|
|
15
14
|
constructor(msg: string);
|
|
16
15
|
}
|
|
17
|
-
declare class IncrementalUpdater implements Updater {
|
|
18
|
-
private info?;
|
|
19
|
-
private option;
|
|
20
|
-
private asarPath;
|
|
21
|
-
private gzipPath;
|
|
22
|
-
private tmpFilePath;
|
|
23
|
-
logger?: Logger;
|
|
24
|
-
onDownloading?: (progress: DownloadingInfo) => void;
|
|
25
|
-
get productName(): string;
|
|
26
|
-
set productName(name: string);
|
|
27
|
-
get receiveBeta(): boolean;
|
|
28
|
-
set receiveBeta(receiveBeta: boolean);
|
|
29
|
-
constructor(option: UpdaterOption);
|
|
30
|
-
private needUpdate;
|
|
31
|
-
private parseData;
|
|
32
|
-
checkUpdate(data?: string | UpdateJSON): Promise<CheckResultType>;
|
|
33
|
-
download(data?: string | Buffer, sig?: string): Promise<DownloadResult>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* create updater instance
|
|
37
|
-
* @param option updater option
|
|
38
|
-
* @returns updater
|
|
39
|
-
*/
|
|
40
|
-
declare function createUpdater(option: UpdaterOption): IncrementalUpdater;
|
|
41
|
-
|
|
42
16
|
type CheckResultError = MinimumVersionError | DownloadError | TypeError | Error;
|
|
43
17
|
type DownloadResultError = DownloadError | VerifyFailedError | TypeError | Error;
|
|
44
18
|
type CheckResultType = {
|
|
@@ -67,7 +41,13 @@ type Logger = {
|
|
|
67
41
|
error: (msg: string, e?: Error) => void;
|
|
68
42
|
};
|
|
69
43
|
interface Updater {
|
|
44
|
+
/**
|
|
45
|
+
* the name of the product, also the basename of the asar
|
|
46
|
+
*/
|
|
70
47
|
productName: string;
|
|
48
|
+
/**
|
|
49
|
+
* whether receive beta version
|
|
50
|
+
*/
|
|
71
51
|
receiveBeta: boolean;
|
|
72
52
|
/**
|
|
73
53
|
* check update info
|
|
@@ -94,6 +74,11 @@ interface Updater {
|
|
|
94
74
|
* @param data log info
|
|
95
75
|
*/
|
|
96
76
|
logger?: Logger;
|
|
77
|
+
/**
|
|
78
|
+
* download progress function
|
|
79
|
+
* @param progress download progress info
|
|
80
|
+
* @returns void
|
|
81
|
+
*/
|
|
97
82
|
onDownloading?: (progress: DownloadingInfo) => void;
|
|
98
83
|
}
|
|
99
84
|
type UpdaterOverrideFunctions = {
|
|
@@ -115,7 +100,6 @@ type UpdaterOverrideFunctions = {
|
|
|
115
100
|
/**
|
|
116
101
|
* custom download JSON function
|
|
117
102
|
* @param url download url
|
|
118
|
-
* @param updater updater, to trigger events
|
|
119
103
|
* @param header download header
|
|
120
104
|
* @returns `UpdateJSON`
|
|
121
105
|
*/
|
|
@@ -123,8 +107,9 @@ type UpdaterOverrideFunctions = {
|
|
|
123
107
|
/**
|
|
124
108
|
* custom download buffer function
|
|
125
109
|
* @param url download url
|
|
126
|
-
* @param
|
|
127
|
-
* @param
|
|
110
|
+
* @param headers download header
|
|
111
|
+
* @param total precaculated file total size
|
|
112
|
+
* @param onDownloading on downloading callback
|
|
128
113
|
* @returns `Buffer`
|
|
129
114
|
*/
|
|
130
115
|
downloadBuffer?: (url: string, headers: Record<string, any>, total: number, onDownloading?: (progress: DownloadingInfo) => void) => Promise<Buffer>;
|
|
@@ -190,6 +175,31 @@ interface UpdaterOption {
|
|
|
190
175
|
downloadConfig?: UpdaterDownloadConfig;
|
|
191
176
|
}
|
|
192
177
|
|
|
178
|
+
declare class IncrementalUpdater implements Updater {
|
|
179
|
+
private info?;
|
|
180
|
+
private option;
|
|
181
|
+
private asarPath;
|
|
182
|
+
private gzipPath;
|
|
183
|
+
private tmpFilePath;
|
|
184
|
+
logger?: Logger;
|
|
185
|
+
onDownloading?: (progress: DownloadingInfo) => void;
|
|
186
|
+
get productName(): string;
|
|
187
|
+
set productName(name: string);
|
|
188
|
+
get receiveBeta(): boolean;
|
|
189
|
+
set receiveBeta(receiveBeta: boolean);
|
|
190
|
+
constructor(option: UpdaterOption);
|
|
191
|
+
private needUpdate;
|
|
192
|
+
private parseData;
|
|
193
|
+
checkUpdate(data?: string | UpdateJSON): Promise<CheckResultType>;
|
|
194
|
+
download(data?: string | Buffer, sig?: string): Promise<DownloadResult>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* create updater instance
|
|
198
|
+
* @param option updater option
|
|
199
|
+
* @returns updater
|
|
200
|
+
*/
|
|
201
|
+
declare function createUpdater(option: UpdaterOption): IncrementalUpdater;
|
|
202
|
+
|
|
193
203
|
type Promisable<T> = T | Promise<T>;
|
|
194
204
|
type AppOption = {
|
|
195
205
|
/**
|
|
@@ -251,4 +261,4 @@ type SetUpdater = {
|
|
|
251
261
|
*/
|
|
252
262
|
declare function initApp(appOptions?: AppOption): SetUpdater;
|
|
253
263
|
|
|
254
|
-
export { AppOption,
|
|
264
|
+
export { AppOption, IncrementalUpdater, StartupWithUpdater, Updater, UpdaterOption, createUpdater, initApp };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,48 +17,57 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var src_exports = {};
|
|
22
32
|
__export(src_exports, {
|
|
23
|
-
DownloadError: () => DownloadError,
|
|
24
33
|
IncrementalUpdater: () => IncrementalUpdater,
|
|
25
|
-
MinimumVersionError: () => MinimumVersionError,
|
|
26
|
-
VerifyFailedError: () => VerifyFailedError,
|
|
27
34
|
createUpdater: () => createUpdater,
|
|
28
35
|
initApp: () => initApp
|
|
29
36
|
});
|
|
30
37
|
module.exports = __toCommonJS(src_exports);
|
|
31
38
|
var import_node_path2 = require("path");
|
|
32
39
|
var import_node_fs3 = require("fs");
|
|
33
|
-
var import_electron3 = require("electron");
|
|
40
|
+
var import_electron3 = __toESM(require("electron"));
|
|
34
41
|
|
|
35
42
|
// src/updater/index.ts
|
|
36
43
|
var import_node_fs2 = require("fs");
|
|
37
|
-
var import_node_buffer3 = require("buffer");
|
|
38
44
|
var import_promises = require("fs/promises");
|
|
39
45
|
|
|
40
46
|
// src/utils.ts
|
|
41
47
|
var import_node_fs = require("fs");
|
|
42
48
|
var import_node_path = require("path");
|
|
43
49
|
var import_node_zlib = require("zlib");
|
|
44
|
-
var import_electron = require("electron");
|
|
50
|
+
var import_electron = __toESM(require("electron"));
|
|
51
|
+
var info = {
|
|
52
|
+
dev: !import_electron.default.app?.isPackaged,
|
|
53
|
+
platform: process.platform === "win32" ? "win" : process.platform === "darwin" ? "mac" : "linux",
|
|
54
|
+
appPath: import_electron.default.app?.getAppPath()
|
|
55
|
+
};
|
|
45
56
|
function getProductAsarPath(name) {
|
|
46
|
-
return
|
|
57
|
+
return info.dev ? (0, import_node_path.join)((0, import_node_path.dirname)(info.appPath), `${name}.asar`) : "dev.asar";
|
|
47
58
|
}
|
|
48
59
|
function getEntryVersion() {
|
|
49
|
-
return import_electron.app.getVersion();
|
|
60
|
+
return import_electron.default.app.getVersion();
|
|
50
61
|
}
|
|
51
62
|
function getProductVersion(name) {
|
|
52
|
-
return
|
|
63
|
+
return info.dev ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(getProductAsarPath(name), "version"), "utf-8") : getEntryVersion();
|
|
53
64
|
}
|
|
54
65
|
function waitAppReady(duration = 1e3) {
|
|
55
66
|
return new Promise((resolve2, reject) => {
|
|
56
67
|
const timeout = setTimeout(() => {
|
|
57
68
|
reject(new Error("app is not ready"));
|
|
58
69
|
}, duration);
|
|
59
|
-
import_electron.app.whenReady().then(() => {
|
|
70
|
+
import_electron.default.app.whenReady().then(() => {
|
|
60
71
|
clearTimeout(timeout);
|
|
61
72
|
resolve2();
|
|
62
73
|
});
|
|
@@ -97,7 +108,7 @@ function parseVersion(version) {
|
|
|
97
108
|
ret.stage = stage;
|
|
98
109
|
ret.stageVersion = Number(_v) || -1;
|
|
99
110
|
}
|
|
100
|
-
if (isNaN(major) || isNaN(minor) || isNaN(patch) || isNaN(ret.stageVersion)) {
|
|
111
|
+
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) {
|
|
101
112
|
throw new TypeError(`invalid version: ${version}`);
|
|
102
113
|
}
|
|
103
114
|
return ret;
|
|
@@ -105,7 +116,6 @@ function parseVersion(version) {
|
|
|
105
116
|
|
|
106
117
|
// src/crypto.ts
|
|
107
118
|
var import_node_crypto = require("crypto");
|
|
108
|
-
var import_node_buffer = require("buffer");
|
|
109
119
|
function decrypt(encryptedText, key2, iv) {
|
|
110
120
|
const decipher = (0, import_node_crypto.createDecipheriv)("aes-256-cbc", key2, iv);
|
|
111
121
|
let decrypted = decipher.update(encryptedText, "base64url", "utf8");
|
|
@@ -114,7 +124,7 @@ function decrypt(encryptedText, key2, iv) {
|
|
|
114
124
|
}
|
|
115
125
|
function key(data, length) {
|
|
116
126
|
const hash = (0, import_node_crypto.createHash)("SHA256").update(data).digest("binary");
|
|
117
|
-
return
|
|
127
|
+
return Buffer.from(hash).subarray(0, length);
|
|
118
128
|
}
|
|
119
129
|
var verify = (buffer, signature, cert) => {
|
|
120
130
|
try {
|
|
@@ -132,13 +142,37 @@ function isUpdateJSON(json) {
|
|
|
132
142
|
return is(json) && "beta" in json && is(json.beta);
|
|
133
143
|
}
|
|
134
144
|
|
|
145
|
+
// src/updater/types.ts
|
|
146
|
+
var MinimumVersionError = class extends Error {
|
|
147
|
+
currentVersion;
|
|
148
|
+
minVersion;
|
|
149
|
+
constructor(version, minimumVersion) {
|
|
150
|
+
super(`current entry version is ${version}, less than the minimumVersion ${minimumVersion}`);
|
|
151
|
+
this.currentVersion = version;
|
|
152
|
+
this.minVersion = minimumVersion;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var VerifyFailedError = class extends Error {
|
|
156
|
+
signature;
|
|
157
|
+
cert;
|
|
158
|
+
constructor(signature, cert) {
|
|
159
|
+
super("verify failed, invalid signature or certificate");
|
|
160
|
+
this.signature = signature;
|
|
161
|
+
this.cert = cert;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var DownloadError = class extends Error {
|
|
165
|
+
constructor(msg) {
|
|
166
|
+
super(`download update error, ${msg}`);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
135
170
|
// src/updater/defaultFunctions.ts
|
|
136
|
-
var
|
|
137
|
-
var import_electron2 = require("electron");
|
|
171
|
+
var import_electron2 = __toESM(require("electron"));
|
|
138
172
|
var downloadJSONDefault = async (url, headers) => {
|
|
139
173
|
await waitAppReady();
|
|
140
174
|
return new Promise((resolve2, reject) => {
|
|
141
|
-
const request = import_electron2.net.request({
|
|
175
|
+
const request = import_electron2.default.net.request({
|
|
142
176
|
url,
|
|
143
177
|
method: "GET",
|
|
144
178
|
redirect: "follow"
|
|
@@ -172,7 +206,7 @@ var downloadBufferDefault = async (url, headers, total, onDownloading) => {
|
|
|
172
206
|
await waitAppReady();
|
|
173
207
|
let current = 0;
|
|
174
208
|
return new Promise((resolve2, reject) => {
|
|
175
|
-
const request = import_electron2.net.request({
|
|
209
|
+
const request = import_electron2.default.net.request({
|
|
176
210
|
url,
|
|
177
211
|
method: "GET",
|
|
178
212
|
redirect: "follow"
|
|
@@ -192,7 +226,7 @@ var downloadBufferDefault = async (url, headers, total, onDownloading) => {
|
|
|
192
226
|
data.push(chunk);
|
|
193
227
|
});
|
|
194
228
|
res.on("end", () => {
|
|
195
|
-
resolve2(
|
|
229
|
+
resolve2(Buffer.concat(data));
|
|
196
230
|
});
|
|
197
231
|
}).on("error", (e) => {
|
|
198
232
|
reject(e);
|
|
@@ -222,29 +256,6 @@ var compareVersionDefault = (version1, version2) => {
|
|
|
222
256
|
};
|
|
223
257
|
|
|
224
258
|
// src/updater/index.ts
|
|
225
|
-
var MinimumVersionError = class extends Error {
|
|
226
|
-
currentVersion;
|
|
227
|
-
minVersion;
|
|
228
|
-
constructor(version, minimumVersion) {
|
|
229
|
-
super(`current entry version is ${version}, less than the minimumVersion ${minimumVersion}`);
|
|
230
|
-
this.currentVersion = version;
|
|
231
|
-
this.minVersion = minimumVersion;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
var VerifyFailedError = class extends Error {
|
|
235
|
-
signature;
|
|
236
|
-
cert;
|
|
237
|
-
constructor(signature, cert) {
|
|
238
|
-
super("verify failed, invalid signature or certificate");
|
|
239
|
-
this.signature = signature;
|
|
240
|
-
this.cert = cert;
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
var DownloadError = class extends Error {
|
|
244
|
-
constructor(msg) {
|
|
245
|
-
super(`download update error, ${msg}`);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
259
|
var IncrementalUpdater = class {
|
|
249
260
|
info;
|
|
250
261
|
option;
|
|
@@ -293,7 +304,7 @@ var IncrementalUpdater = class {
|
|
|
293
304
|
if (!["string", "object", "undefined"].includes(typeof data)) {
|
|
294
305
|
throw new TypeError(`invalid type at format '${format}': ${data}`);
|
|
295
306
|
}
|
|
296
|
-
if (typeof data === "object" && (format === "json" && isUpdateJSON(data) || format === "buffer" &&
|
|
307
|
+
if (typeof data === "object" && (format === "json" && isUpdateJSON(data) || format === "buffer" && Buffer.isBuffer(data))) {
|
|
297
308
|
return data;
|
|
298
309
|
}
|
|
299
310
|
if (typeof data === "object") {
|
|
@@ -410,7 +421,7 @@ function initApp(appOptions) {
|
|
|
410
421
|
} = hooks || {};
|
|
411
422
|
function handleError(msg) {
|
|
412
423
|
onStartError?.(new Error(msg));
|
|
413
|
-
import_electron3.app.quit();
|
|
424
|
+
import_electron3.default.app.quit();
|
|
414
425
|
}
|
|
415
426
|
async function startup(updater) {
|
|
416
427
|
try {
|
|
@@ -420,7 +431,7 @@ function initApp(appOptions) {
|
|
|
420
431
|
await beforeDoUpdate?.(asarPath, updateAsarPath);
|
|
421
432
|
(0, import_node_fs3.renameSync)(updateAsarPath, asarPath);
|
|
422
433
|
}
|
|
423
|
-
const mainDir = import_electron3.app.isPackaged ? asarPath : electronDevDistPath;
|
|
434
|
+
const mainDir = import_electron3.default.app.isPackaged ? asarPath : electronDevDistPath;
|
|
424
435
|
const entry = (0, import_node_path2.resolve)(__dirname, mainDir, mainPath);
|
|
425
436
|
await beforeStart?.(entry);
|
|
426
437
|
require(entry)(updater);
|
|
@@ -446,10 +457,7 @@ function initApp(appOptions) {
|
|
|
446
457
|
}
|
|
447
458
|
// Annotate the CommonJS export names for ESM import in node:
|
|
448
459
|
0 && (module.exports = {
|
|
449
|
-
DownloadError,
|
|
450
460
|
IncrementalUpdater,
|
|
451
|
-
MinimumVersionError,
|
|
452
|
-
VerifyFailedError,
|
|
453
461
|
createUpdater,
|
|
454
462
|
initApp
|
|
455
463
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verify
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GXZSAUBR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getEntryVersion,
|
|
6
6
|
getProductAsarPath,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
parseVersion,
|
|
9
9
|
unzipFile,
|
|
10
10
|
waitAppReady
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7R4GHFED.mjs";
|
|
12
12
|
import {
|
|
13
13
|
isUpdateJSON
|
|
14
14
|
} from "./chunk-2JVXVTC5.mjs";
|
|
@@ -19,20 +19,43 @@ import {
|
|
|
19
19
|
// src/index.ts
|
|
20
20
|
import { resolve } from "node:path";
|
|
21
21
|
import { existsSync as existsSync2, renameSync } from "node:fs";
|
|
22
|
-
import
|
|
22
|
+
import Electron2 from "electron";
|
|
23
23
|
|
|
24
24
|
// src/updater/index.ts
|
|
25
25
|
import { existsSync } from "node:fs";
|
|
26
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
27
26
|
import { rm, writeFile } from "node:fs/promises";
|
|
28
27
|
|
|
28
|
+
// src/updater/types.ts
|
|
29
|
+
var MinimumVersionError = class extends Error {
|
|
30
|
+
currentVersion;
|
|
31
|
+
minVersion;
|
|
32
|
+
constructor(version, minimumVersion) {
|
|
33
|
+
super(`current entry version is ${version}, less than the minimumVersion ${minimumVersion}`);
|
|
34
|
+
this.currentVersion = version;
|
|
35
|
+
this.minVersion = minimumVersion;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var VerifyFailedError = class extends Error {
|
|
39
|
+
signature;
|
|
40
|
+
cert;
|
|
41
|
+
constructor(signature, cert) {
|
|
42
|
+
super("verify failed, invalid signature or certificate");
|
|
43
|
+
this.signature = signature;
|
|
44
|
+
this.cert = cert;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var DownloadError = class extends Error {
|
|
48
|
+
constructor(msg) {
|
|
49
|
+
super(`download update error, ${msg}`);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
29
53
|
// src/updater/defaultFunctions.ts
|
|
30
|
-
import
|
|
31
|
-
import { net } from "electron";
|
|
54
|
+
import Electron from "electron";
|
|
32
55
|
var downloadJSONDefault = async (url, headers) => {
|
|
33
56
|
await waitAppReady();
|
|
34
57
|
return new Promise((resolve2, reject) => {
|
|
35
|
-
const request = net.request({
|
|
58
|
+
const request = Electron.net.request({
|
|
36
59
|
url,
|
|
37
60
|
method: "GET",
|
|
38
61
|
redirect: "follow"
|
|
@@ -66,7 +89,7 @@ var downloadBufferDefault = async (url, headers, total, onDownloading) => {
|
|
|
66
89
|
await waitAppReady();
|
|
67
90
|
let current = 0;
|
|
68
91
|
return new Promise((resolve2, reject) => {
|
|
69
|
-
const request = net.request({
|
|
92
|
+
const request = Electron.net.request({
|
|
70
93
|
url,
|
|
71
94
|
method: "GET",
|
|
72
95
|
redirect: "follow"
|
|
@@ -116,29 +139,6 @@ var compareVersionDefault = (version1, version2) => {
|
|
|
116
139
|
};
|
|
117
140
|
|
|
118
141
|
// src/updater/index.ts
|
|
119
|
-
var MinimumVersionError = class extends Error {
|
|
120
|
-
currentVersion;
|
|
121
|
-
minVersion;
|
|
122
|
-
constructor(version, minimumVersion) {
|
|
123
|
-
super(`current entry version is ${version}, less than the minimumVersion ${minimumVersion}`);
|
|
124
|
-
this.currentVersion = version;
|
|
125
|
-
this.minVersion = minimumVersion;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
var VerifyFailedError = class extends Error {
|
|
129
|
-
signature;
|
|
130
|
-
cert;
|
|
131
|
-
constructor(signature, cert) {
|
|
132
|
-
super("verify failed, invalid signature or certificate");
|
|
133
|
-
this.signature = signature;
|
|
134
|
-
this.cert = cert;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
var DownloadError = class extends Error {
|
|
138
|
-
constructor(msg) {
|
|
139
|
-
super(`download update error, ${msg}`);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
142
|
var IncrementalUpdater = class {
|
|
143
143
|
info;
|
|
144
144
|
option;
|
|
@@ -187,7 +187,7 @@ var IncrementalUpdater = class {
|
|
|
187
187
|
if (!["string", "object", "undefined"].includes(typeof data)) {
|
|
188
188
|
throw new TypeError(`invalid type at format '${format}': ${data}`);
|
|
189
189
|
}
|
|
190
|
-
if (typeof data === "object" && (format === "json" && isUpdateJSON(data) || format === "buffer" &&
|
|
190
|
+
if (typeof data === "object" && (format === "json" && isUpdateJSON(data) || format === "buffer" && Buffer.isBuffer(data))) {
|
|
191
191
|
return data;
|
|
192
192
|
}
|
|
193
193
|
if (typeof data === "object") {
|
|
@@ -304,7 +304,7 @@ function initApp(appOptions) {
|
|
|
304
304
|
} = hooks || {};
|
|
305
305
|
function handleError(msg) {
|
|
306
306
|
onStartError?.(new Error(msg));
|
|
307
|
-
app.quit();
|
|
307
|
+
Electron2.app.quit();
|
|
308
308
|
}
|
|
309
309
|
async function startup(updater) {
|
|
310
310
|
try {
|
|
@@ -314,7 +314,7 @@ function initApp(appOptions) {
|
|
|
314
314
|
await beforeDoUpdate?.(asarPath, updateAsarPath);
|
|
315
315
|
renameSync(updateAsarPath, asarPath);
|
|
316
316
|
}
|
|
317
|
-
const mainDir = app.isPackaged ? asarPath : electronDevDistPath;
|
|
317
|
+
const mainDir = Electron2.app.isPackaged ? asarPath : electronDevDistPath;
|
|
318
318
|
const entry = resolve(__dirname, mainDir, mainPath);
|
|
319
319
|
await beforeStart?.(entry);
|
|
320
320
|
__require(entry)(updater);
|
|
@@ -339,10 +339,7 @@ function initApp(appOptions) {
|
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
341
|
export {
|
|
342
|
-
DownloadError,
|
|
343
342
|
IncrementalUpdater,
|
|
344
|
-
MinimumVersionError,
|
|
345
|
-
VerifyFailedError,
|
|
346
343
|
createUpdater,
|
|
347
344
|
initApp
|
|
348
345
|
};
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
type Info = {
|
|
2
|
+
dev: boolean;
|
|
3
|
+
platform: 'win' | 'mac' | 'linux';
|
|
4
|
+
appPath: string;
|
|
5
|
+
};
|
|
6
|
+
declare const info: Info;
|
|
1
7
|
/**
|
|
2
8
|
* get the application asar absolute path
|
|
3
9
|
* @param name The name of the application
|
|
10
|
+
* @todo support v8 bytecode
|
|
4
11
|
*/
|
|
5
12
|
declare function getProductAsarPath(name: string): string;
|
|
6
13
|
/**
|
|
@@ -62,4 +69,4 @@ interface Version {
|
|
|
62
69
|
}
|
|
63
70
|
declare function parseVersion(version: string): Version;
|
|
64
71
|
|
|
65
|
-
export { NoSuchNativeModuleError, Version, getEntryVersion, getGithubFileCdnGroup, getGithubReleaseCdnGroup, getProductAsarPath, getProductVersion, handleUnexpectedErrors, parseGithubCdnURL, parseVersion, requireNative, restartApp, unzipFile, waitAppReady, zipFile };
|
|
72
|
+
export { NoSuchNativeModuleError, Version, getEntryVersion, getGithubFileCdnGroup, getGithubReleaseCdnGroup, getProductAsarPath, getProductVersion, handleUnexpectedErrors, info, parseGithubCdnURL, parseVersion, requireNative, restartApp, unzipFile, waitAppReady, zipFile };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
type Info = {
|
|
2
|
+
dev: boolean;
|
|
3
|
+
platform: 'win' | 'mac' | 'linux';
|
|
4
|
+
appPath: string;
|
|
5
|
+
};
|
|
6
|
+
declare const info: Info;
|
|
1
7
|
/**
|
|
2
8
|
* get the application asar absolute path
|
|
3
9
|
* @param name The name of the application
|
|
10
|
+
* @todo support v8 bytecode
|
|
4
11
|
*/
|
|
5
12
|
declare function getProductAsarPath(name: string): string;
|
|
6
13
|
/**
|
|
@@ -62,4 +69,4 @@ interface Version {
|
|
|
62
69
|
}
|
|
63
70
|
declare function parseVersion(version: string): Version;
|
|
64
71
|
|
|
65
|
-
export { NoSuchNativeModuleError, Version, getEntryVersion, getGithubFileCdnGroup, getGithubReleaseCdnGroup, getProductAsarPath, getProductVersion, handleUnexpectedErrors, parseGithubCdnURL, parseVersion, requireNative, restartApp, unzipFile, waitAppReady, zipFile };
|
|
72
|
+
export { NoSuchNativeModuleError, Version, getEntryVersion, getGithubFileCdnGroup, getGithubReleaseCdnGroup, getProductAsarPath, getProductVersion, handleUnexpectedErrors, info, parseGithubCdnURL, parseVersion, requireNative, restartApp, unzipFile, waitAppReady, zipFile };
|
package/dist/utils.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/utils.ts
|
|
@@ -27,6 +37,7 @@ __export(utils_exports, {
|
|
|
27
37
|
getProductAsarPath: () => getProductAsarPath,
|
|
28
38
|
getProductVersion: () => getProductVersion,
|
|
29
39
|
handleUnexpectedErrors: () => handleUnexpectedErrors,
|
|
40
|
+
info: () => info,
|
|
30
41
|
parseGithubCdnURL: () => parseGithubCdnURL,
|
|
31
42
|
parseVersion: () => parseVersion,
|
|
32
43
|
requireNative: () => requireNative,
|
|
@@ -39,15 +50,20 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
39
50
|
var import_node_fs = require("fs");
|
|
40
51
|
var import_node_path = require("path");
|
|
41
52
|
var import_node_zlib = require("zlib");
|
|
42
|
-
var import_electron = require("electron");
|
|
53
|
+
var import_electron = __toESM(require("electron"));
|
|
54
|
+
var info = {
|
|
55
|
+
dev: !import_electron.default.app?.isPackaged,
|
|
56
|
+
platform: process.platform === "win32" ? "win" : process.platform === "darwin" ? "mac" : "linux",
|
|
57
|
+
appPath: import_electron.default.app?.getAppPath()
|
|
58
|
+
};
|
|
43
59
|
function getProductAsarPath(name) {
|
|
44
|
-
return
|
|
60
|
+
return info.dev ? (0, import_node_path.join)((0, import_node_path.dirname)(info.appPath), `${name}.asar`) : "dev.asar";
|
|
45
61
|
}
|
|
46
62
|
function getEntryVersion() {
|
|
47
|
-
return import_electron.app.getVersion();
|
|
63
|
+
return import_electron.default.app.getVersion();
|
|
48
64
|
}
|
|
49
65
|
function getProductVersion(name) {
|
|
50
|
-
return
|
|
66
|
+
return info.dev ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(getProductAsarPath(name), "version"), "utf-8") : getEntryVersion();
|
|
51
67
|
}
|
|
52
68
|
var NoSuchNativeModuleError = class extends Error {
|
|
53
69
|
moduleName;
|
|
@@ -57,7 +73,7 @@ var NoSuchNativeModuleError = class extends Error {
|
|
|
57
73
|
}
|
|
58
74
|
};
|
|
59
75
|
function requireNative(packageName) {
|
|
60
|
-
const path =
|
|
76
|
+
const path = info.dev ? (0, import_node_path.join)(info.appPath, "node_modules", packageName) : packageName;
|
|
61
77
|
try {
|
|
62
78
|
return require(path);
|
|
63
79
|
} catch (error) {
|
|
@@ -101,15 +117,15 @@ function getGithubReleaseCdnGroup() {
|
|
|
101
117
|
];
|
|
102
118
|
}
|
|
103
119
|
function restartApp() {
|
|
104
|
-
import_electron.app.relaunch();
|
|
105
|
-
import_electron.app.quit();
|
|
120
|
+
import_electron.default.app.relaunch();
|
|
121
|
+
import_electron.default.app.quit();
|
|
106
122
|
}
|
|
107
123
|
function waitAppReady(duration = 1e3) {
|
|
108
124
|
return new Promise((resolve, reject) => {
|
|
109
125
|
const timeout = setTimeout(() => {
|
|
110
126
|
reject(new Error("app is not ready"));
|
|
111
127
|
}, duration);
|
|
112
|
-
import_electron.app.whenReady().then(() => {
|
|
128
|
+
import_electron.default.app.whenReady().then(() => {
|
|
113
129
|
clearTimeout(timeout);
|
|
114
130
|
resolve();
|
|
115
131
|
});
|
|
@@ -173,7 +189,7 @@ function parseVersion(version) {
|
|
|
173
189
|
ret.stage = stage;
|
|
174
190
|
ret.stageVersion = Number(_v) || -1;
|
|
175
191
|
}
|
|
176
|
-
if (isNaN(major) || isNaN(minor) || isNaN(patch) || isNaN(ret.stageVersion)) {
|
|
192
|
+
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) {
|
|
177
193
|
throw new TypeError(`invalid version: ${version}`);
|
|
178
194
|
}
|
|
179
195
|
return ret;
|
|
@@ -187,6 +203,7 @@ function parseVersion(version) {
|
|
|
187
203
|
getProductAsarPath,
|
|
188
204
|
getProductVersion,
|
|
189
205
|
handleUnexpectedErrors,
|
|
206
|
+
info,
|
|
190
207
|
parseGithubCdnURL,
|
|
191
208
|
parseVersion,
|
|
192
209
|
requireNative,
|
package/dist/utils.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
getProductAsarPath,
|
|
7
7
|
getProductVersion,
|
|
8
8
|
handleUnexpectedErrors,
|
|
9
|
+
info,
|
|
9
10
|
parseGithubCdnURL,
|
|
10
11
|
parseVersion,
|
|
11
12
|
requireNative,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
unzipFile,
|
|
14
15
|
waitAppReady,
|
|
15
16
|
zipFile
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-7R4GHFED.mjs";
|
|
17
18
|
import "./chunk-ZFXKCRJC.mjs";
|
|
18
19
|
export {
|
|
19
20
|
NoSuchNativeModuleError,
|
|
@@ -23,6 +24,7 @@ export {
|
|
|
23
24
|
getProductAsarPath,
|
|
24
25
|
getProductVersion,
|
|
25
26
|
handleUnexpectedErrors,
|
|
27
|
+
info,
|
|
26
28
|
parseGithubCdnURL,
|
|
27
29
|
parseVersion,
|
|
28
30
|
requireNative,
|
package/dist/vite.d.mts
CHANGED
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/vite.ts
|
|
@@ -23,17 +33,16 @@ __export(vite_exports, {
|
|
|
23
33
|
ElectronUpdater: () => ElectronUpdater
|
|
24
34
|
});
|
|
25
35
|
module.exports = __toCommonJS(vite_exports);
|
|
26
|
-
var
|
|
36
|
+
var import_vite2 = require("vite");
|
|
27
37
|
|
|
28
38
|
// src/build-plugins/build.ts
|
|
29
39
|
var import_promises = require("fs/promises");
|
|
30
40
|
var import_node_fs2 = require("fs");
|
|
31
|
-
var import_asar = require("@electron/asar");
|
|
32
|
-
var
|
|
41
|
+
var import_asar = __toESM(require("@electron/asar"));
|
|
42
|
+
var import_vite = require("vite");
|
|
33
43
|
|
|
34
44
|
// src/crypto.ts
|
|
35
45
|
var import_node_crypto = require("crypto");
|
|
36
|
-
var import_node_buffer = require("buffer");
|
|
37
46
|
function encrypt(plainText, key2, iv) {
|
|
38
47
|
const cipher = (0, import_node_crypto.createCipheriv)("aes-256-cbc", key2, iv);
|
|
39
48
|
let encrypted = cipher.update(plainText, "utf8", "base64url");
|
|
@@ -42,7 +51,7 @@ function encrypt(plainText, key2, iv) {
|
|
|
42
51
|
}
|
|
43
52
|
function key(data, length) {
|
|
44
53
|
const hash = (0, import_node_crypto.createHash)("SHA256").update(data).digest("binary");
|
|
45
|
-
return
|
|
54
|
+
return Buffer.from(hash).subarray(0, length);
|
|
46
55
|
}
|
|
47
56
|
var signature = (buffer, privateKey, cert, version) => {
|
|
48
57
|
const sig = (0, import_node_crypto.createSign)("RSA-SHA256").update(buffer).sign((0, import_node_crypto.createPrivateKey)(privateKey), "base64");
|
|
@@ -53,7 +62,12 @@ var signature = (buffer, privateKey, cert, version) => {
|
|
|
53
62
|
var import_node_fs = require("fs");
|
|
54
63
|
var import_node_path = require("path");
|
|
55
64
|
var import_node_zlib = require("zlib");
|
|
56
|
-
var import_electron = require("electron");
|
|
65
|
+
var import_electron = __toESM(require("electron"));
|
|
66
|
+
var info = {
|
|
67
|
+
dev: !import_electron.default.app?.isPackaged,
|
|
68
|
+
platform: process.platform === "win32" ? "win" : process.platform === "darwin" ? "mac" : "linux",
|
|
69
|
+
appPath: import_electron.default.app?.getAppPath()
|
|
70
|
+
};
|
|
57
71
|
async function zipFile(filePath, targetFilePath = `${filePath}.gz`) {
|
|
58
72
|
if (!(0, import_node_fs.existsSync)(filePath)) {
|
|
59
73
|
throw new Error(`path to be zipped not exist: ${filePath}`);
|
|
@@ -88,7 +102,7 @@ function parseVersion(version) {
|
|
|
88
102
|
ret.stage = stage;
|
|
89
103
|
ret.stageVersion = Number(_v) || -1;
|
|
90
104
|
}
|
|
91
|
-
if (isNaN(major) || isNaN(minor) || isNaN(patch) || isNaN(ret.stageVersion)) {
|
|
105
|
+
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || Number.isNaN(ret.stageVersion)) {
|
|
92
106
|
throw new TypeError(`invalid version: ${version}`);
|
|
93
107
|
}
|
|
94
108
|
return ret;
|
|
@@ -110,7 +124,7 @@ async function buildAsar({
|
|
|
110
124
|
}) {
|
|
111
125
|
await (0, import_promises.rename)(rendererDistPath, `${electronDistPath}/renderer`);
|
|
112
126
|
await (0, import_promises.writeFile)(`${electronDistPath}/version`, version);
|
|
113
|
-
await
|
|
127
|
+
await import_asar.default.createPackage(electronDistPath, asarOutputPath);
|
|
114
128
|
await zipFile(asarOutputPath, gzipPath);
|
|
115
129
|
}
|
|
116
130
|
async function buildVersion({
|
|
@@ -170,13 +184,21 @@ async function buildEntry({
|
|
|
170
184
|
entryOutputPath: outfile,
|
|
171
185
|
minify
|
|
172
186
|
}) {
|
|
173
|
-
await (0,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
187
|
+
await (0, import_vite.build)({
|
|
188
|
+
build: {
|
|
189
|
+
lib: {
|
|
190
|
+
entry: entryPath,
|
|
191
|
+
formats: ["cjs"]
|
|
192
|
+
},
|
|
193
|
+
minify,
|
|
194
|
+
rollupOptions: {
|
|
195
|
+
treeshake: true,
|
|
196
|
+
external: ["electron", "original-fs"],
|
|
197
|
+
output: {
|
|
198
|
+
file: outfile
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
180
202
|
});
|
|
181
203
|
}
|
|
182
204
|
|
|
@@ -203,7 +225,7 @@ function generateKeyPair(keyLength, subject, days, privateKeyPath, certPath) {
|
|
|
203
225
|
}
|
|
204
226
|
function writeCertToMain(entryPath, cert) {
|
|
205
227
|
const file = (0, import_node_fs3.readFileSync)(entryPath, "utf-8");
|
|
206
|
-
const regex = /const SIGNATURE_CERT
|
|
228
|
+
const regex = /const SIGNATURE_CERT\s*=\s*['"`][\s\S]*?['"`]/;
|
|
207
229
|
const replacement = `const SIGNATURE_CERT = \`${cert}\``;
|
|
208
230
|
let replaced = file;
|
|
209
231
|
const signaturePubExists = regex.test(file);
|
|
@@ -331,7 +353,7 @@ function ElectronUpdater(options) {
|
|
|
331
353
|
const { entryPath, entryOutputPath } = buildEntryOption;
|
|
332
354
|
const { asarOutputPath } = buildAsarOption;
|
|
333
355
|
const id = "electron-incremental-updater";
|
|
334
|
-
const log = (0,
|
|
356
|
+
const log = (0, import_vite2.createLogger)("info", { prefix: `[${id}]` });
|
|
335
357
|
return {
|
|
336
358
|
name: `vite-plugin-${id}`,
|
|
337
359
|
enforce: "post",
|
package/dist/vite.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
signature
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GXZSAUBR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
parseVersion,
|
|
6
6
|
zipFile
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7R4GHFED.mjs";
|
|
8
8
|
import {
|
|
9
9
|
isUpdateJSON
|
|
10
10
|
} from "./chunk-2JVXVTC5.mjs";
|
|
@@ -16,8 +16,8 @@ import { createLogger } from "vite";
|
|
|
16
16
|
// src/build-plugins/build.ts
|
|
17
17
|
import { readFile, rename, writeFile } from "node:fs/promises";
|
|
18
18
|
import { existsSync } from "node:fs";
|
|
19
|
-
import
|
|
20
|
-
import { build } from "
|
|
19
|
+
import Asar from "@electron/asar";
|
|
20
|
+
import { build } from "vite";
|
|
21
21
|
async function buildAsar({
|
|
22
22
|
version,
|
|
23
23
|
asarOutputPath,
|
|
@@ -27,7 +27,7 @@ async function buildAsar({
|
|
|
27
27
|
}) {
|
|
28
28
|
await rename(rendererDistPath, `${electronDistPath}/renderer`);
|
|
29
29
|
await writeFile(`${electronDistPath}/version`, version);
|
|
30
|
-
await createPackage(electronDistPath, asarOutputPath);
|
|
30
|
+
await Asar.createPackage(electronDistPath, asarOutputPath);
|
|
31
31
|
await zipFile(asarOutputPath, gzipPath);
|
|
32
32
|
}
|
|
33
33
|
async function buildVersion({
|
|
@@ -88,12 +88,20 @@ async function buildEntry({
|
|
|
88
88
|
minify
|
|
89
89
|
}) {
|
|
90
90
|
await build({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
build: {
|
|
92
|
+
lib: {
|
|
93
|
+
entry: entryPath,
|
|
94
|
+
formats: ["cjs"]
|
|
95
|
+
},
|
|
96
|
+
minify,
|
|
97
|
+
rollupOptions: {
|
|
98
|
+
treeshake: true,
|
|
99
|
+
external: ["electron", "original-fs"],
|
|
100
|
+
output: {
|
|
101
|
+
file: outfile
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
107
|
|
|
@@ -120,7 +128,7 @@ function generateKeyPair(keyLength, subject, days, privateKeyPath, certPath) {
|
|
|
120
128
|
}
|
|
121
129
|
function writeCertToMain(entryPath, cert) {
|
|
122
130
|
const file = readFileSync(entryPath, "utf-8");
|
|
123
|
-
const regex = /const SIGNATURE_CERT
|
|
131
|
+
const regex = /const SIGNATURE_CERT\s*=\s*['"`][\s\S]*?['"`]/;
|
|
124
132
|
const replacement = `const SIGNATURE_CERT = \`${cert}\``;
|
|
125
133
|
let replaced = file;
|
|
126
134
|
const signaturePubExists = regex.test(file);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-incremental-update",
|
|
3
3
|
"author": "subframe7536",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.3",
|
|
5
5
|
"description": "electron incremental update tools, powered by vite",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsup && node fix-module.js",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"updater"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@subframe7536/eslint-config": "^0.
|
|
47
|
-
"@types/node": "^20.
|
|
46
|
+
"@subframe7536/eslint-config": "^0.2.5",
|
|
47
|
+
"@types/node": "^20.5.1",
|
|
48
48
|
"bumpp": "^9.1.1",
|
|
49
|
-
"electron": "^
|
|
50
|
-
"eslint": "^8.
|
|
51
|
-
"tsup": "^7.
|
|
52
|
-
"typescript": "^5.1.
|
|
53
|
-
"
|
|
54
|
-
"vitest": "^0.32.2"
|
|
49
|
+
"electron": "^26.0.0",
|
|
50
|
+
"eslint": "^8.47.0",
|
|
51
|
+
"tsup": "^7.2.0",
|
|
52
|
+
"typescript": "^5.1.6",
|
|
53
|
+
"vitest": "^0.34.2"
|
|
55
54
|
},
|
|
56
55
|
"dependencies": {
|
|
57
56
|
"@electron/asar": "^3.2.4",
|
|
58
57
|
"ci-info": "^3.8.0",
|
|
59
|
-
"selfsigned": "^2.1.1"
|
|
58
|
+
"selfsigned": "^2.1.1",
|
|
59
|
+
"vite": "^4.4.9"
|
|
60
60
|
}
|
|
61
61
|
}
|