nw-builder 4.4.2-beta.3 → 4.4.2-beta.4

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.
Files changed (2) hide show
  1. package/package.json +8 -7
  2. package/src/get.js +20 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.4.2-beta.3",
3
+ "version": "4.4.2-beta.4",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -55,25 +55,26 @@
55
55
  "devDependencies": {
56
56
  "concurrently": "^8.2.1",
57
57
  "eslint": "^8.52.0",
58
- "eslint-config-tjw-jsdoc": "^1.0.4",
58
+ "eslint-config-tjw-jsdoc": "^1.0.5",
59
59
  "gh-pages": "^6.0.0",
60
60
  "jsdoc": "^4.0.2",
61
61
  "jsdoc-to-markdown": "^8.0.0",
62
62
  "prettier": "^3.0.3",
63
- "selenium-webdriver": "^4.14.0",
64
- "vitepress": "^1.0.0-rc.21"
63
+ "selenium-webdriver": "^4.15.0",
64
+ "vitepress": "^1.0.0-rc.24"
65
65
  },
66
66
  "dependencies": {
67
67
  "cli-progress": "^3.12.0",
68
68
  "compressing": "^1.10.0",
69
69
  "glob": "^10.3.10",
70
- "node-gyp": "^9.4.0",
70
+ "node-gyp": "^10.0.1",
71
71
  "plist": "^3.1.0",
72
72
  "rcedit": "^4.0.0",
73
73
  "winston": "^3.11.0",
74
- "yargs": "^17.7.2"
74
+ "yargs": "^17.7.2",
75
+ "yauzl-promise": "^4.0.0"
75
76
  },
76
- "packageManager": "npm@10.2.0",
77
+ "packageManager": "npm@10.2.3",
77
78
  "engines": {
78
79
  "node": ">=14"
79
80
  }
package/src/get.js CHANGED
@@ -1,12 +1,15 @@
1
- import { exec, spawnSync } from "node:child_process";
1
+ import { exec } from "node:child_process";
2
2
  import { createWriteStream, existsSync } from "node:fs";
3
+ import { mkdir } from "node:fs/promises";
3
4
  import { rename, rm } from "node:fs/promises";
4
5
  import { get as getRequest } from "node:https";
5
6
  import { resolve } from "node:path";
6
- import { arch as ARCH, platform as PLATFORM, exit as EXIT } from "node:process";
7
+ import { arch as ARCH, platform as PLATFORM } from "node:process";
8
+ import { pipeline } from "node:stream";
7
9
 
8
10
  import progress from "cli-progress";
9
11
  import compressing from "compressing";
12
+ import yauzl from "yauzl-promise";
10
13
 
11
14
  import { log } from "./log.js";
12
15
  import { ARCH_KV, PLATFORM_KV, replaceFfmpeg } from "./util.js";
@@ -237,24 +240,22 @@ async function getNwjs({
237
240
  );
238
241
  log.debug("Decompress NW.js binaries.");
239
242
  if (platform === "osx" && PLATFORM === "darwin") {
240
- //TODO: compressing package does not restore symlinks on some macOS (eg: circleCI)
241
- //Workaround: Do not rely on symlinks.
242
- const exec = function (cmd) {
243
- log.debug(cmd);
244
- const result = spawnSync(cmd, {
245
- shell: true,
246
- stdio: "inherit",
247
- });
248
- if (result.status !== 0) {
249
- log.debug(`Command failed with status ${result.status}`);
250
- if (result.error) {
251
- console.log(result.error);
243
+ const zip = await yauzl.open(out);
244
+ try {
245
+ for await (const entry of zip) {
246
+ if (entry.filename.endsWith("/")) {
247
+ await mkdir(`${cacheDir}/${entry.filename}`);
248
+ } else {
249
+ const readStream = await entry.openReadStream();
250
+ const writeStream = createWriteStream(
251
+ `${cacheDir}/${entry.filename}`,
252
+ );
253
+ await pipeline(readStream, writeStream);
252
254
  }
253
- EXIT(1);
254
255
  }
255
- return resolve();
256
- };
257
- exec(`unzip -o "${out}" -d "${cacheDir}"`);
256
+ } finally {
257
+ await zip.close();
258
+ }
258
259
  } else {
259
260
  await compressing[platform === "linux" ? "tgz" : "zip"].uncompress(
260
261
  out,
@@ -323,7 +324,7 @@ async function getFfmpeg({
323
324
  log.debug(`Downloading from ${url}`);
324
325
  let chunks = 0;
325
326
  bar.start(Number(response.headers["content-length"]), 0);
326
- response.on("data", async (chunk) => {
327
+ response.on("data", (chunk) => {
327
328
  chunks += chunk.length;
328
329
  bar.increment();
329
330
  bar.update(chunks);