nw-builder 4.5.2 → 4.5.3

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 +2 -2
  2. package/src/get.js +29 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.5.2",
3
+ "version": "4.5.3",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -44,7 +44,7 @@
44
44
  "scripts": {
45
45
  "lint": "eslint src/get.js",
46
46
  "docs": "jsdoc -d docs ./src/get.js ./src/run.js ./src/bld.js",
47
- "test": "node test/get.pre.js && node --test test/get.test.js",
47
+ "test": "node --test test/get.test.js",
48
48
  "demo": "cd test/fixture && node demo.js"
49
49
  },
50
50
  "devDependencies": {
package/src/get.js CHANGED
@@ -13,20 +13,20 @@ import util from "./util.js";
13
13
 
14
14
  /**
15
15
  * @typedef {object} GetOptions
16
- * @property {string | "latest" | "stable" | "lts"} [options.version = "latest"] Runtime version
17
- * @property {"normal" | "sdk"} [options.flavor = "normal"] Build flavor
18
- * @property {"linux" | "osx" | "win"} [options.platform] Target platform
19
- * @property {"ia32" | "x64" | "arm64"} [options.arch] Target arch
20
- * @property {string} [options.downloadUrl = "https://dl.nwjs.io"] Download server
21
- * @property {string} [options.cacheDir = "./cache"] Cache directory
22
- * @property {boolean} [options.cache = true] If false, remove cache and redownload.
23
- * @property {boolean} [options.ffmpeg = false] If true, ffmpeg is not downloaded.
24
- * @property {false | "gyp"} [options.nativeAddon = false] Rebuild native modules
16
+ * @property {string | "latest" | "stable" | "lts"} [version = "latest"] Runtime version
17
+ * @property {"normal" | "sdk"} [flavor = "normal"] Build flavor
18
+ * @property {"linux" | "osx" | "win"} [platform] Target platform
19
+ * @property {"ia32" | "x64" | "arm64"} [arch] Target arch
20
+ * @property {string} [downloadUrl = "https://dl.nwjs.io"] Download server
21
+ * @property {string} [cacheDir = "./cache"] Cache directory
22
+ * @property {boolean} [cache = true] If false, remove cache and redownload.
23
+ * @property {boolean} [ffmpeg = false] If true, ffmpeg is not downloaded.
24
+ * @property {false | "gyp"} [nativeAddon = false] Rebuild native modules
25
25
  */
26
26
 
27
27
  /**
28
28
  * Get binaries.
29
- *
29
+ *
30
30
  * @async
31
31
  * @function
32
32
  * @param {GetOptions} options Get mode options
@@ -37,11 +37,11 @@ import util from "./util.js";
37
37
  * nwbuild({
38
38
  * mode: "get",
39
39
  * });
40
- *
40
+ *
41
41
  * // Use with nw module
42
42
  * nwbuild({
43
43
  * mode: "get",
44
- * cacheDir: "./node_modules/nw"
44
+ * cacheDir: "./node_modules/nw"
45
45
  * });
46
46
  *
47
47
  * @example
@@ -125,13 +125,14 @@ const getNwjs = async (options) => {
125
125
  C: options.cacheDir
126
126
  });
127
127
  } else {
128
- fs.createReadStream(out)
129
- .pipe(unzipper.Extract({ path: options.cacheDir }))
130
- .on("finish", async () => {
131
- if (options.platform === "osx") {
132
- await createSymlinks(options);
133
- }
134
- });
128
+ await new Promise((res) => {
129
+ fs.createReadStream(out)
130
+ .pipe(unzipper.Extract({ path: options.cacheDir }))
131
+ .on("finish", res);
132
+ });
133
+ if (options.platform === "osx") {
134
+ await createSymlinks(options);
135
+ }
135
136
  }
136
137
  return;
137
138
  }
@@ -201,13 +202,15 @@ const getNwjs = async (options) => {
201
202
  C: options.cacheDir
202
203
  });
203
204
  } else {
204
- fs.createReadStream(out)
205
- .pipe(unzipper.Extract({ path: options.cacheDir }))
206
- .on("finish", async () => {
207
- if (options.platform === "osx") {
208
- await createSymlinks(options);
209
- }
210
- });
205
+ await new Promise((res) => {
206
+ fs.createReadStream(out)
207
+ .pipe(unzipper.Extract({ path: options.cacheDir }))
208
+ .on("finish", res);
209
+ });
210
+ if (options.platform === "osx") {
211
+ await createSymlinks(options);
212
+ }
213
+
211
214
  }
212
215
  }
213
216