nw-builder 4.17.13 → 4.18.0

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/README.md CHANGED
@@ -77,13 +77,13 @@ Node manifest usage:
77
77
 
78
78
  ```json
79
79
  {
80
- "nwbuild": {
81
- "mode": "build",
82
- "glob": false,
83
- "flavor": "sdk",
84
- "cacheDir": "./node_modules/nw",
85
- "srcDir": "/path/to/project"
86
- }
80
+ "nwbuild": {
81
+ "mode": "build",
82
+ "glob": false,
83
+ "flavor": "sdk",
84
+ "cacheDir": "./node_modules/nw",
85
+ "srcDir": "/path/to/project"
86
+ }
87
87
  }
88
88
  ```
89
89
 
@@ -106,7 +106,7 @@ By default you get the normal build of the latest NW.js release for your specifi
106
106
 
107
107
  ```javascript
108
108
  nwbuild({
109
- mode: "get"
109
+ mode: "get",
110
110
  });
111
111
  ```
112
112
 
@@ -115,7 +115,7 @@ Get the community built FFmeg which contains proprietary codecs. This options is
115
115
  ```javascript
116
116
  nwbuild({
117
117
  mode: "get",
118
- ffmpeg: true
118
+ ffmpeg: true,
119
119
  });
120
120
  ```
121
121
 
@@ -179,7 +179,7 @@ nwbuild({
179
179
  mode: "build",
180
180
  managedManifest: {
181
181
  name: "nwdemo",
182
- main: "index.html"
182
+ main: "index.html",
183
183
  },
184
184
  });
