electron-incremental-update 0.2.1 → 0.2.2
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.cjs +28 -26
- package/dist/index.d.ts +8 -4
- package/dist/index.mjs +26 -25
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34,8 +34,9 @@ __export(src_exports, {
|
|
|
34
34
|
getAppAsarPath: () => getAppAsarPath,
|
|
35
35
|
getAppVersion: () => getAppVersion,
|
|
36
36
|
getEntryVersion: () => getEntryVersion,
|
|
37
|
-
|
|
37
|
+
getGithubReleaseCdnGroup: () => getGithubReleaseCdnGroup,
|
|
38
38
|
initApp: () => initApp,
|
|
39
|
+
parseGithubCdnURL: () => parseGithubCdnURL,
|
|
39
40
|
requireNative: () => requireNative
|
|
40
41
|
});
|
|
41
42
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -130,37 +131,37 @@ function getEntryVersion() {
|
|
|
130
131
|
return import_electron.app.getVersion();
|
|
131
132
|
}
|
|
132
133
|
function getAppVersion(name) {
|
|
133
|
-
return import_electron.app.isPackaged ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(getAppAsarPath(name), "version"), "utf-8")
|
|
134
|
+
return import_electron.app.isPackaged ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(getAppAsarPath(name), "version"), "utf-8") : getEntryVersion();
|
|
134
135
|
}
|
|
135
136
|
function requireNative(packageName) {
|
|
136
137
|
const path = import_electron.app.isPackaged ? (0, import_node_path.join)(import_electron.app.getAppPath(), "node_modules", packageName) : packageName;
|
|
137
138
|
return require(path);
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
throw new Error("URL must start with 'https://github.com/'");
|
|
140
|
+
function parseGithubCdnURL(repository, cdnPrefix, relativeFilePath) {
|
|
141
|
+
if (!repository.startsWith("https://github.com/")) {
|
|
142
|
+
throw new Error("url must start with https://github.com/");
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
repository = repository.trim().replace(/\/?$/, "/").trim();
|
|
145
|
+
relativeFilePath = relativeFilePath.trim().replace(/^\/|\/?$/g, "").trim();
|
|
146
|
+
cdnPrefix = cdnPrefix.trim().replace(/^\/?|\/?$/g, "").trim();
|
|
147
|
+
return repository.replace("github.com", cdnPrefix) + relativeFilePath;
|
|
148
|
+
}
|
|
149
|
+
function getGithubReleaseCdnGroup() {
|
|
148
150
|
return [
|
|
149
|
-
{
|
|
150
|
-
{
|
|
151
|
-
{
|
|
152
|
-
{
|
|
153
|
-
{
|
|
154
|
-
{
|
|
155
|
-
{
|
|
156
|
-
{
|
|
157
|
-
{
|
|
158
|
-
{
|
|
159
|
-
{
|
|
160
|
-
{
|
|
161
|
-
{
|
|
162
|
-
{
|
|
163
|
-
{ url: `https://download.nuaa.cf/${_url}`, maintainer: "LibraryCloud-nuaa" }
|
|
151
|
+
{ cdnPrefix: "gh.gh2233.ml", maintainer: "@X.I.U/XIU2" },
|
|
152
|
+
{ cdnPrefix: "ghproxy.com", maintainer: "gh-proxy" },
|
|
153
|
+
{ cdnPrefix: "gh.ddlc.top", maintainer: "@mtr-static-official" },
|
|
154
|
+
{ cdnPrefix: "ghdl.feizhuqwq.cf", maintainer: "feizhuqwq.com" },
|
|
155
|
+
{ cdnPrefix: "slink.ltd", maintainer: "\u77E5\u4E86\u5C0F\u7AD9" },
|
|
156
|
+
{ cdnPrefix: "git.xfj0.cn", maintainer: "anonymous1" },
|
|
157
|
+
{ cdnPrefix: "gh.con.sh", maintainer: "anonymous2" },
|
|
158
|
+
{ cdnPrefix: "ghps.cc", maintainer: "anonymous3" },
|
|
159
|
+
{ cdnPrefix: "cors.isteed.cc/github.com", maintainer: "Lufs's" },
|
|
160
|
+
{ cdnPrefix: "hub.gitmirror.com", maintainer: "GitMirror" },
|
|
161
|
+
{ cdnPrefix: "js.xxooo.ml", maintainer: "\u996D\u592A\u786C" },
|
|
162
|
+
{ cdnPrefix: "download.njuu.cf", maintainer: "LibraryCloud-njuu" },
|
|
163
|
+
{ cdnPrefix: "download.yzuu.cf", maintainer: "LibraryCloud-yzuu" },
|
|
164
|
+
{ cdnPrefix: "download.nuaa.cf", maintainer: "LibraryCloud-nuaa" }
|
|
164
165
|
];
|
|
165
166
|
}
|
|
166
167
|
|
|
@@ -310,7 +311,8 @@ function initApp(productName, updater, option) {
|
|
|
310
311
|
getAppAsarPath,
|
|
311
312
|
getAppVersion,
|
|
312
313
|
getEntryVersion,
|
|
313
|
-
|
|
314
|
+
getGithubReleaseCdnGroup,
|
|
314
315
|
initApp,
|
|
316
|
+
parseGithubCdnURL,
|
|
315
317
|
requireNative
|
|
316
318
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -123,10 +123,14 @@ declare function getAppVersion(name: string): string;
|
|
|
123
123
|
*/
|
|
124
124
|
declare function requireNative<T = any>(packageName: string): T;
|
|
125
125
|
/**
|
|
126
|
-
* get
|
|
126
|
+
* get github version.json CDN URL for accelerating the speed of downloading version info
|
|
127
127
|
*/
|
|
128
|
-
declare function
|
|
129
|
-
|
|
128
|
+
declare function parseGithubCdnURL(repository: string, cdnPrefix: string, relativeFilePath: string): string;
|
|
129
|
+
/**
|
|
130
|
+
* get group of github release CDN prefix for accelerating the speed of downloading release
|
|
131
|
+
*/
|
|
132
|
+
declare function getGithubReleaseCdnGroup(): {
|
|
133
|
+
cdnPrefix: string;
|
|
130
134
|
maintainer: string;
|
|
131
135
|
}[];
|
|
132
136
|
|
|
@@ -189,4 +193,4 @@ declare function initApp(productName: string, updater: Updater | Omit<UpdaterOpt
|
|
|
189
193
|
productName?: string;
|
|
190
194
|
}, option?: AppOption): any;
|
|
191
195
|
|
|
192
|
-
export { BaseOption, CheckResultType, UpdateJSON, Updater, UpdaterOption, createUpdater, getAppAsarPath, getAppVersion, getEntryVersion,
|
|
196
|
+
export { BaseOption, CheckResultType, UpdateJSON, Updater, UpdaterOption, createUpdater, getAppAsarPath, getAppVersion, getEntryVersion, getGithubReleaseCdnGroup, initApp, parseGithubCdnURL, requireNative };
|
package/dist/index.mjs
CHANGED
|
@@ -94,37 +94,37 @@ function getEntryVersion() {
|
|
|
94
94
|
return app.getVersion();
|
|
95
95
|
}
|
|
96
96
|
function getAppVersion(name) {
|
|
97
|
-
return app.isPackaged ? readFileSync(join(getAppAsarPath(name), "version"), "utf-8")
|
|
97
|
+
return app.isPackaged ? readFileSync(join(getAppAsarPath(name), "version"), "utf-8") : getEntryVersion();
|
|
98
98
|
}
|
|
99
99
|
function requireNative(packageName) {
|
|
100
100
|
const path = app.isPackaged ? join(app.getAppPath(), "node_modules", packageName) : packageName;
|
|
101
101
|
return __require(path);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
throw new Error("URL must start with 'https://github.com/'");
|
|
103
|
+
function parseGithubCdnURL(repository, cdnPrefix, relativeFilePath) {
|
|
104
|
+
if (!repository.startsWith("https://github.com/")) {
|
|
105
|
+
throw new Error("url must start with https://github.com/");
|
|
107
106
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
repository = repository.trim().replace(/\/?$/, "/").trim();
|
|
108
|
+
relativeFilePath = relativeFilePath.trim().replace(/^\/|\/?$/g, "").trim();
|
|
109
|
+
cdnPrefix = cdnPrefix.trim().replace(/^\/?|\/?$/g, "").trim();
|
|
110
|
+
return repository.replace("github.com", cdnPrefix) + relativeFilePath;
|
|
111
|
+
}
|
|
112
|
+
function getGithubReleaseCdnGroup() {
|
|
112
113
|
return [
|
|
113
|
-
{
|
|
114
|
-
{
|
|
115
|
-
{
|
|
116
|
-
{
|
|
117
|
-
{
|
|
118
|
-
{
|
|
119
|
-
{
|
|
120
|
-
{
|
|
121
|
-
{
|
|
122
|
-
{
|
|
123
|
-
{
|
|
124
|
-
{
|
|
125
|
-
{
|
|
126
|
-
{
|
|
127
|
-
{ url: `https://download.nuaa.cf/${_url}`, maintainer: "LibraryCloud-nuaa" }
|
|
114
|
+
{ cdnPrefix: "gh.gh2233.ml", maintainer: "@X.I.U/XIU2" },
|
|
115
|
+
{ cdnPrefix: "ghproxy.com", maintainer: "gh-proxy" },
|
|
116
|
+
{ cdnPrefix: "gh.ddlc.top", maintainer: "@mtr-static-official" },
|
|
117
|
+
{ cdnPrefix: "ghdl.feizhuqwq.cf", maintainer: "feizhuqwq.com" },
|
|
118
|
+
{ cdnPrefix: "slink.ltd", maintainer: "\u77E5\u4E86\u5C0F\u7AD9" },
|
|
119
|
+
{ cdnPrefix: "git.xfj0.cn", maintainer: "anonymous1" },
|
|
120
|
+
{ cdnPrefix: "gh.con.sh", maintainer: "anonymous2" },
|
|
121
|
+
{ cdnPrefix: "ghps.cc", maintainer: "anonymous3" },
|
|
122
|
+
{ cdnPrefix: "cors.isteed.cc/github.com", maintainer: "Lufs's" },
|
|
123
|
+
{ cdnPrefix: "hub.gitmirror.com", maintainer: "GitMirror" },
|
|
124
|
+
{ cdnPrefix: "js.xxooo.ml", maintainer: "\u996D\u592A\u786C" },
|
|
125
|
+
{ cdnPrefix: "download.njuu.cf", maintainer: "LibraryCloud-njuu" },
|
|
126
|
+
{ cdnPrefix: "download.yzuu.cf", maintainer: "LibraryCloud-yzuu" },
|
|
127
|
+
{ cdnPrefix: "download.nuaa.cf", maintainer: "LibraryCloud-nuaa" }
|
|
128
128
|
];
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -273,7 +273,8 @@ export {
|
|
|
273
273
|
getAppAsarPath,
|
|
274
274
|
getAppVersion,
|
|
275
275
|
getEntryVersion,
|
|
276
|
-
|
|
276
|
+
getGithubReleaseCdnGroup,
|
|
277
277
|
initApp,
|
|
278
|
+
parseGithubCdnURL,
|
|
278
279
|
requireNative
|
|
279
280
|
};
|