nw-builder 4.20.0 → 4.21.4
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 +73 -23
- package/package.json +16 -8
- package/src/cli.js +22 -5
- package/src/index.js +9 -0
- package/src/util.js +6 -0
package/README.md
CHANGED
|
@@ -204,33 +204,83 @@ const appImagePath = await nwbuild({
|
|
|
204
204
|
});
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
+
#### Signing
|
|
208
|
+
|
|
209
|
+
Set `sign` to embed a GPG signature in the AppImage. It needs `gpg` on the host
|
|
210
|
+
with the secret key imported. `signKey` picks the key, defaulting to `gpg`'s
|
|
211
|
+
default secret key. A passphrase protected key reads its passphrase from the
|
|
212
|
+
`APPIMAGETOOL_SIGN_PASSPHRASE` environment variable.
|
|
213
|
+
|
|
214
|
+
```javascript
|
|
215
|
+
await nwbuild({
|
|
216
|
+
mode: "package",
|
|
217
|
+
sign: true,
|
|
218
|
+
signKey: "ABCDEF1234567890",
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### Self updating
|
|
223
|
+
|
|
224
|
+
Set `publish` to where releases are uploaded to make the AppImage self updatable
|
|
225
|
+
with [`@nwutils/updater`](https://www.npmjs.com/package/@nwutils/updater). An
|
|
226
|
+
`app-update.yml` pointing at `publish` is embedded in the AppImage, and a
|
|
227
|
+
`latest-linux.yml` update info file holding the app's `package.json` `version`
|
|
228
|
+
is written next to it. Upload both to every release.
|
|
229
|
+
|
|
230
|
+
Set `updateInformation: true` to also support zsync based updaters such as
|
|
231
|
+
AppImageUpdate - this needs `zsyncmake` on the host, and the `.zsync` file
|
|
232
|
+
written next to the AppImage must be uploaded too.
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"name": "demo",
|
|
237
|
+
"version": "1.2.0",
|
|
238
|
+
"nwbuild": {
|
|
239
|
+
"mode": "package",
|
|
240
|
+
"platform": "linux",
|
|
241
|
+
"app": { "name": "Demo" },
|
|
242
|
+
"publish": { "provider": "github", "owner": "nwutils", "repo": "demo" },
|
|
243
|
+
"updateInformation": true
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
With the CLI, pass `--publish.provider=github --publish.owner=nwutils
|
|
249
|
+
--publish.repo=demo`. See the
|
|
250
|
+
[`@nwutils/packager` docs](https://www.npmjs.com/package/@nwutils/packager) for
|
|
251
|
+
the `generic` provider and more details.
|
|
252
|
+
|
|
207
253
|
## API Reference
|
|
208
254
|
|
|
209
255
|
Options
|
|
210
256
|
|
|
211
|
-
| Name
|
|
212
|
-
|
|
|
213
|
-
| mode
|
|
214
|
-
| version
|
|
215
|
-
| flavor
|
|
216
|
-
| platform
|
|
217
|
-
| arch
|
|
218
|
-
| downloadUrl
|
|
219
|
-
| manifestUrl
|
|
220
|
-
| cacheDir
|
|
221
|
-
| cache
|
|
222
|
-
| ffmpeg
|
|
223
|
-
| logLevel
|
|
224
|
-
| shaSum
|
|
225
|
-
| srcDir
|
|
226
|
-
| argv
|
|
227
|
-
| glob
|
|
228
|
-
| outDir
|
|
229
|
-
| managedManifest
|
|
230
|
-
| nodeAddon
|
|
231
|
-
| zip
|
|
232
|
-
| format
|
|
233
|
-
|
|
|
257
|
+
| Name | Type | Default | Description |
|
|
258
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
259
|
+
| mode | `"get" \| "run" \| "build" \| "package"` | `"build"` | Choose between get, run, build or package mode |
|
|
260
|
+
| version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version |
|
|
261
|
+
| flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor |
|
|
262
|
+
| platform | `"linux" \| "osx" \| "win"` | | Host platform |
|
|
263
|
+
| arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture |
|
|
264
|
+
| 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`) |
|
|
265
|
+
| 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 |
|
|
266
|
+
| cacheDir | `string` | `"./cache"` | Directory to cache NW binaries |
|
|
267
|
+
| cache | `boolean` | `true` | If true the existing cache is used. Otherwise it removes and redownloads it. |
|
|
268
|
+
| ffmpeg | `boolean` | `false` | If true the chromium ffmpeg is replaced by community version with proprietary codecs. |
|
|
269
|
+
| logLevel | `"error" \| "warn" \| "info" \| "debug"` | `"info"` | Specify level of logging. |
|
|
270
|
+
| shaSum | `boolean` | `true` | Flag to enable/disable shasum checks. |
|
|
271
|
+
| srcDir | `string` | `"./"` | File paths to application code |
|
|
272
|
+
| 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. |
|
|
273
|
+
| glob | `boolean` | `true` | If true file globbing is enabled when parsing `srcDir`. |
|
|
274
|
+
| outDir | `string` | `"./out"` | Directory to store build artifacts |
|
|
275
|
+
| managedManifest | `boolean \| string \| object` | `false` | Managed manifest |
|
|
276
|
+
| nodeAddon | `boolean` | `false` | Rebuild Node native addons |
|
|
277
|
+
| zip | `boolean \| "zip" \| "tar" \| "tgz"` | `false` | If true, "zip", "tar" or "tgz" the `outDir` directory is compressed. |
|
|
278
|
+
| format | `"AppImage" \| "deb" \| "rpm" \| "msix" \| "nsis" \| "dmg"` | `"AppImage"` on Linux | Packaged output format, used in package mode. Only `"AppImage"` is implemented today. |
|
|
279
|
+
| sign | `boolean` | `false` | If true, embed a GPG signature in the AppImage. Used in package mode. |
|
|
280
|
+
| signKey | `string` | | ID of the GPG key to sign with. Requires `sign`. Used in package mode. |
|
|
281
|
+
| publish | `{provider: "github", owner, repo} \| {provider: "generic", url}` | | Where releases are published. Makes the AppImage self updatable with `@nwutils/updater`. Used in package mode. |
|
|
282
|
+
| updateInformation | `boolean \| string` | | AppImage zsync update information. `true` derives it from `publish`. Used in package mode. |
|
|
283
|
+
| app | `LinuxRc \| WinRc \| OsxRc` | Additional options for each platform. (See below.) |
|
|
234
284
|
|
|
235
285
|
### `app` configuration object
|
|
236
286
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nw-builder",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.4",
|
|
4
4
|
"description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NW.js",
|
|
@@ -54,16 +54,24 @@
|
|
|
54
54
|
"demo:exe:win": "../../tests/fixtures/nw-builder/out/win/Demo.exe",
|
|
55
55
|
"demo:cli": "nwbuild --mode=build --flavor=sdk --glob=false --cacheDir=./node_modules/nw --logLevel=debug --managedManifest=../../tests/fixtures/nw-builder/app/package.json --outDir=../../tests/fixtures/nw-builder/out/linux --app.name=Demo --app.icon=../../tests/fixtures/nw-builder/app/icon.png ../../tests/fixtures/nw-builder/app"
|
|
56
56
|
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"base-volta-off-of-nwjs": "^1.0.5",
|
|
59
|
-
"nw": "^0.115.0"
|
|
60
|
-
},
|
|
61
57
|
"dependencies": {
|
|
62
|
-
"@nwutils/builder": "^0.1.
|
|
58
|
+
"@nwutils/builder": "^0.1.2",
|
|
63
59
|
"@nwutils/getter": "^0.2.5",
|
|
64
|
-
"@nwutils/packager": "^0.
|
|
65
|
-
"@nwutils/runner": "^0.2.
|
|
60
|
+
"@nwutils/packager": "^0.5.0",
|
|
61
|
+
"@nwutils/runner": "^0.2.6",
|
|
66
62
|
"commander": "^15.0.0",
|
|
67
63
|
"glob": "^13.0.6"
|
|
64
|
+
},
|
|
65
|
+
"devEngines": {
|
|
66
|
+
"runtime": {
|
|
67
|
+
"name": "node",
|
|
68
|
+
"version": "26.7.0",
|
|
69
|
+
"onFail": "warn"
|
|
70
|
+
},
|
|
71
|
+
"packageManager": {
|
|
72
|
+
"name": "npm",
|
|
73
|
+
"version": "12.0.2",
|
|
74
|
+
"onFail": "warn"
|
|
75
|
+
}
|
|
68
76
|
}
|
|
69
77
|
}
|
package/src/cli.js
CHANGED
|
@@ -48,18 +48,32 @@ program
|
|
|
48
48
|
.option("--managedManifest <string>", "Managed manifest mode", false)
|
|
49
49
|
.option("--nodeAddon <boolean>", "Download NW.js Node headers", false)
|
|
50
50
|
.option("--format <string>", "Packaged output format, used in package mode")
|
|
51
|
+
.option(
|
|
52
|
+
"--sign <boolean>",
|
|
53
|
+
"Sign the AppImage with GPG, used in package mode",
|
|
54
|
+
)
|
|
55
|
+
.option(
|
|
56
|
+
"--signKey <string>",
|
|
57
|
+
"GPG key to sign the AppImage with, used in package mode",
|
|
58
|
+
)
|
|
59
|
+
.option(
|
|
60
|
+
"--updateInformation <string>",
|
|
61
|
+
"AppImage zsync update information, or true to derive it from --publish.*",
|
|
62
|
+
)
|
|
51
63
|
.allowUnknownOption(true)
|
|
52
64
|
.allowExcessArguments(true);
|
|
53
65
|
|
|
54
|
-
// Handle unknown --app.* arguments
|
|
66
|
+
// Handle unknown --app.* and --publish.* arguments
|
|
55
67
|
const unknownArgs = program.parse(process.argv).args;
|
|
56
68
|
/** @type {Record<string, string>} */
|
|
57
69
|
const appConfig = {};
|
|
70
|
+
/** @type {Record<string, string>} */
|
|
71
|
+
const publishConfig = {};
|
|
58
72
|
for (const arg of unknownArgs) {
|
|
59
|
-
const match = arg.match(/^--app\.([^.=]+)=(.*)$/);
|
|
73
|
+
const match = arg.match(/^--(app|publish)\.([^.=]+)=(.*)$/);
|
|
60
74
|
if (match) {
|
|
61
|
-
const [, key, value] = match;
|
|
62
|
-
appConfig[key] = value;
|
|
75
|
+
const [, group, key, value] = match;
|
|
76
|
+
(group === "app" ? appConfig : publishConfig)[key] = value;
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
79
|
|
|
@@ -67,7 +81,10 @@ for (const arg of unknownArgs) {
|
|
|
67
81
|
const opts = {
|
|
68
82
|
...program.opts(),
|
|
69
83
|
app: appConfig,
|
|
70
|
-
|
|
84
|
+
publish: Object.keys(publishConfig).length > 0 ? publishConfig : undefined,
|
|
85
|
+
srcDir: program.args.find(
|
|
86
|
+
(arg) => !arg.startsWith("--app") && !arg.startsWith("--publish"),
|
|
87
|
+
),
|
|
71
88
|
cli: true,
|
|
72
89
|
};
|
|
73
90
|
|
package/src/index.js
CHANGED
|
@@ -34,6 +34,10 @@ import util from "./util.js";
|
|
|
34
34
|
* @property {boolean} [cli=false] If true the CLI is used to parse options. This option is used internally.
|
|
35
35
|
* @property {string[]} [argv = []] CLI arguments passed to the NW.js process in run mode
|
|
36
36
|
* @property {"AppImage" | "deb" | "rpm" | "msix" | "nsis" | "dmg"} [format] Packaged output format, used in package mode. Defaults to `"AppImage"` on Linux. Only `"AppImage"` is implemented today - the others are reserved.
|
|
37
|
+
* @property {boolean} [sign=false] If true, embed a GPG signature in the AppImage, used in package mode.
|
|
38
|
+
* @property {string} [signKey] ID of the GPG key to sign the AppImage with, used in package mode. Requires `sign`.
|
|
39
|
+
* @property {import("@nwutils/packager").PublishOptions} [publish] Where releases are published, used in package mode. Makes the AppImage self updatable with `@nwutils/updater`.
|
|
40
|
+
* @property {boolean | string} [updateInformation] AppImage zsync update information, used in package mode. `true` derives it from `publish`.
|
|
37
41
|
*/
|
|
38
42
|
|
|
39
43
|
/**
|
|
@@ -208,6 +212,11 @@ async function nwbuild(options) {
|
|
|
208
212
|
arch: resolved.arch,
|
|
209
213
|
cacheDir: resolved.cacheDir,
|
|
210
214
|
cache: resolved.cache,
|
|
215
|
+
sign: resolved.sign,
|
|
216
|
+
signKey: resolved.signKey,
|
|
217
|
+
version: manifest.json?.version,
|
|
218
|
+
publish: resolved.publish,
|
|
219
|
+
updateInformation: resolved.updateInformation,
|
|
211
220
|
});
|
|
212
221
|
util.log(
|
|
213
222
|
"info",
|
package/src/util.js
CHANGED
|
@@ -109,6 +109,10 @@ import * as GlobModule from "glob";
|
|
|
109
109
|
* @property {boolean | string} [shaSum] If true, shasum is enabled
|
|
110
110
|
* @property {boolean | string} [nativeAddon] Get Node native addons
|
|
111
111
|
* @property {"AppImage" | "deb" | "rpm" | "msix" | "nsis" | "dmg"} [format] Packaged output format, used in package mode
|
|
112
|
+
* @property {boolean | string} [sign] If true, sign the AppImage, used in package mode
|
|
113
|
+
* @property {string} [signKey] GPG key to sign the AppImage with, used in package mode
|
|
114
|
+
* @property {import("@nwutils/packager").PublishOptions} [publish] Where releases are published, used in package mode
|
|
115
|
+
* @property {boolean | string} [updateInformation] AppImage zsync update information, used in package mode
|
|
112
116
|
* @property {string[]} [argv] CLI arguments passed to the NW.js process in run mode
|
|
113
117
|
* @property {boolean | string} [glob] If true file globbing is enabled when parsing srcDir
|
|
114
118
|
* @property {string | string[]} [srcDir] File paths to application code
|
|
@@ -352,6 +356,8 @@ export const parse = async (options, pkg) => {
|
|
|
352
356
|
if (options.mode === "package") {
|
|
353
357
|
options.format =
|
|
354
358
|
options.format ?? (options.platform === "linux" ? "AppImage" : undefined);
|
|
359
|
+
options.sign = str2Bool(options.sign ?? false);
|
|
360
|
+
options.updateInformation = str2Bool(options.updateInformation);
|
|
355
361
|
}
|
|
356
362
|
|
|
357
363
|
options.argv = options.argv ?? [];
|