185
185
  ```
@@ -188,28 +188,28 @@ nwbuild({
188
188
 
189
189
  Options
190
190
 
191
- | Name | Type | Default | Description |
192
- | ---- | ------- | --------- | ----------- |
193
- | mode | `"get" \| "run" \| "build"` | `"build"` | Choose between get, run or build mode |
194
- | version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version |
195
- | flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor |
196
- | platform | `"linux" \| "osx" \| "win"` | | Host platform |
197
- | arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture |
198
- | downloadUrl | `"https://dl.nwjs.io" \| "https://npm.taobao.org/mirrors/nwjs" \| https://npmmirror.com/mirrors/nwjs \| "https://github.com/corwin-of-amber/nw.js/releases/"` | `"https://dl.nwjs.io"` | Download server. Supports file systems too (for example `file:///home/localghost/nwjs_mirror`) |
199
- | manifestUrl | `"https://nwjs.io/versions.json" \| "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json"` | `"https://nwjs.io/versions.json"` | Versions manifest URI, gotten via https or local file |
200
- | cacheDir | `string` | `"./cache"` | Directory to cache NW binaries |
201
- | cache | `boolean` | `true`| If true the existing cache is used. Otherwise it removes and redownloads it. |
202
- | ffmpeg | `boolean` | `false`| If true the chromium ffmpeg is replaced by community version with proprietary codecs. |
203
- | logLevel | `"error" \| "warn" \| "info" \| "debug"` | `"info"`| Specify level of logging. |
204
- | shaSum | `boolean` | `true` | Flag to enable/disable shasum checks. |
205
- | srcDir | `string` | `"./"` | File paths to application code |
206
- | argv | `string[]` | `[]` | Command line arguments to pass to NW executable in run mode. You can also define these in `chromium-args` in NW.js manifest. |
207
- | glob | `boolean` | `true`| If true file globbing is enabled when parsing `srcDir`. |
208
- | outDir | `string` | `"./out"` | Directory to store build artifacts |
209
- | managedManifest | `boolean \| string \| object` | `false` | Managed manifest |
210
- | nodeAddon | `boolean` | `false` | Rebuild Node native addons |
211
- | zip | `boolean \| "zip" \| "tar" \| "tgz"` | `false`| If true, "zip", "tar" or "tgz" the `outDir` directory is compressed. |
212
- | app | `LinuxRc \| WinRc \| OsxRc` | Additional options for each platform. (See below.)
191
+ | Name | Type | Default | Description |
192
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
193
+ | mode | `"get" \| "run" \| "build"` | `"build"` | Choose between get, run or build mode |
194
+ | version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version |
195
+ | flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor |
196
+ | platform | `"linux" \| "osx" \| "win"` | | Host platform |
197
+ | arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture |
198
+ | downloadUrl | `"https://dl.nwjs.io" \| "https://npm.taobao.org/mirrors/nwjs" \| https://npmmirror.com/mirrors/nwjs \| "https://github.com/corwin-of-amber/nw.js/releases/"` | `"https://dl.nwjs.io"` | Download server. Supports file systems too (for example `file:///home/localghost/nwjs_mirror`) |
199
+ | manifestUrl | `"https://nwjs.io/versions.json" \| "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json"` | `"https://nwjs.io/versions.json"` | Versions manifest URI, gotten via https or local file |
200
+ | cacheDir | `string` | `"./cache"` | Directory to cache NW binaries |
201
+ | cache | `boolean` | `true` | If true the existing cache is used. Otherwise it removes and redownloads it. |
202
+ | ffmpeg | `boolean` | `false` | If true the chromium ffmpeg is replaced by community version with proprietary codecs. |
203
+ | logLevel | `"error" \| "warn" \| "info" \| "debug"` | `"info"` | Specify level of logging. |
204
+ | shaSum | `boolean` | `true` | Flag to enable/disable shasum checks. |
205
+ | srcDir | `string` | `"./"` | File paths to application code |
206
+ | argv | `string[]` | `[]` | Command line arguments to pass to NW executable in run mode. You can also define these in `chromium-args` in NW.js manifest. |
207
+ | glob | `boolean` | `true` | If true file globbing is enabled when parsing `srcDir`. |
208
+ | outDir | `string` | `"./out"` | Directory to store build artifacts |
209
+ | managedManifest | `boolean \| string \| object` | `false` | Managed manifest |
210
+ | nodeAddon | `boolean` | `false` | Rebuild Node native addons |
211
+ | zip | `boolean \| "zip" \| "tar" \| "tgz"` | `false` | If true, "zip", "tar" or "tgz" the `outDir` directory is compressed. |
212
+ | app | `LinuxRc \| WinRc \| OsxRc` | Additional options for each platform. (See below.) |
213
213
 
214
214
  ### `app` configuration object
215
215
 
@@ -217,68 +217,67 @@ This object defines additional properties used for building for a specific platf
217
217
 
218
218
  #### Windows-specific options (`WinRc`)
219
219
 
