electron-version-deployer-cli 0.3.4 → 0.3.6

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/cli.cjs CHANGED
@@ -337,6 +337,20 @@ function genTmpFolder() {
337
337
  node_fs.mkdirSync(folderPath);
338
338
  }
339
339
  async function netRequest(options) {
340
+ if (!electron.net) {
341
+ const response = await fetch(options.url);
342
+ if (options.responseType === "json") {
343
+ try {
344
+ return await response.json();
345
+ } catch (e) {
346
+ return null;
347
+ }
348
+ } else if (options.responseType === "stream") {
349
+ return response.body;
350
+ } else {
351
+ return await response.text();
352
+ }
353
+ }
340
354
  return new Promise((resolve, reject) => {
341
355
  const request = electron.net.request(options.url);
342
356
  let data = "";
@@ -684,4 +698,4 @@ async function installPrebuilt(configs) {
684
698
  }
685
699
  commander.program.description(
686
700
  "Electron 版本部署 CLI,简化你的 Electron 软件更新,让一切变得简单。"
687
- ).helpOption("-h, --help", "使用帮助").version("0.3.4", "-V, --version", "显示版本号").parse(process.argv);
701
+ ).helpOption("-h, --help", "使用帮助").version("0.3.6", "-V, --version", "显示版本号").parse(process.argv);
package/dist/main.js CHANGED
@@ -9,6 +9,20 @@ const fs = require("fs");
9
9
  const path = require("path");
10
10
  const extract = require("extract-zip");
11
11
  async function netRequest(options) {
12
+ if (!electron.net) {
13
+ const response = await fetch(options.url);
14
+ if (options.responseType === "json") {
15
+ try {
16
+ return await response.json();
17
+ } catch (e) {
18
+ return null;
19
+ }
20
+ } else if (options.responseType === "stream") {
21
+ return response.body;
22
+ } else {
23
+ return await response.text();
24
+ }
25
+ }
12
26
  return new Promise((resolve, reject) => {
13
27
  const request = electron.net.request(options.url);
14
28
  let data = "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron-version-deployer-cli",
3
3
  "private": false,
4
- "version": "0.3.4",
4
+ "version": "0.3.6",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.cjs.js",
7
7
  "module": "./dist/index.es.js",
@@ -34,10 +34,10 @@
34
34
  "tsc-alias": "^1.8.6",
35
35
  "typescript": "^5.0.2",
36
36
  "vite": "^4.3.9",
37
- "wrangler": "^3.3.0"
37
+ "wrangler": "^3.3.0",
38
+ "electron": "^25.3.2"
38
39
  },
39
40
  "dependencies": {
40
- "electron": "^25.3.2",
41
41
  "archiver": "^5.3.1",
42
42
  "extract-zip": "^2.0.1",
43
43
  "pkg-up": "3.1.0"