nw-builder 4.2.6 → 4.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.2.6",
3
+ "version": "4.2.7",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -11,15 +11,15 @@ import { log } from "../log.js";
11
11
  export const getManifest = (manifestUrl) => {
12
12
  let chunks = undefined;
13
13
 
14
- return new Promise((resolve, reject) => {
15
- get(manifestUrl, (res) => {
14
+ return new Promise((resolve) => {
15
+ const req = get(manifestUrl, (res) => {
16
16
  res.on("data", (chunk) => {
17
17
  chunks += chunk;
18
18
  });
19
19
 
20
20
  res.on("error", (e) => {
21
21
  log.error(e);
22
- reject(undefined);
22
+ resolve(undefined);
23
23
  });
24
24
 
25
25
  res.on("end", () => {
@@ -27,5 +27,9 @@ export const getManifest = (manifestUrl) => {
27
27
  resolve(chunks);
28
28
  });
29
29
  });
30
+ req.on("error", (e) => {
31
+ log.warn(e);
32
+ resolve(undefined);
33
+ });
30
34
  });
31
35
  };
@@ -1,4 +1,4 @@
1
- import { access, readFile, writeFile } from "node:fs/promises";
1
+ import { readFile, writeFile } from "node:fs/promises";
2
2
  import { resolve } from "node:path";
3
3
 
4
4
  import { log } from "../log.js";
@@ -29,18 +29,14 @@ export const getReleaseInfo = async (
29
29
  } else {
30
30
  manifestPath = resolve(cacheDir, "manifest.json");
31
31
  }
32
+
32
33
  try {
33
- await access(manifestPath);
34
- log.debug(`Manifest file already exists locally under ${cacheDir}`);
35
- } catch (e) {
36
- log.debug(`Manifest file does not exist locally`);
37
- log.debug(`Downloading latest manifest file under ${cacheDir}`);
38
34
  const data = await getManifest(manifestUrl);
39
- await writeFile(manifestPath, data.slice(9));
40
- } finally {
41
- log.debug("Store manifest metadata in memory");
42
- let manifest = JSON.parse(await readFile(resolve(manifestPath)));
43
- log.debug(`Search for ${version} specific release data`);
35
+ if (data !== undefined) {
36
+ await writeFile(manifestPath, data.slice(9));
37
+ }
38
+
39
+ let manifest = JSON.parse(await readFile(manifestPath));
44
40
  if (version === "latest" || version === "stable" || version === "lts") {
45
41
  // Remove leading "v" from version string
46
42
  version = manifest[version].slice(1);
@@ -49,6 +45,10 @@ export const getReleaseInfo = async (
49
45
  releaseData = manifest.versions.find(
50
46
  (release) => release.version === `v${version}`
51
47
  );
48
+ } catch (e) {
49
+ log.debug(
50
+ "The version manifest does not exist/was not downloaded. Please try again in some time."
51
+ );
52
52
  }
53
53
  return releaseData;
54
54
  };
@@ -16,7 +16,7 @@ export const validate = async (options, releaseInfo) => {
16
16
  }
17
17
  if (typeof releaseInfo === "undefined") {
18
18
  throw new Error(
19
- "The specified version does not exist in the version manifest. Disable cache to redownload the version manifest. If you still get this error, that means the version you've specified is incorrect."
19
+ "Either the specific version info does not exist or the version manifest itself does not exist. In case of the latter, please check your internet connection and try again later."
20
20
  );
21
21
  }
22
22
  if (!releaseInfo.flavors.includes(options.flavor)) {