220
- | Name | Type | Default | Description |
221
- | ---- | ------- | --------- | ----------- |
222
- | `icon` | `string` | `undefined` | The path to the icon file. It should be a .ico file. (**WARNING**: Please define the icon in the NW.js manifest instead) |
223
- | `name` | `string` | Value of `name` in NW.js manifest | The name of the application |
224
- | `version` | `string` | Value of `version` in NW.js manifest | The version of the application |
225
- | `comments` | `string` | `undefined` | Additional information that should be displayed for diagnostic purposes. |
226
- | `company` | `string` | Value of `author` in NW.js manifest | Company that produced the file—for example, Microsoft Corporation or Standard Microsystems Corporation, Inc. This string is required. |
227
- | `fileDescription` | `string` | Value of `description` in NW.js manifest | File description to be presented to users. This string may be displayed in a list box when the user is choosing files to install. For example, Keyboard Driver for AT-Style Keyboards. This string is required. |
228
- | `fileVersion` | `string` | Value of `version` or value of `version` in NW.js manifest | Version number of the file. For example, 3.10 or 5.00.RC2. This string is required. |
229
- | `internalName` | `string` | Value of `name` in NW.js manifest |Internal name of the file, if one exists—for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required. |
230
- | `legalCopyright` | `string` | `undefined` | Copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on. This string is optional. |
231
- | `legalTrademark` | `string` | `undefined` | Trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. This string is optional. |
232
- | `originalFilename` | `string` | Value of `name` option | Original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required. |
233
- | `privateBuild` | `string` | `undefined` | Information about a private version of the file—for example, Built by TESTER1 on \\TESTBED. |
234
- | `productName` | `string` | `name` in NW.js manifest | Name of the product with which the file is distributed. This string is required. |
235
- | `productVersion` | `string` | Value of `version` in NW.js manifest | Version of the product with which the file is distributed—for example, 3.10 or 5.00.RC2. |
236
- | `specialBuild` | `string` | `undefined` | Text that specifies how this version of the file differs from the standard version—for example, Private build for TESTER1 solving mouse problems on M250 and M250E computers. |
237
- | `languageCode` | `number` | `1033` | Language of the file, defined by Microsoft, see: https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a |
220
+ | Name | Type | Default | Description |
221
+ | ------------------ | -------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
222
+ | `icon` | `string` | `undefined` | The path to the icon file. It should be a .ico file. (**WARNING**: Please define the icon in the NW.js manifest instead) |
223
+ | `name` | `string` | Value of `name` in NW.js manifest | The name of the application |
224
+ | `version` | `string` | Value of `version` in NW.js manifest | The version of the application |
225
+ | `comments` | `string` | `undefined` | Additional information that should be displayed for diagnostic purposes. |
226
+ | `company` | `string` | Value of `author` in NW.js manifest | Company that produced the file—for example, Microsoft Corporation or Standard Microsystems Corporation, Inc. This string is required. |
227
+ | `fileDescription` | `string` | Value of `description` in NW.js manifest | File description to be presented to users. This string may be displayed in a list box when the user is choosing files to install. For example, Keyboard Driver for AT-Style Keyboards. This string is required. |
228
+ | `fileVersion` | `string` | Value of `version` or value of `version` in NW.js manifest | Version number of the file. For example, 3.10 or 5.00.RC2. This string is required. |
229
+ | `internalName` | `string` | Value of `name` in NW.js manifest | Internal name of the file, if one exists—for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required. |
230
+ | `legalCopyright` | `string` | `undefined` | Copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on. This string is optional. |
231
+ | `legalTrademark` | `string` | `undefined` | Trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. This string is optional. |
232
+ | `originalFilename` | `string` | Value of `name` option | Original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required. |
233
+ | `privateBuild` | `string` | `undefined` | Information about a private version of the file—for example, Built by TESTER1 on \\TESTBED. |
234
+ | `productName` | `string` | `name` in NW.js manifest | Name of the product with which the file is distributed. This string is required. |
235
+ | `productVersion` | `string` | Value of `version` in NW.js manifest | Version of the product with which the file is distributed—for example, 3.10 or 5.00.RC2. |
236
+ | `specialBuild` | `string` | `undefined` | Text that specifies how this version of the file differs from the standard version—for example, Private build for TESTER1 solving mouse problems on M250 and M250E computers. |
237
+ | `languageCode` | `number` | `1033` | Language of the file, defined by Microsoft, see: https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a |
238
238
 
239
239
  #### Linux-specific options (`LinuxRc`)
240
240
 
