electron-updater-for-render 1.1.2-beta.4 → 1.1.2-beta.5
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/bin/cli.cjs +2 -2
- package/dist/bin/cli.js +2 -2
- package/dist/builder/index.cjs +2 -2
- package/dist/builder/index.js +2 -2
- package/dist/main/index.cjs +4 -13
- package/dist/main/index.d.ts +0 -1
- package/dist/main/index.js +4 -13
- package/package.json +7 -5
package/dist/bin/cli.cjs
CHANGED
|
@@ -39,8 +39,8 @@ var import_fs = __toESM(require("fs"), 1);
|
|
|
39
39
|
var import_path = __toESM(require("path"), 1);
|
|
40
40
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
41
41
|
async function createUpdatePackage(options) {
|
|
42
|
-
const asar = await import("asar").catch(() => {
|
|
43
|
-
throw new Error('Please install "asar" as a devDependency to use the builder.');
|
|
42
|
+
const asar = await import("@electron/asar").catch(() => {
|
|
43
|
+
throw new Error('Please install "@electron/asar" as a devDependency to use the builder.');
|
|
44
44
|
});
|
|
45
45
|
const {
|
|
46
46
|
outDir,
|
package/dist/bin/cli.js
CHANGED
|
@@ -12,8 +12,8 @@ import fs from "fs";
|
|
|
12
12
|
import path from "path";
|
|
13
13
|
import crypto from "crypto";
|
|
14
14
|
async function createUpdatePackage(options) {
|
|
15
|
-
const asar = await import("asar").catch(() => {
|
|
16
|
-
throw new Error('Please install "asar" as a devDependency to use the builder.');
|
|
15
|
+
const asar = await import("@electron/asar").catch(() => {
|
|
16
|
+
throw new Error('Please install "@electron/asar" as a devDependency to use the builder.');
|
|
17
17
|
});
|
|
18
18
|
const {
|
|
19
19
|
outDir,
|
package/dist/builder/index.cjs
CHANGED
|
@@ -41,8 +41,8 @@ function defineConfig(config) {
|
|
|
41
41
|
return config;
|
|
42
42
|
}
|
|
43
43
|
async function createUpdatePackage(options) {
|
|
44
|
-
const asar = await import("asar").catch(() => {
|
|
45
|
-
throw new Error('Please install "asar" as a devDependency to use the builder.');
|
|
44
|
+
const asar = await import("@electron/asar").catch(() => {
|
|
45
|
+
throw new Error('Please install "@electron/asar" as a devDependency to use the builder.');
|
|
46
46
|
});
|
|
47
47
|
const {
|
|
48
48
|
outDir,
|
package/dist/builder/index.js
CHANGED
|
@@ -6,8 +6,8 @@ function defineConfig(config) {
|
|
|
6
6
|
return config;
|
|
7
7
|
}
|
|
8
8
|
async function createUpdatePackage(options) {
|
|
9
|
-
const asar = await import("asar").catch(() => {
|
|
10
|
-
throw new Error('Please install "asar" as a devDependency to use the builder.');
|
|
9
|
+
const asar = await import("@electron/asar").catch(() => {
|
|
10
|
+
throw new Error('Please install "@electron/asar" as a devDependency to use the builder.');
|
|
11
11
|
});
|
|
12
12
|
const {
|
|
13
13
|
outDir,
|
package/dist/main/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(main_exports);
|
|
|
36
36
|
var import_path2 = __toESM(require("path"), 1);
|
|
37
37
|
var import_original_fs2 = __toESM(require("original-fs"), 1);
|
|
38
38
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
39
|
+
var import_semver = __toESM(require("semver"), 1);
|
|
39
40
|
var import_electron2 = require("electron");
|
|
40
41
|
var import_promises = require("stream/promises");
|
|
41
42
|
var import_stream = require("stream");
|
|
@@ -201,7 +202,7 @@ var RenderUpdater = class {
|
|
|
201
202
|
versionDirs.push(item);
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
|
-
versionDirs.sort((a, b) =>
|
|
205
|
+
versionDirs.sort((a, b) => import_semver.default.compare(import_semver.default.coerce(b) ?? b, import_semver.default.coerce(a) ?? a));
|
|
205
206
|
const activeIdx = versionDirs.indexOf(this.activeVersion);
|
|
206
207
|
const safeVersions = /* @__PURE__ */ new Set();
|
|
207
208
|
if (activeIdx !== -1) safeVersions.add(this.activeVersion);
|
|
@@ -266,7 +267,7 @@ var RenderUpdater = class {
|
|
|
266
267
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
|
267
268
|
const remoteInfo = await response.json();
|
|
268
269
|
const currentVersion = this.activeVersion;
|
|
269
|
-
if (
|
|
270
|
+
if (import_semver.default.gt(remoteInfo.version, currentVersion)) {
|
|
270
271
|
return { updateAvailable: true, version: remoteInfo.version, info: remoteInfo };
|
|
271
272
|
}
|
|
272
273
|
return { updateAvailable: false };
|
|
@@ -376,17 +377,7 @@ var RenderUpdater = class {
|
|
|
376
377
|
);
|
|
377
378
|
this.activeVersion = version;
|
|
378
379
|
}
|
|
379
|
-
compareVersions
|
|
380
|
-
const parts1 = v1.split(".").map(Number);
|
|
381
|
-
const parts2 = v2.split(".").map(Number);
|
|
382
|
-
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
383
|
-
const n1 = parts1[i] || 0;
|
|
384
|
-
const n2 = parts2[i] || 0;
|
|
385
|
-
if (n1 > n2) return 1;
|
|
386
|
-
if (n1 < n2) return -1;
|
|
387
|
-
}
|
|
388
|
-
return 0;
|
|
389
|
-
}
|
|
380
|
+
// compareVersions 已由 semver 库替代,此方法已移除
|
|
390
381
|
/**
|
|
391
382
|
* One-stop method to check for updates, show dialogs (if autoPrompt=true),
|
|
392
383
|
* download, and restart application.
|
package/dist/main/index.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ export declare class RenderUpdater {
|
|
|
37
37
|
download(onProgress?: (percent: number) => void): Promise<void>;
|
|
38
38
|
private verifyFile;
|
|
39
39
|
private useVersion;
|
|
40
|
-
private compareVersions;
|
|
41
40
|
/**
|
|
42
41
|
* One-stop method to check for updates, show dialogs (if autoPrompt=true),
|
|
43
42
|
* download, and restart application.
|
package/dist/main/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import path2 from "path";
|
|
3
3
|
import fs2 from "original-fs";
|
|
4
4
|
import crypto from "crypto";
|
|
5
|
+
import semver from "semver";
|
|
5
6
|
import { app as app2, dialog } from "electron";
|
|
6
7
|
import { pipeline } from "stream/promises";
|
|
7
8
|
import { Readable, Transform } from "stream";
|
|
@@ -167,7 +168,7 @@ var RenderUpdater = class {
|
|
|
167
168
|
versionDirs.push(item);
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
|
-
versionDirs.sort((a, b) =>
|
|
171
|
+
versionDirs.sort((a, b) => semver.compare(semver.coerce(b) ?? b, semver.coerce(a) ?? a));
|
|
171
172
|
const activeIdx = versionDirs.indexOf(this.activeVersion);
|
|
172
173
|
const safeVersions = /* @__PURE__ */ new Set();
|
|
173
174
|
if (activeIdx !== -1) safeVersions.add(this.activeVersion);
|
|
@@ -232,7 +233,7 @@ var RenderUpdater = class {
|
|
|
232
233
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
|
233
234
|
const remoteInfo = await response.json();
|
|
234
235
|
const currentVersion = this.activeVersion;
|
|
235
|
-
if (
|
|
236
|
+
if (semver.gt(remoteInfo.version, currentVersion)) {
|
|
236
237
|
return { updateAvailable: true, version: remoteInfo.version, info: remoteInfo };
|
|
237
238
|
}
|
|
238
239
|
return { updateAvailable: false };
|
|
@@ -342,17 +343,7 @@ var RenderUpdater = class {
|
|
|
342
343
|
);
|
|
343
344
|
this.activeVersion = version;
|
|
344
345
|
}
|
|
345
|
-
compareVersions
|
|
346
|
-
const parts1 = v1.split(".").map(Number);
|
|
347
|
-
const parts2 = v2.split(".").map(Number);
|
|
348
|
-
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
349
|
-
const n1 = parts1[i] || 0;
|
|
350
|
-
const n2 = parts2[i] || 0;
|
|
351
|
-
if (n1 > n2) return 1;
|
|
352
|
-
if (n1 < n2) return -1;
|
|
353
|
-
}
|
|
354
|
-
return 0;
|
|
355
|
-
}
|
|
346
|
+
// compareVersions 已由 semver 库替代,此方法已移除
|
|
356
347
|
/**
|
|
357
348
|
* One-stop method to check for updates, show dialogs (if autoPrompt=true),
|
|
358
349
|
* download, and restart application.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-updater-for-render",
|
|
3
|
-
"version": "1.1.2-beta.
|
|
3
|
+
"version": "1.1.2-beta.5",
|
|
4
4
|
"description": "A lightweight incremental updater for Electron renderer processes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,20 +27,22 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"jiti": "^2.6.1",
|
|
30
|
-
"original-fs": "^1.2.0"
|
|
30
|
+
"original-fs": "^1.2.0",
|
|
31
|
+
"semver": "^7.7.4"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
|
-
"asar": "^3.
|
|
34
|
+
"@electron/asar": "^3.3.0",
|
|
34
35
|
"electron": ">=20.0.0"
|
|
35
36
|
},
|
|
36
37
|
"peerDependenciesMeta": {
|
|
37
|
-
"asar": {
|
|
38
|
+
"@electron/asar": {
|
|
38
39
|
"optional": true
|
|
39
40
|
}
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
43
|
+
"@electron/asar": "^4.2.0",
|
|
42
44
|
"@types/node": "^22.0.0",
|
|
43
|
-
"
|
|
45
|
+
"@types/semver": "^7.7.1",
|
|
44
46
|
"tsup": "^8.0.2",
|
|
45
47
|
"typescript": "^5.0.0"
|
|
46
48
|
},
|