nw-builder 4.13.15 → 4.13.16

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 +1 -1
  2. package/src/util.js +7 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.13.15",
3
+ "version": "4.13.16",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
package/src/util.js CHANGED
@@ -10,10 +10,10 @@ import semver from 'semver';
10
10
  /**
11
11
  * Get manifest (array of NW release metadata) from URL.
12
12
  * @param {string} manifestUrl Url to manifest
13
- * @returns {Promise<object | undefined>} - Manifest object
13
+ * @returns {Promise<string>} - Manifest object
14
14
  */
15
15
  function getManifest(manifestUrl) {
16
- let chunks = undefined;
16
+ let chunks = '';
17
17
 
18
18
  return new Promise((resolve) => {
19
19
  const req = https.get(manifestUrl, (response) => {
@@ -23,7 +23,7 @@ function getManifest(manifestUrl) {
23
23
 
24
24
  response.on('error', (e) => {
25
25
  console.error(e);
26
- resolve(undefined);
26
+ resolve('');
27
27
  });
28
28
 
29
29
  response.on('end', () => {
@@ -32,7 +32,7 @@ function getManifest(manifestUrl) {
32
32
  });
33
33
  req.on('error', (e) => {
34
34
  console.error(e);
35
- resolve(undefined);
35
+ resolve('');
36
36
  });
37
37
  });
38
38
  }
@@ -63,11 +63,11 @@ async function getReleaseInfo(
63
63
 
64
64
  try {
65
65
  const data = await getManifest(manifestUrl);
66
- if (data !== undefined) {
67
- await fs.promises.writeFile(manifestPath, data.slice(9));
66
+ if (data.length) {
67
+ await fs.promises.writeFile(manifestPath, data);
68
68
  }
69
69
 
70
- let manifest = JSON.parse(await fs.promises.readFile(manifestPath));
70
+ const manifest = JSON.parse(await fs.promises.readFile(manifestPath));
71
71
  if (version === 'latest' || version === 'stable' || version === 'lts') {
72
72
  // Remove leading "v" from version string
73
73
  version = manifest[version].slice(1);