241
- | Name | Type | Description |
242
- | ---- | ------- | ----------- |
243
- | name | `string` | Name of the application |
244
- | genericName | `string` | Generic name of the application |
245
- | noDisplay | `boolean` | If true the application is not displayed |
246
- | comment | `string` | Tooltip for the entry, for example "View sites on the Internet". |
247
- | icon | `string` | Icon to display in file manager, menus, etc. (**WARNING**: Please define the icon in the NW.js manifest instead) |
248
- | hidden | `boolean` | TBD |
249
- | onlyShowIn | `string[]` | A list of strings identifying the desktop environments that should display a given desktop entry |
250
- | notShowIn | `string[]` | A list of strings identifying the desktop environments that should not display a given desktop entry |
251
- | dBusActivatable | `boolean` | A boolean value specifying if D-Bus activation is supported for this application |
252
- | tryExec | `string` | Path to an executable file on disk used to determine if the program is actually installed |
253
- | exec | `string` | Program to execute, possibly with arguments. |
254
- | path | `string` | If entry is of type Application, the working directory to run the program in. |
255
- | terminal | `boolean` | Whether the program runs in a terminal window. |
256
- | actions | `string[]` | Identifiers for application actions. |
257
- | mimeType | `string[]` | The MIME type(s) supported by this application. |
258
- | categories | `string[]` | Categories in which the entry should be shown in a menu |
259
- | implements | `string[]` | A list of interfaces that this application implements. |
260
- | keywords | `string[]` | A list of strings which may be used in addition to other metadata to describe this entry. |
261
- | startupNotify | `boolean` | If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_STARTUP_ID environment variable set. If false, it is KNOWN that the application does not work with startup notification at all. |
262
- | startupWMClass | `string` | If specified, it is known that the application will map at least one window with the given string as its WM class or WM name hin |
263
- | prefersNonDefaultGPU | `boolean` | If true, the application prefers to be run on a more powerful discrete GPU if available. |
264
- | singleMainWindow | `string` | If true, the application has a single main window, and does not support having an additional one opened. |
241
+ | Name | Type | Description |
242
+ | -------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
243
+ | name | `string` | Name of the application |
244
+ | genericName | `string` | Generic name of the application |
245
+ | noDisplay | `boolean` | If true the application is not displayed |
246
+ | comment | `string` | Tooltip for the entry, for example "View sites on the Internet". |
247
+ | icon | `string` | Icon to display in file manager, menus, etc. (**WARNING**: Please define the icon in the NW.js manifest instead) |
248
+ | hidden | `boolean` | TBD |
249
+ | onlyShowIn | `string[]` | A list of strings identifying the desktop environments that should display a given desktop entry |
250
+ | notShowIn | `string[]` | A list of strings identifying the desktop environments that should not display a given desktop entry |
251
+ | dBusActivatable | `boolean` | A boolean value specifying if D-Bus activation is supported for this application |
252
+ | tryExec | `string` | Path to an executable file on disk used to determine if the program is actually installed |
253
+ | exec | `string` | Program to execute, possibly with arguments. |
254
+ | path | `string` | If entry is of type Application, the working directory to run the program in. |
255
+ | terminal | `boolean` | Whether the program runs in a terminal window. |
256
+ | actions | `string[]` | Identifiers for application actions. |
257
+ | mimeType | `string[]` | The MIME type(s) supported by this application. |
258
+ | categories | `string[]` | Categories in which the entry should be shown in a menu |
259
+ | implements | `string[]` | A list of interfaces that this application implements. |
260
+ | keywords | `string[]` | A list of strings which may be used in addition to other metadata to describe this entry. |
261
+ | startupNotify | `boolean` | If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_STARTUP_ID environment variable set. If false, it is KNOWN that the application does not work with startup notification at all. |
262
+ | startupWMClass | `string` | If specified, it is known that the application will map at least one window with the given string as its WM class or WM name hin |
263
+ | prefersNonDefaultGPU | `boolean` | If true, the application prefers to be run on a more powerful discrete GPU if available. |
264
+ | singleMainWindow | `string` | If true, the application has a single main window, and does not support having an additional one opened. |
265
265
 
266
266
  #### MacOS-specific options (`OsxRc`)
267
267
 
