electron-version-deployer-cli 0.3.6 → 0.3.7

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
@@ -698,4 +698,4 @@ async function installPrebuilt(configs) {
698
698
  }
699
699
  commander.program.description(
700
700
  "Electron 版本部署 CLI,简化你的 Electron 软件更新,让一切变得简单。"
701
- ).helpOption("-h, --help", "使用帮助").version("0.3.6", "-V, --version", "显示版本号").parse(process.argv);
701
+ ).helpOption("-h, --help", "使用帮助").version("0.3.7", "-V, --version", "显示版本号").parse(process.argv);
package/dist/main.js CHANGED
@@ -278,21 +278,27 @@ async function installPkg(zipFile) {
278
278
  for (let fileName of fullCodeSplitIndexFile) {
279
279
  const tmpFilePath = node_path.join(appPath, fileName);
280
280
  const tmpSplitZip = node_fs.createWriteStream(tmpFilePath);
281
- const response = await netRequest({
282
- url: `${remoteUrl}/fullCodeZipSplitZips/${fileName}?hash=${Math.random()}`,
283
- responseType: "stream"
284
- });
285
- await new Promise((streamRes, streamRej) => {
286
- response.on("data", (chunk) => {
287
- tmpSplitZip.write(chunk);
281
+ await new Promise((_res, _rej) => {
282
+ const request = electron.net.request({
283
+ url: `${remoteUrl}/fullCodeZipSplitZips/${fileName}?hash=${Math.random()}`,
284
+ method: "GET"
288
285
  });
289
- response.on("end", () => {
290
- tmpSplitZip.end(() => {
291
- mergedStream.write(node_fs.readFileSync(tmpFilePath));
292
- streamRes();
286
+ request.on("response", (response) => {
287
+ response.pipe(tmpSplitZip).on("finish", () => {
288
+ tmpSplitZip.end(() => {
289
+ mergedStream.write(node_fs.readFileSync(tmpFilePath));
290
+ _res();
291
+ });
292
+ }).on("error", (error) => {
293
+ _rej(error);
293
294
  });
294
295
  });
295
- response.on("error", streamRej);
296
+ request.on("error", (error) => {
297
+ _rej(error);
298
+ });
299
+ request.end();
300
+ }).catch((error) => {
301
+ rej(error);
296
302
  });
297
303
  forceDeleteSync(tmpFilePath);
298
304
  }
@@ -301,22 +307,23 @@ async function installPkg(zipFile) {
301
307
  });
302
308
  } else {
303
309
  const tmpZipFilePath = node_fs.createWriteStream(unzipPath + ".zip");
304
- const response = await netRequest({
310
+ const request = electron.net.request({
305
311
  url: `${remoteUrl}/${zipFile}?hash=${Math.random()}`,
306
- responseType: "stream"
312
+ method: "GET"
307
313
  });
308
- await new Promise((streamRes, streamRej) => {
309
- response.on("data", (chunk) => {
310
- tmpZipFilePath.write(chunk);
311
- });
312
- response.on("end", () => {
314
+ request.on("response", (response) => {
315
+ response.pipe(tmpZipFilePath).on("finish", () => {
313
316
  tmpZipFilePath.end(() => {
314
- streamRes();
317
+ res();
315
318
  });
319
+ }).on("error", (error) => {
320
+ rej(error);
316
321
  });
317
- response.on("error", streamRej);
318
322
  });
319
- res();
323
+ request.on("error", (error) => {
324
+ rej(error);
325
+ });
326
+ request.end();
320
327
  }
321
328
  });
322
329
  await extract(unzipPath + ".zip", { dir: unzipPath });
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.6",
4
+ "version": "0.3.7",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.cjs.js",
7
7
  "module": "./dist/index.es.js",