nw-builder 4.17.3 → 4.17.5

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 (3) hide show
  1. package/package.json +1 -1
  2. package/src/bld.js +18 -16
  3. package/src/util.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.17.3",
3
+ "version": "4.17.5",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
package/src/bld.js CHANGED
@@ -131,13 +131,15 @@ async function bld({
131
131
  await fs.promises.cp(nwDir, outDir, { recursive: true, verbatimSymlinks: true });
132
132
 
133
133
  const files = await util.globFiles({ srcDir, glob });
134
- let manifest = await util.getNodeManifest({ srcDir, glob });
135
134
 
136
- /* Set `product_string` in manifest for MacOS. This is used in renaming the Helper apps. */
137
- if (platform === 'osx') {
138
- manifest.json.product_string = app.name;
139
- await fs.promises.writeFile(manifest.path, JSON.stringify(manifest.json, null, 2));
140
- }
135
+ const nwProjectDir = path.resolve(
136
+ outDir,
137
+ platform !== 'osx'
138
+ ? 'package.nw'
139
+ : 'nwjs.app/Contents/Resources/app.nw',
140
+ );
141
+
142
+ await fs.promises.mkdir(nwProjectDir, { recursive: true });
141
143
 
142
144
  if (glob) {
143
145
  for (let file of files) {
@@ -148,10 +150,7 @@ async function bld({
148
150
  await fs.promises.cp(
149
151
  file,
150
152
  path.resolve(
151
- outDir,
152
- platform !== 'osx'
153
- ? 'package.nw'
154
- : 'nwjs.app/Contents/Resources/app.nw',
153
+ nwProjectDir,
155
154
  file,
156
155
  ),
157
156
  { recursive: true, force: true },
@@ -161,23 +160,26 @@ async function bld({
161
160
  await fs.promises.cp(
162
161
  files,
163
162
  path.resolve(
164
- outDir,
165
- platform !== 'osx'
166
- ? 'package.nw'
167
- : 'nwjs.app/Contents/Resources/app.nw',
163
+ nwProjectDir,
168
164
  ),
169
165
  { recursive: true, verbatimSymlinks: true },
170
166
  );
171
167
  }
172
168
 
173
- // const nodeVersion = releaseInfo.components.node;
169
+ const builtManifest = JSON.parse(await fs.promises.readFile(path.resolve(nwProjectDir, 'package.json'), 'utf8'));
170
+
171
+ /* Set `product_string` in manifest for MacOS. This is used in renaming the Helper apps. */
172
+ if (platform === 'osx') {
173
+ builtManifest.product_string = app.name;
174
+ await fs.promises.writeFile(path.resolve(nwProjectDir, 'package.json'), JSON.stringify(builtManifest, null, 2));
175
+ }
174
176
 
175
177
  if (
176
178
  managedManifest === true ||
177
179
  typeof managedManifest === 'object' ||
178
180
  typeof managedManifest === 'string'
179
181
  ) {
180
- await manageManifest({ nwPkg: manifest.json, managedManifest, outDir, platform });
182
+ await manageManifest({ nwPkg: builtManifest, managedManifest, outDir, platform });
181
183
  }
182
184
 
183
185
  if (platform === 'linux') {
package/src/util.js CHANGED
@@ -539,7 +539,7 @@ export const validate = async (options, releaseInfo) => {
539
539
  if (typeof options.app.NSHumanReadableCopyright !== 'string') {
540
540
  throw new Error('Expected options.app.NSHumanReadableCopyright to be a string. Got ' + options.app.NSHumanReadableCopyright);
541
541
  }
542
- if (typeof options.app.NSLocalNetworkUsageDescription !== 'string') {
542
+ if (options.app.NSLocalNetworkUsageDescription && typeof options.app.NSLocalNetworkUsageDescription !== 'string') {
543
543
  throw new Error('Expected options.app.NSLocalNetworkUsageDescription to be a string. Got ' + options.app.NSLocalNetworkUsageDescription);
544
544
  }
545
545
  } else {