268
- | Name | Type | Description |
269
- | ---- | ------- | ----------- |
270
- | name | `string` | The name of the application |
271
- | icon | `string` | The path to the icon file. It should be a .icns file. (**WARNING**: Please define the icon in the NW.js manifest instead) |
272
- | LSApplicationCategoryType | `string` | The category that best describes your app for the App Store. |
273
- | CFBundleIdentifier | `string` | A unique identifier for a bundle usually in reverse DNS format. |
274
- | CFBundleName | `string` | A user-visible short name for the bundle. |
275
- | CFBundleDisplayName | `string` | The user-visible name for the bundle. |
276
- | CFBundleSpokenName | `string` | A replacement for the app name in text-to-speech operations. |
277
- | CFBundleVersion | `string` | The version of the build that identifies an iteration of the bundle. |
278
- | CFBundleShortVersionString | `string` | The release or version number of the bundle. |
279
- | NSHumanReadableCopyright | `string` | A human-readable copyright notice for the bundle. |
280
- | NSLocalNetworkUsageDescription | `string` | A human-readable description of why the application needs access to the local network. |
281
-
268
+ | Name | Type | Description |
269
+ | ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------- |
270
+ | name | `string` | The name of the application |
271
+ | icon | `string` | The path to the icon file. It should be a .icns file. (**WARNING**: Please define the icon in the NW.js manifest instead) |
272
+ | LSApplicationCategoryType | `string` | The category that best describes your app for the App Store. |
273
+ | CFBundleIdentifier | `string` | A unique identifier for a bundle usually in reverse DNS format. |
274
+ | CFBundleName | `string` | A user-visible short name for the bundle. |
275
+ | CFBundleDisplayName | `string` | The user-visible name for the bundle. |
276
+ | CFBundleSpokenName | `string` | A replacement for the app name in text-to-speech operations. |
277
+ | CFBundleVersion | `string` | The version of the build that identifies an iteration of the bundle. |
278
+ | CFBundleShortVersionString | `string` | The release or version number of the bundle. |
279
+ | NSHumanReadableCopyright | `string` | A human-readable copyright notice for the bundle. |
280
+ | NSLocalNetworkUsageDescription | `string` | A human-readable description of why the application needs access to the local network. |
282
281
 
283
282
  ## Guides
284
283
 
@@ -298,7 +297,8 @@ nwbuild({
298
297
  platform: "osx",
299
298
  arch: "arm64",
300
299
  downloadUrl: "https://github.com/corwin-of-amber/nw.js/releases/download",
301
- manifestUrl: "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json",
300
+ manifestUrl:
301
+ "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json",
302
302
  });
