electron-smallest-updater 0.0.2 → 0.1.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/README.md +5 -6
- package/dist/builder.js +3 -7
- package/dist/types.d.ts +0 -1
- package/dist/updater.js +6 -0
- package/dist/utils.js +1 -2
- package/package.json +1 -1
- package/dist/core.d.ts +0 -1
- package/dist/core.js +0 -2
package/README.md
CHANGED
|
@@ -52,11 +52,11 @@ exports.default = async (context) => {
|
|
|
52
52
|
|
|
53
53
|
### 配置
|
|
54
54
|
|
|
55
|
-
| 名称 | 描述 | 默认值
|
|
56
|
-
| --------- | ---------------- |
|
|
57
|
-
| channel | 更新频道名称 | latest-smallest.json
|
|
58
|
-
| resources | 生成压缩包的资源 | \['app.asar', 'app
|
|
59
|
-
| urlPrefix | 文件资源路径前缀 |
|
|
55
|
+
| 名称 | 描述 | 默认值 |
|
|
56
|
+
| --------- | ---------------- | ---------------------------------------------------- |
|
|
57
|
+
| channel | 更新频道名称 | latest-smallest.json |
|
|
58
|
+
| resources | 生成压缩包的资源 | \['app.asar', 'app/\*\*', 'app.asar.unpacked/\*\*'\] |
|
|
59
|
+
| urlPrefix | 文件资源路径前缀 | |
|
|
60
60
|
|
|
61
61
|
## 使用
|
|
62
62
|
|
|
@@ -177,7 +177,6 @@ export function initSmallestUpdater(mainWindow: BrowserWindow): SmallestUpdater
|
|
|
177
177
|
| update-not-available | 更新不可用 | (info: UpdateInfo) => void |
|
|
178
178
|
| update-downloaded | 更新下载完成 | (event: UpdateDownloadedInfo) => void |
|
|
179
179
|
| download-progress | 更新下载进度 | (info: ProgressInfo) => void |
|
|
180
|
-
| update-cancelled | 更新取消 | (info: UpdateInfo) => void |
|
|
181
180
|
|
|
182
181
|
**UpdateInfo**
|
|
183
182
|
|
package/dist/builder.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.smallestBuilder =
|
|
15
|
+
exports.smallestBuilder = smallestBuilder;
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
18
18
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
@@ -31,14 +31,11 @@ function smallestBuilder(context, options) {
|
|
|
31
31
|
const outResourceFilePath = path_1.default.join(context.outDir, outResourceFileName);
|
|
32
32
|
// find resources
|
|
33
33
|
let resourcesPath;
|
|
34
|
-
if (platform === '
|
|
35
|
-
resourcesPath = path_1.default.join(context.appOutDir, 'resources');
|
|
36
|
-
}
|
|
37
|
-
else if (platform === 'darwin') {
|
|
34
|
+
if (platform === 'darwin') {
|
|
38
35
|
resourcesPath = path_1.default.join(context.appOutDir, `${appInfo.productName}.app`, 'Contents', 'Resources');
|
|
39
36
|
}
|
|
40
37
|
else {
|
|
41
|
-
|
|
38
|
+
resourcesPath = path_1.default.join(context.appOutDir, 'resources');
|
|
42
39
|
}
|
|
43
40
|
// write zip file
|
|
44
41
|
const zip = new adm_zip_1.default();
|
|
@@ -66,4 +63,3 @@ function smallestBuilder(context, options) {
|
|
|
66
63
|
yield fs_extra_1.default.writeJSON(outChannelPath, publishJSON, { spaces: 2 });
|
|
67
64
|
});
|
|
68
65
|
}
|
|
69
|
-
exports.smallestBuilder = smallestBuilder;
|
package/dist/types.d.ts
CHANGED
|
@@ -45,7 +45,6 @@ export interface SmallestUpdaterEvents {
|
|
|
45
45
|
'update-available': (info: UpdateInfo) => void;
|
|
46
46
|
'update-downloaded': (event: UpdateDownloadedInfo) => void;
|
|
47
47
|
'download-progress': (info: ProgressInfo) => void;
|
|
48
|
-
'update-cancelled': (info: UpdateInfo) => void;
|
|
49
48
|
}
|
|
50
49
|
export interface SmallestBuilderOptions {
|
|
51
50
|
channel?: string;
|
package/dist/updater.js
CHANGED
|
@@ -89,6 +89,7 @@ class SmallestUpdater extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
89
89
|
else {
|
|
90
90
|
this.emit('update-not-available', updateInfo);
|
|
91
91
|
this.logger.info(`Update for version ${currentVersion} is not available (latest version: ${latestVersion}`);
|
|
92
|
+
return;
|
|
92
93
|
}
|
|
93
94
|
this.updateInfo = updateInfo;
|
|
94
95
|
this.downloadUrl = this.formatDownloadUrl(updateInfo.releaseFile.url);
|
|
@@ -153,9 +154,14 @@ class SmallestUpdater extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
153
154
|
}
|
|
154
155
|
// unzip
|
|
155
156
|
try {
|
|
157
|
+
/**
|
|
158
|
+
* @link https://stackoverflow.com/questions/43645745/electron-invalid-package-on-unzip
|
|
159
|
+
*/
|
|
160
|
+
process.noAsar = true;
|
|
156
161
|
this.logger.info(`Extract to ${downloadUnzipPath}`);
|
|
157
162
|
const zip = new adm_zip_1.default(downloadFilePath);
|
|
158
163
|
zip.extractAllTo(downloadUnzipPath, true);
|
|
164
|
+
process.noAsar = false;
|
|
159
165
|
}
|
|
160
166
|
catch (error) {
|
|
161
167
|
this.emit('error', error, `Extract error: ${error.message}`);
|
package/dist/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.calcSha512 =
|
|
6
|
+
exports.calcSha512 = calcSha512;
|
|
7
7
|
const crypto_1 = __importDefault(require("crypto"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
function calcSha512(filePath) {
|
|
@@ -20,4 +20,3 @@ function calcSha512(filePath) {
|
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
exports.calcSha512 = calcSha512;
|
package/package.json
CHANGED
package/dist/core.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/core.js
DELETED