nw-builder 4.7.4 → 4.7.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.
- package/README.md +68 -0
- package/package.json +10 -35
- package/src/bld.js +30 -22
- package/src/get/decompress.test.js +5 -1
- package/src/run.js +3 -6
package/README.md
CHANGED
|
@@ -188,6 +188,7 @@ Options
|
|
|
188
188
|
|
|
189
189
|
| Name | Type | Default | Description |
|
|
190
190
|
| ---- | ------- | --------- | ----------- |
|
|
191
|
+
| app | `LinuxRc \| WinRc \| OsxRc` | Additional options for each platform. (See below.)
|
|
191
192
|
| mode | `"get" \| "run" \| "build"` | `"build"` | Choose between get, run or build mode |
|
|
192
193
|
| version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version |
|
|
193
194
|
| flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor |
|
|
@@ -206,6 +207,73 @@ Options
|
|
|
206
207
|
| logLevel | `"error" \| "warn" \| "info" \| "debug"` | `"info"`| Specify level of logging. |
|
|
207
208
|
| zip | `boolean \| "zip" \| "tar" \| "tgz"` | `false`| If true, "zip", "tar" or "tgz" the `outDir` directory is compressed. |
|
|
208
209
|
|
|
210
|
+
### `app` configuration object
|
|
211
|
+
|
|
212
|
+
This object defines additional properties used for building for a specific platform. For each platform, pass an object with appropriate values:
|
|
213
|
+
|
|
214
|
+
#### Windows-specific options (`WinRc`)
|
|
215
|
+
|
|
216
|
+
| Name | Type | Default | Description |
|
|
217
|
+
| ---- | ------- | --------- | ----------- |
|
|
218
|
+
| `icon` | `string` | `undefined` | The path to the icon file. It should be a .ico file. |
|
|
219
|
+
| `name` | `string` | Value of `name` in app's `package.json` | The name of the application |
|
|
220
|
+
| `version` | `string` | Value of `version` in app's `package.json` | The version of the application |
|
|
221
|
+
| `comments` | `string` | `undefined` | Additional information that should be displayed for diagnostic purposes. |
|
|
222
|
+
| `company` | `string` | `undefined` | Company that produced the file—for example, Microsoft Corporation or Standard Microsystems Corporation, Inc. This string is required. |
|
|
223
|
+
| `fileDescription` | `string` | Value of `description` in app's `package.json` | 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. |
|
|
224
|
+
| `fileVersion` | `string` | Value of `version` in app's `package.json` | Version number of the file. For example, 3.10 or 5.00.RC2. This string is required. |
|
|
225
|
+
| `internalName` | `string` | `undefined` |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. |
|
|
226
|
+
| `legalCopyright` | `string` | NW.js' copyright info | 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. |
|
|
227
|
+
| `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. |
|
|
228
|
+
| `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. |
|
|
229
|
+
| `privateBuild` | `string` | `undefined` | Information about a private version of the file—for example, Built by TESTER1 on \\TESTBED. |
|
|
230
|
+
| `productName` | `string` | Matches the package name defined in app's `package.json` | Name of the product with which the file is distributed. This string is required. |
|
|
231
|
+
| `productVersion` | `string` | Value of `version` in app's `package.json` | Version of the product with which the file is distributed—for example, 3.10 or 5.00.RC2. |
|
|
232
|
+
| `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. |
|
|
233
|
+
|
|
234
|
+
#### Linux-specific options (`LinuxRc`)
|
|
235
|
+
|
|
236
|
+
| Name | Type | Description |
|
|
237
|
+
| ---- | ------- | ----------- |
|
|
238
|
+
| name | `string` | Name of the application |
|
|
239
|
+
| genericName | `string` | Generic name of the application |
|
|
240
|
+
| noDisplay | `boolean` | If true the application is not displayed |
|
|
241
|
+
| comment | `string` | Tooltip for the entry, for example "View sites on the Internet". |
|
|
242
|
+
| icon | `string` | Icon to display in file manager, menus, etc. |
|
|
243
|
+
| hidden | `boolean` | TBD |
|
|
244
|
+
| onlyShowIn | `string[]` | A list of strings identifying the desktop environments that should display a given desktop entry |
|
|
245
|
+
| notShowIn | `string[]` | A list of strings identifying the desktop environments that should not display a given desktop entry |
|
|
246
|
+
| dBusActivatable | `boolean` | A boolean value specifying if D-Bus activation is supported for this application |
|
|
247
|
+
| tryExec | `string` | Path to an executable file on disk used to determine if the program is actually installed |
|
|
248
|
+
| exec | `string` | Program to execute, possibly with arguments. |
|
|
249
|
+
| path | `string` | If entry is of type Application, the working directory to run the program in. |
|
|
250
|
+
| terminal | `boolean` | Whether the program runs in a terminal window. |
|
|
251
|
+
| actions | `string[]` | Identifiers for application actions. |
|
|
252
|
+
| mimeType | `string[]` | The MIME type(s) supported by this application. |
|
|
253
|
+
| categories | `string[]` | Categories in which the entry should be shown in a menu |
|
|
254
|
+
| implements | `string[]` | A list of interfaces that this application implements. |
|
|
255
|
+
| keywords | `string[]` | A list of strings which may be used in addition to other metadata to describe this entry. |
|
|
256
|
+
| 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. |
|
|
257
|
+
| 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 |
|
|
258
|
+
| prefersNonDefaultGPU | `boolean` | If true, the application prefers to be run on a more powerful discrete GPU if available. |
|
|
259
|
+
| singleMainWindow | `string` | If true, the application has a single main window, and does not support having an additional one opened. |
|
|
260
|
+
|
|
261
|
+
#### MacOS-specific options (`OsxRc`)
|
|
262
|
+
|
|
263
|
+
| Name | Type | Description |
|
|
264
|
+
| ---- | ------- | ----------- |
|
|
265
|
+
| name | `string` | The name of the application |
|
|
266
|
+
| icon | `string` | The path to the icon file. It should be a .icns file. |
|
|
267
|
+
| LSApplicationCategoryType | `string` | The category that best describes your app for the App Store. |
|
|
268
|
+
| CFBundleIdentifier | `string` | A unique identifier for a bundle usually in reverse DNS format. |
|
|
269
|
+
| CFBundleName | `string` | A user-visible short name for the bundle. |
|
|
270
|
+
| CFBundleDisplayName | `string` | The user-visible name for the bundle. |
|
|
271
|
+
| CFBundleSpokenName | `string` | A replacement for the app name in text-to-speech operations. |
|
|
272
|
+
| CFBundleVersion | `string` | The version of the build that identifies an iteration of the bundle. |
|
|
273
|
+
| CFBundleShortVersionString | `string` | The release or version number of the bundle. |
|
|
274
|
+
| NSHumanReadableCopyright | `string` | A human-readable copyright notice for the bundle. |
|
|
275
|
+
|
|
276
|
+
|
|
209
277
|
## Guides
|
|
210
278
|
|
|
211
279
|
### Get unofficial MacOS builds
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nw-builder",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.5",
|
|
4
4
|
"description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NW.js",
|
|
@@ -50,54 +50,29 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@stylistic/eslint-plugin-js": "^2.1.0",
|
|
53
|
-
"eslint": "^
|
|
53
|
+
"eslint": "^9.4.0",
|
|
54
54
|
"eslint-config-tjw-jsdoc": "^1.0.5",
|
|
55
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
55
|
+
"eslint-plugin-jsdoc": "^48.2.9",
|
|
56
56
|
"eslint-plugin-markdown": "^5.0.0",
|
|
57
57
|
"jsdoc": "^4.0.3",
|
|
58
|
-
"selenium-webdriver": "^4.
|
|
58
|
+
"selenium-webdriver": "^4.21.0",
|
|
59
59
|
"vitest": "^1.6.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"axios": "^1.
|
|
62
|
+
"axios": "^1.7.2",
|
|
63
63
|
"cli-progress": "^3.12.0",
|
|
64
|
-
"compressing": "^1.10.
|
|
65
|
-
"glob": "^10.
|
|
64
|
+
"compressing": "^1.10.1",
|
|
65
|
+
"glob": "^10.4.1",
|
|
66
66
|
"node-gyp": "^10.1.0",
|
|
67
67
|
"plist": "^3.1.0",
|
|
68
|
-
"
|
|
68
|
+
"resedit": "^2.0.2",
|
|
69
69
|
"semver": "^7.6.2",
|
|
70
|
-
"tar": "^7.
|
|
70
|
+
"tar": "^7.2.0",
|
|
71
71
|
"yargs": "^17.7.2",
|
|
72
72
|
"yauzl-promise": "^4.0.0"
|
|
73
73
|
},
|
|
74
|
-
"packageManager": "npm@10.
|
|
74
|
+
"packageManager": "npm@10.7.0",
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=14"
|
|
77
|
-
},
|
|
78
|
-
"eslintConfig": {
|
|
79
|
-
"parserOptions": {
|
|
80
|
-
"ecmaVersion": 2023,
|
|
81
|
-
"sourceType": "module"
|
|
82
|
-
},
|
|
83
|
-
"env": {
|
|
84
|
-
"es6": true,
|
|
85
|
-
"node": true
|
|
86
|
-
},
|
|
87
|
-
"extends": [
|
|
88
|
-
"eslint:recommended",
|
|
89
|
-
"plugin:markdown/recommended-legacy",
|
|
90
|
-
"tjw-jsdoc"
|
|
91
|
-
],
|
|
92
|
-
"plugins": [
|
|
93
|
-
"@stylistic/js"
|
|
94
|
-
],
|
|
95
|
-
"rules": {
|
|
96
|
-
"@stylistic/js/indent": [
|
|
97
|
-
"error",
|
|
98
|
-
2
|
|
99
|
-
],
|
|
100
|
-
"jsdoc/require-file-overview": "off"
|
|
101
|
-
}
|
|
102
77
|
}
|
|
103
78
|
}
|
package/src/bld.js
CHANGED
|
@@ -5,7 +5,9 @@ import fsm from "node:fs/promises";
|
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
|
|
7
7
|
import compressing from "compressing";
|
|
8
|
-
import
|
|
8
|
+
import * as resedit from "resedit";
|
|
9
|
+
// pe-library is a direct dependency of resedit
|
|
10
|
+
import * as peLibrary from 'pe-library';
|
|
9
11
|
import plist from "plist";
|
|
10
12
|
|
|
11
13
|
import util from "./util.js"
|
|
@@ -103,7 +105,7 @@ import util from "./util.js"
|
|
|
103
105
|
*
|
|
104
106
|
* @async
|
|
105
107
|
* @function
|
|
106
|
-
* @param {BuildOptions} options - Build options
|
|
108
|
+
* @param {BuildOptions} options - Build options
|
|
107
109
|
* @return {Promise<void>}
|
|
108
110
|
*/
|
|
109
111
|
async function bld({
|
|
@@ -311,28 +313,34 @@ const setWinConfig = async ({ app, outDir }) => {
|
|
|
311
313
|
}
|
|
312
314
|
});
|
|
313
315
|
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
};
|
|
319
|
-
|
|
316
|
+
const outDirAppExe = path.resolve(outDir, `${app.name}.exe`);
|
|
317
|
+
await fsm.rename(path.resolve(outDir, "nw.exe"), outDirAppExe);
|
|
318
|
+
const exe = peLibrary.NtExecutable.from(await fsm.readFile(outDirAppExe));
|
|
319
|
+
const res = peLibrary.NtExecutableResource.from(exe);
|
|
320
320
|
if (app.icon) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
throw error;
|
|
321
|
+
const iconBuffer = await fsm.readFile(path.resolve(app.icon));
|
|
322
|
+
const iconFile = resedit.Data.IconFile.from(iconBuffer);
|
|
323
|
+
// English (United States)
|
|
324
|
+
const EN_US = 1033;
|
|
325
|
+
resedit.Resource.IconGroupEntry.replaceIconsForResource(
|
|
326
|
+
res.entries,
|
|
327
|
+
// This is the name of the icon group nw.js uses that gets shown in file exlorers
|
|
328
|
+
'IDR_MAINFRAME',
|
|
329
|
+
EN_US,
|
|
330
|
+
iconFile.icons.map(i => i.data)
|
|
331
|
+
);
|
|
335
332
|
}
|
|
333
|
+
const [vi] = resedit.Resource.VersionInfo.fromEntries(res.entries);
|
|
334
|
+
const [major, minor, patch] = app.version.split(".");
|
|
335
|
+
vi.setFileVersion(major, minor, patch, 0, EN_US);
|
|
336
|
+
vi.setStringValues({
|
|
337
|
+
lang: EN_US,
|
|
338
|
+
codepage: 1200
|
|
339
|
+
}, versionString);
|
|
340
|
+
vi.outputToResourceEntries(res.entries);
|
|
341
|
+
res.outputResource(exe);
|
|
342
|
+
const outBuffer = Buffer.from(exe.generate());
|
|
343
|
+
await fsm.writeFile(outDirAppExe, outBuffer);
|
|
336
344
|
};
|
|
337
345
|
|
|
338
346
|
const setOsxConfig = async ({ outDir, app }) => {
|
|
@@ -4,6 +4,7 @@ import { beforeAll, describe, it } from "vitest";
|
|
|
4
4
|
|
|
5
5
|
import decompress from "./decompress.js";
|
|
6
6
|
import request from "./request.js";
|
|
7
|
+
import util from "../util.js";
|
|
7
8
|
|
|
8
9
|
describe("get/decompress", function () {
|
|
9
10
|
|
|
@@ -11,7 +12,10 @@ describe("get/decompress", function () {
|
|
|
11
12
|
let zipUrl = "https://dl.nwjs.io/v0.83.0/nwjs-sdk-v0.83.0-osx-x64.zip";
|
|
12
13
|
|
|
13
14
|
beforeAll(async function () {
|
|
14
|
-
await
|
|
15
|
+
const cacheExists = await util.fileExists("./test/fixture/cache")
|
|
16
|
+
if (!cacheExists) {
|
|
17
|
+
await fs.promises.mkdir("./test/fixture/cache");
|
|
18
|
+
}
|
|
15
19
|
|
|
16
20
|
await request(tarUrl, "./test/fixture/cache/nw.tar.gz");
|
|
17
21
|
await request(zipUrl, "./test/fixture/cache/nw.zip");
|
package/src/run.js
CHANGED
|
@@ -21,10 +21,10 @@ import util from "./util.js";
|
|
|
21
21
|
* Run NW.js application.
|
|
22
22
|
*
|
|
23
23
|
* @deprecated since v4.6.0. This logic will be ported over to `nwjs/npm-installer` repo and removed in the next major release (v5.0).
|
|
24
|
-
*
|
|
24
|
+
*
|
|
25
25
|
* @async
|
|
26
26
|
* @function
|
|
27
|
-
*
|
|
27
|
+
*
|
|
28
28
|
* @param {RunOptions} options Run mode options
|
|
29
29
|
* @return {Promise<void>}
|
|
30
30
|
*/
|
|
@@ -56,10 +56,7 @@ async function run({
|
|
|
56
56
|
const nwProcess = child_process.spawn(
|
|
57
57
|
path.resolve(nwDir, util.EXE_NAME[platform]),
|
|
58
58
|
[...[srcDir], ...argv],
|
|
59
|
-
{
|
|
60
|
-
detached: true,
|
|
61
|
-
windowsHide: true,
|
|
62
|
-
},
|
|
59
|
+
{ stdio: "inherit" },
|
|
63
60
|
);
|
|
64
61
|
|
|
65
62
|
nwProcess.on("close", () => {
|