303
303
  ```
304
304
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.17.13",
3
+ "version": "4.18.0",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -42,6 +42,8 @@
42
42
  },
43
43
  "scripts": {
44
44
  "postinstall": "node ./src/postinstall.js",
45
+ "format": "prettier --check .",
46
+ "format:fix": "prettier --write .",
45
47
  "lint": "eslint ./src ./tests",
46
48
  "lint:fix": "eslint --fix ./src ./tests",
47
49
  "test": "vitest run --coverage",
@@ -56,17 +58,19 @@
56
58
  },
57
59
  "devDependencies": {
58
60
  "@eslint/js": "^10.0.1",
59
- "@vitest/coverage-v8": "^4.1.9",
61
+ "@vitest/coverage-v8": "^4.1.10",
60
62
  "base-volta-off-of-nwjs": "^1.0.5",
61
- "eslint": "^10.6.0",
62
- "eslint-plugin-jsdoc": "^63.0.10",
63
+ "eslint": "^10.8.0",
64
+ "eslint-plugin-jsdoc": "^63.2.2",
65
+ "eslint-plugin-simple-import-sort": "^14.0.0",
63
66
  "globals": "^17.7.0",
64
- "nw": "^0.112.0",
65
- "selenium-webdriver": "^4.45.0",
67
+ "nw": "^0.114.0",
68
+ "prettier": "^3.9.6",
69
+ "selenium-webdriver": "^4.46.0",
66
70
  "vitest": "^4.0.14"
67
71
  },
68
72
  "dependencies": {
69
- "@nwutils/getter": "^0.2.4",
73
+ "@nwutils/getter": "^0.2.5",
70
74
  "@nwutils/runner": "^0.2.3",
71
75
  "archiver": "^8.0.0",
72
76
  "commander": "^15.0.0",
package/src/bld/osx.js CHANGED
@@ -1,10 +1,10 @@
1
- import console from 'node:console';
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import process from 'node:process';
1
+ import console from "node:console";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import process from "node:process";
5
5
 
6
- import { build, parse } from 'plist';
7
- import semver from 'semver';
6
+ import { build, parse } from "plist";
7
+ import semver from "semver";
8
8
 
9
9
  /**
10
10
  * Function to update Helper App Plist Files
@@ -13,9 +13,14 @@ import semver from 'semver';
13
13
  * @param {string} helperId - Helper App ID
14
14
  * @param {string} appCFBundleIdentifier - options.app.CFBundleIdentifier
15
15
  */
16
- async function updateHelperPlist (plistPath, helperName, helperId, appCFBundleIdentifier) {
17
- const plistFullPath = path.resolve(plistPath, 'Contents/Info.plist');
18
- const plistJson = parse(await fs.promises.readFile(plistFullPath, 'utf-8'));
16
+ async function updateHelperPlist(
17
+ plistPath,
18
+ helperName,
19
+ helperId,
20
+ appCFBundleIdentifier,
21
+ ) {
22
+ const plistFullPath = path.resolve(plistPath, "Contents/Info.plist");
23
+ const plistJson = parse(await fs.promises.readFile(plistFullPath, "utf-8"));
19
24
  plistJson.CFBundleDisplayName = helperName;
20
25
  plistJson.CFBundleName = helperName;
21
26
  plistJson.CFBundleExecutable = helperName;
@@ -32,10 +37,15 @@ async function updateHelperPlist (plistPath, helperName, helperId, appCFBundleId
32
37
  * @param {string} options.releaseInfo - Release information.
33
38
  * @returns {Promise<void>} - Promise.
34
39
  */
35
- export default async function setOsxConfig({ version, app, outDir, releaseInfo }) {
36
- if (process.platform === 'win32') {
40
+ export default async function setOsxConfig({
41
+ version,
42
+ app,
43
+ outDir,
44
+ releaseInfo,
45
+ }) {
46
+ if (process.platform === "win32") {
37
47
  console.warn(
38
- 'MacOS apps built on Windows platform do not preserve all file permissions. See #716',
48
+ "MacOS apps built on Windows platform do not preserve all file permissions. See https://github.com/nwutils/nw-builder/issues/716",
39
49
  );
40
50
  }
41
51
 
@@ -45,13 +55,13 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
45
55
  */
46
56
  const chromiumVersion = releaseInfo?.components?.chromium;
47
57
  if (!chromiumVersion) {
48
- throw new Error('Chromium version is missing.');
58
+ throw new Error("Chromium version is missing.");
49
59
  }
50
60
  /**
51
61
  * Path to MacOS application.
52
62
  * @type {string}
53
63
  */
54
- const nwjsApp = path.resolve(outDir, 'nwjs.app');
64
+ const nwjsApp = path.resolve(outDir, "nwjs.app");
55
65
 
56
66
  /**
57
67
  * Path to renamed MacOS application.
@@ -64,28 +74,32 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
64
74
 
65
75
  /* Rename `Contents/MacOS/nwjs` to `Contents/MacOS/${app.name}` */
66
76
  await fs.promises.rename(
67
- path.resolve(outApp, 'Contents', 'MacOS', 'nwjs'),
68
- path.resolve(outApp, 'Contents', 'MacOS', app.name),
77
+ path.resolve(outApp, "Contents", "MacOS", "nwjs"),
78
+ path.resolve(outApp, "Contents", "MacOS", app.name),
69
79
  );
70
80
 
71
81
  /* Rename all Helper apps */
72
82
  const helperBaseDir = path.resolve(
73
83
  outApp,
74
- 'Contents/Frameworks/nwjs Framework.framework/Versions',
75
- chromiumVersion,
76
- 'Helpers/'
84
+ "Contents/Frameworks/nwjs Framework.framework/Versions",
85
+ /* TODO: Version mismatch tracked in https://github.com/nwjs/nw.js/issues/8371 */
86
+ "Current",
87
+ "Helpers",
77
88
  );
78
89
 
79
90
  const helperApps = [
80
- { name: 'nwjs Helper (Alerts).app', id: 'helper.alert' },
81
- { name: 'nwjs Helper (GPU).app', id: 'helper.gpu' },
82
- { name: 'nwjs Helper (Renderer).app', id: 'helper.renderer' },
83
- { name: 'nwjs Helper.app', id: 'helper' },
91
+ { name: "nwjs Helper (Alerts).app", id: "helper.alert" },
92
+ { name: "nwjs Helper (GPU).app", id: "helper.gpu" },
93
+ { name: "nwjs Helper (Renderer).app", id: "helper.renderer" },
94
+ { name: "nwjs Helper.app", id: "helper" },
84
95
  ];
85
96
 
86
97
  /* MacOS Plugin Helper is removed in NW.js v0.111.0 (Chromium M148) */
87
- if (semver.lt(version, '0.111.0')) {
88
- helperApps.push({ name: 'nwjs Helper (Plugin).app', id: 'helper.plugin' });
98
+ if (semver.lt(version, "0.111.0")) {
99
+ helperApps.push({
100
+ name: "nwjs Helper (Plugin).app",
101
+ id: "helper.plugin",
102
+ });
89
103
  }
90
104
 
91
105
  for (const helperApp of helperApps) {
@@ -97,21 +111,29 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
97
111
  await fs.promises.rename(oldPath, newPath);
98
112
 
99
113
  // Rename Helper sub-directory
100
- const helperBaseName = helperApp.name.replace(/.app$/, '');
101
- const subPathBase = path.resolve(newPath, 'Contents/MacOS/');
114
+ const helperBaseName = helperApp.name.replace(/.app$/, "");
115
+ const subPathBase = path.resolve(newPath, "Contents/MacOS/");
102
116
  const oldSubPath = path.resolve(subPathBase, helperBaseName);
103
- const newSubPath = path.resolve(subPathBase, helperBaseName.replace(/^nwjs/, app.name));
117
+ const newSubPath = path.resolve(
118
+ subPathBase,
119
+ helperBaseName.replace(/^nwjs/, app.name),
120
+ );
104
121
  await fs.promises.rename(oldSubPath, newSubPath);
105
122
 
106
123
  // Update Helper Plist file
107
- await updateHelperPlist(newPath, newHelperAppName.replace(/.app$/, ''), helperApp.id, app.CFBundleIdentifier);
124
+ await updateHelperPlist(
125
+ newPath,
126
+ newHelperAppName.replace(/.app$/, ""),
127
+ helperApp.id,
128
+ app.CFBundleIdentifier,
129
+ );
108
130
  }
109
131
 
110
132
  /* Replace default icon with user defined icon if specified. */
111
133
  if (app.icon !== undefined) {
112
134
  await fs.promises.copyFile(
113
135
  path.resolve(app.icon),
114
- path.resolve(outApp, 'Contents', 'Resources', 'app.icns'),
136
+ path.resolve(outApp, "Contents", "Resources", "app.icns"),
115
137
  );
116
138
  }
117
139
 
@@ -121,8 +143,8 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
121
143
  */
122
144
  const contentsInfoPlistPath = path.resolve(
123
145
  outApp,
124
- 'Contents',
125
- 'Info.plist'
146
+ "Contents",
147
+ "Info.plist",
126
148
  );
127
149
 
128
150
  /**
@@ -131,10 +153,10 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
131
153
  */
132
154
  const contentsResourcesEnLprojInfoPlistStringsPath = path.resolve(
133
155
  outApp,
134
- 'Contents',
135
- 'Resources',
136
- 'en.lproj',
137
- 'InfoPlist.strings',
156
+ "Contents",
157
+ "Resources",
158
+ "en.lproj",
159
+ "InfoPlist.strings",
138
160
  );
139
161
 
140
162
  /**
@@ -142,22 +164,22 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
142
164
  * @type {object}
143
165
  */
144
166
  const contentsInfoPlistJson = parse(
145
- await fs.promises.readFile(
146
- contentsInfoPlistPath,
147
- 'utf-8'
148
- )
167
+ await fs.promises.readFile(contentsInfoPlistPath, "utf-8"),
149
168
  );
150
169
 
151
170
  /* Update Plist with user defined values. */
152
- contentsInfoPlistJson.LSApplicationCategoryType = app.LSApplicationCategoryType;
171
+ contentsInfoPlistJson.LSApplicationCategoryType =
172
+ app.LSApplicationCategoryType;
153
173
  contentsInfoPlistJson.CFBundleIdentifier = app.CFBundleIdentifier;
154
174
  contentsInfoPlistJson.CFBundleName = app.CFBundleName;
155
175
  contentsInfoPlistJson.CFBundleDisplayName = app.CFBundleDisplayName;
156
176
  contentsInfoPlistJson.CFBundleSpokenName = app.CFBundleSpokenName;
157
177
  contentsInfoPlistJson.CFBundleVersion = app.CFBundleVersion;
158
- contentsInfoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString;
178
+ contentsInfoPlistJson.CFBundleShortVersionString =
179
+ app.CFBundleShortVersionString;
159
180
  contentsInfoPlistJson.CFBundleExecutable = app.name;
160
- contentsInfoPlistJson.NSLocalNetworkUsageDescription = app.NSLocalNetworkUsageDescription;
181
+ contentsInfoPlistJson.NSLocalNetworkUsageDescription =
182
+ app.NSLocalNetworkUsageDescription;
161
183
 
162
184
  /* Remove properties that were not updated by the user. */
163
185
  Object.keys(contentsInfoPlistJson).forEach((option) => {
@@ -170,12 +192,14 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
170
192
  * Data from `nwjs.app/Contents/Resources/en.lproj/InfoPlist.settings`
171
193
  * @type {string[]}
172
194
  */
173
- const contentsResourcesEnLprojInfoPlistStringsArray = (await fs.promises.readFile(
174
- contentsResourcesEnLprojInfoPlistStringsPath,
175
- 'utf-8',
176
- )).split('\n');
195
+ const contentsResourcesEnLprojInfoPlistStringsArray = (
196
+ await fs.promises.readFile(
197
+ contentsResourcesEnLprojInfoPlistStringsPath,
198
+ "utf-8",
199
+ )
200
+ ).split("\n");
177
201
  contentsResourcesEnLprojInfoPlistStringsArray.forEach((line, idx, arr) => {
178
- if (line.includes('NSHumanReadableCopyright')) {
202
+ if (line.includes("NSHumanReadableCopyright")) {
179
203
  arr[idx] =
180
204
  `NSHumanReadableCopyright = "${app.NSHumanReadableCopyright}";`;
181
205
  }
@@ -184,13 +208,15 @@ export default async function setOsxConfig({ version, app, outDir, releaseInfo }
184
208
  /* Write the updated values to their config files. */
185
209
  await fs.promises.writeFile(
186
210
  contentsInfoPlistPath,
187
- build(contentsInfoPlistJson));
211
+ build(contentsInfoPlistJson),
212
+ );
188
213
  await fs.promises.writeFile(
189
214
  contentsResourcesEnLprojInfoPlistStringsPath,
190
- contentsResourcesEnLprojInfoPlistStringsArray.toString().replace(/,/g, '\n'),
215
+ contentsResourcesEnLprojInfoPlistStringsArray
216
+ .toString()
217
+ .replace(/,/g, "\n"),
191
218
  );
192
-
193
219
  } catch (error) {
194
220
  console.error(error);
195
221
  }
196
- };
222
+ }