nw-builder 4.15.0 → 4.16.2
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 +2 -35
- package/package.json +18 -19
- package/src/bld.js +0 -21
- package/src/cli.js +1 -1
- package/src/get/index.js +2 -2
- package/src/index.js +1 -2
- package/src/util.js +10 -19
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ Get Node headers if you have to rebuild Node addons.
|
|
|
122
122
|
```javascript
|
|
123
123
|
nwbuild({
|
|
124
124
|
mode: "get",
|
|
125
|
-
nativeAddon:
|
|
125
|
+
nativeAddon: true,
|
|
126
126
|
});
|
|
127
127
|
```
|
|
128
128
|
|
|
@@ -182,27 +182,6 @@ nwbuild({
|
|
|
182
182
|
});
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
#### Rebuild Node addons
|
|
186
|
-
|
|
187
|
-
> Currently this feature is disabled and it may be removed in the future.
|
|
188
|
-
|
|
189
|
-
It only builds node addons which have a `binding.gyp` file in the `srcDir`. There are plans to support nan, cmake, ffi and gn and auto rebuild native addons which are installed as node modules.
|
|
190
|
-
|
|
191
|
-
```javascript
|
|
192
|
-
nwbuild({
|
|
193
|
-
mode: "build",
|
|
194
|
-
nodeAddon: "gyp",
|
|
195
|
-
});
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
We recommend rebuilding Node addons for NW.js via `node-gyp` if you are using NW.js v0.83.0 or above.
|
|
199
|
-
|
|
200
|
-
```shell
|
|
201
|
-
node-gyp rebuild --target=22.2.0 --nodedir=/path/to/nw/node/headers
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
NW.js's Node version should match the Node version on the host machine due to [ABI differences in V8](https://github.com/nwjs/nw.js/issues/5025).
|
|
205
|
-
|
|
206
185
|
## API Reference
|
|
207
186
|
|
|
208
187
|
Options
|
|
@@ -226,7 +205,7 @@ Options
|
|
|
226
205
|
| glob | `boolean` | `true`| If true file globbing is enabled when parsing `srcDir`. |
|
|
227
206
|
| outDir | `string` | `"./out"` | Directory to store build artifacts |
|
|
228
207
|
| managedManifest | `boolean \| string \| object` | `false` | Managed manifest |
|
|
229
|
-
| nodeAddon | `
|
|
208
|
+
| nodeAddon | `boolean` | `false` | Rebuild Node native addons |
|
|
230
209
|
| zip | `boolean \| "zip" \| "tar" \| "tgz"` | `false`| If true, "zip", "tar" or "tgz" the `outDir` directory is compressed. |
|
|
231
210
|
| app | `LinuxRc \| WinRc \| OsxRc` | Additional options for each platform. (See below.)
|
|
232
211
|
|
|
@@ -343,18 +322,6 @@ nwbuild({
|
|
|
343
322
|
});
|
|
344
323
|
```
|
|
345
324
|
|
|
346
|
-
### Let `nw-builder` manage your native addons
|
|
347
|
-
|
|
348
|
-
> Note: this behaviour is buggy and quite limited. This guide is to show what will be possible in the coming minor releases.
|
|
349
|
-
|
|
350
|
-
```javascript
|
|
351
|
-
nwbuild({
|
|
352
|
-
mode: "build",
|
|
353
|
-
managedManifest: true,
|
|
354
|
-
nativeAddon: "gyp",
|
|
355
|
-
});
|
|
356
|
-
```
|
|
357
|
-
|
|
358
325
|
## Contributing
|
|
359
326
|
|
|
360
327
|
### External contributor
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nw-builder",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.2",
|
|
4
4
|
"description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NW.js",
|
|
@@ -52,33 +52,32 @@
|
|
|
52
52
|
"demo:exe:linux": "./tests/fixtures/out/linux/Demo",
|
|
53
53
|
"demo:exe:osx": "./tests/fixtures/out/osx/Demo.app/Contents/MacOS/Demo",
|
|
54
54
|
"demo:exe:win": "./tests/fixtures/out/win/Demo.exe",
|
|
55
|
-
"demo:cli": "nwbuild --mode=build --flavor=sdk --glob=false --cacheDir=./node_modules/nw --logLevel=debug --outDir=./tests/fixtures/out/linux --app.name=Demo --app.icon=./tests/fixtures/app/icon.png ./tests/fixtures/app"
|
|
55
|
+
"demo:cli": "nwbuild --mode=build --flavor=sdk --glob=false --cacheDir=./node_modules/nw --logLevel=debug --managedManifest=./tests/fixtures/app/package.json --outDir=./tests/fixtures/out/linux --app.name=Demo --app.icon=./tests/fixtures/app/icon.png ./tests/fixtures/app"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@eslint/js": "^9.
|
|
59
|
-
"@vitest/coverage-v8": "^
|
|
58
|
+
"@eslint/js": "^9.39.2",
|
|
59
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
60
60
|
"base-volta-off-of-nwjs": "^1.0.5",
|
|
61
|
-
"eslint": "^9.
|
|
62
|
-
"eslint-plugin-jsdoc": "^
|
|
63
|
-
"globals": "^16.
|
|
64
|
-
"nw": "^0.
|
|
65
|
-
"selenium-webdriver": "^4.
|
|
66
|
-
"vitest": "^
|
|
61
|
+
"eslint": "^9.39.2",
|
|
62
|
+
"eslint-plugin-jsdoc": "^61.5.0",
|
|
63
|
+
"globals": "^16.5.0",
|
|
64
|
+
"nw": "^0.106.1",
|
|
65
|
+
"selenium-webdriver": "^4.39.0",
|
|
66
|
+
"vitest": "^4.0.14"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"archiver": "^7.0.1",
|
|
70
|
-
"axios": "^1.
|
|
71
|
-
"commander": "^14.0.
|
|
72
|
-
"glob": "^
|
|
73
|
-
"node-gyp": "^11.3.0",
|
|
70
|
+
"axios": "^1.13.2",
|
|
71
|
+
"commander": "^14.0.2",
|
|
72
|
+
"glob": "^13.0.0",
|
|
74
73
|
"plist": "^3.1.0",
|
|
75
|
-
"resedit": "^
|
|
76
|
-
"semver": "^7.7.
|
|
77
|
-
"tar": "^7.
|
|
74
|
+
"resedit": "^3.0.1",
|
|
75
|
+
"semver": "^7.7.3",
|
|
76
|
+
"tar": "^7.5.2",
|
|
78
77
|
"yauzl-promise": "^4.0.0"
|
|
79
78
|
},
|
|
80
79
|
"volta": {
|
|
81
|
-
"node": "
|
|
82
|
-
"npm": "11.
|
|
80
|
+
"node": "25.2.1",
|
|
81
|
+
"npm": "11.6.4"
|
|
83
82
|
}
|
|
84
83
|
}
|
package/src/bld.js
CHANGED
|
@@ -96,7 +96,6 @@ import setOsxConfig from './bld/osx.js';
|
|
|
96
96
|
* @property {LinuxRc | WinRc | OsxRc} [app] Platform specific rc
|
|
97
97
|
* @property {boolean} [glob = true] File globbing
|
|
98
98
|
* @property {boolean | string | object} [managedManifest = false] Manage manifest
|
|
99
|
-
* @property {false | "gyp"} [nativeAddon = false] Rebuild native modules
|
|
100
99
|
* @property {false | "zip" | "tar" | "tgz"} [zip = false] Compress built artifacts
|
|
101
100
|
* @property {object} [releaseInfo = {}] Version specific release metadata.
|
|
102
101
|
*/
|
|
@@ -119,7 +118,6 @@ async function bld({
|
|
|
119
118
|
app,
|
|
120
119
|
glob = true,
|
|
121
120
|
managedManifest = false,
|
|
122
|
-
nativeAddon = false,
|
|
123
121
|
zip = false,
|
|
124
122
|
releaseInfo = {},
|
|
125
123
|
}) {
|
|
@@ -190,11 +188,6 @@ async function bld({
|
|
|
190
188
|
await setOsxConfig({ app, outDir, releaseInfo });
|
|
191
189
|
}
|
|
192
190
|
|
|
193
|
-
if (nativeAddon === 'gyp') {
|
|
194
|
-
throw new Error('Rebuilding Node addons functionality is broken and has been disabled. This functionality may be removed in the future.');
|
|
195
|
-
// buildNativeAddon({ cacheDir, version, platform, arch, outDir, nodeVersion });
|
|
196
|
-
}
|
|
197
|
-
|
|
198
191
|
if (zip !== false) {
|
|
199
192
|
await compress({ zip, outDir });
|
|
200
193
|
}
|
|
@@ -354,20 +347,6 @@ const setWinConfig = async ({ app, outDir }) => {
|
|
|
354
347
|
await fs.promises.writeFile(outDirAppExe, outBuffer);
|
|
355
348
|
};
|
|
356
349
|
|
|
357
|
-
/*
|
|
358
|
-
const buildNativeAddon = ({ cacheDir, version, platform, arch, outDir, nodeVersion }) => {
|
|
359
|
-
let nodePath = path.resolve(cacheDir, `node-v${version}-${platform}-${arch}`);
|
|
360
|
-
const cwd = path.resolve(
|
|
361
|
-
outDir,
|
|
362
|
-
platform !== 'osx'
|
|
363
|
-
? 'package.nw'
|
|
364
|
-
: 'nwjs.app/Contents/Resources/app.nw',
|
|
365
|
-
);
|
|
366
|
-
|
|
367
|
-
child_process.execFileSync('node-gyp', ['rebuild', `--target=${nodeVersion}`, `--nodedir=${nodePath}`], { cwd });
|
|
368
|
-
};
|
|
369
|
-
*/
|
|
370
|
-
|
|
371
350
|
const compress = async ({
|
|
372
351
|
zip,
|
|
373
352
|
outDir,
|
package/src/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ program
|
|
|
22
22
|
.option('--ffmpeg <boolean>', 'Enable/disable community ffmpeg', false)
|
|
23
23
|
.option('--glob <boolean>', 'Enable/disable globbing', true)
|
|
24
24
|
.option('--logLevel <string>', 'Specify log level', 'info')
|
|
25
|
-
.option('--shaSum <
|
|
25
|
+
.option('--shaSum <boolean>', 'Enable/disable shasum', true)
|
|
26
26
|
.option('--zip <string>', 'Enable/disable compression', false)
|
|
27
27
|
.option('--managedManifest <string>', 'Managed manifest mode', false)
|
|
28
28
|
.option('--nodeAddon <boolean>', 'Download NW.js Node headers', false)
|
package/src/get/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import util from '../util.js';
|
|
|
20
20
|
* @property {string} [cacheDir = "./cache"] Cache directory
|
|
21
21
|
* @property {boolean} [cache = true] If false, remove cache and redownload.
|
|
22
22
|
* @property {boolean} [ffmpeg = false] If true, ffmpeg is not downloaded.
|
|
23
|
-
* @property {
|
|
23
|
+
* @property {boolean} [nativeAddon = false] Download Node headers for native addons.
|
|
24
24
|
* @property {string} [logLevel = 'info'] User defined log level.
|
|
25
25
|
* @property {boolean} [shaSum = true] If true shasum is enabled, otherwise disabled.
|
|
26
26
|
*/
|
|
@@ -183,7 +183,7 @@ async function get(options) {
|
|
|
183
183
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
if (options.nativeAddon ===
|
|
186
|
+
if (options.nativeAddon === true) {
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
189
|
* File path to NW'js Node headers tarball.
|
package/src/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import util from './util.js';
|
|
|
28
28
|
* @property {boolean} [shaSum = true] If true, shasum is enabled. Otherwise, disabled.
|
|
29
29
|
* @property {boolean | "zip" | "tar" | "tgz"} [zip=false] If true, "zip", "tar" or "tgz" the outDir directory is compressed.
|
|
30
30
|
* @property {boolean | string | object} [managedManifest = false] Managed manifest mode
|
|
31
|
-
* @property {
|
|
31
|
+
* @property {boolean} [nodeAddon = false] Get Node native addons
|
|
32
32
|
* @property {boolean} [cli=false] If true the CLI is used to parse options. This option is used internally.
|
|
33
33
|
*/
|
|
34
34
|
|
|
@@ -139,7 +139,6 @@ async function nwbuild(options) {
|
|
|
139
139
|
app: options.app,
|
|
140
140
|
glob: options.glob,
|
|
141
141
|
managedManifest: options.managedManifest,
|
|
142
|
-
nativeAddon: options.nativeAddon,
|
|
143
142
|
zip: options.zip,
|
|
144
143
|
releaseInfo: releaseInfo,
|
|
145
144
|
});
|
package/src/util.js
CHANGED
|
@@ -5,7 +5,6 @@ import path from 'node:path';
|
|
|
5
5
|
import process from 'node:process';
|
|
6
6
|
|
|
7
7
|
import * as GlobModule from 'glob';
|
|
8
|
-
import semver from 'semver';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Get manifest (array of NW release metadata) from URL.
|
|
@@ -176,16 +175,14 @@ async function getNodeManifest({
|
|
|
176
175
|
/**
|
|
177
176
|
* Function to convert `'true'` and `'false'` into `true` and `false`.
|
|
178
177
|
* `commander` does not do the conversion automatically.
|
|
179
|
-
* @param {
|
|
180
|
-
* @returns {
|
|
178
|
+
* @param {string} option - a boolean type option
|
|
179
|
+
* @returns {true | false | string} `true`, `false` or file path
|
|
181
180
|
*/
|
|
182
181
|
function str2Bool(option) {
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
182
|
+
if (option === 'true') {
|
|
183
|
+
return true;
|
|
184
|
+
} else if (option === 'false') {
|
|
185
|
+
return false;
|
|
189
186
|
} else {
|
|
190
187
|
return option;
|
|
191
188
|
}
|
|
@@ -211,7 +208,7 @@ export const parse = async (options, pkg) => {
|
|
|
211
208
|
options.cache = str2Bool(options.cache ?? true);
|
|
212
209
|
options.ffmpeg = str2Bool(options.ffmpeg ?? false);
|
|
213
210
|
options.logLevel = options.logLevel ?? 'info';
|
|
214
|
-
options.shaSum = options.shaSum ?? true;
|
|
211
|
+
options.shaSum = str2Bool(options.shaSum ?? true);
|
|
215
212
|
|
|
216
213
|
if (options.mode === 'get') {
|
|
217
214
|
return { ...options };
|
|
@@ -428,21 +425,15 @@ export const validate = async (options, releaseInfo) => {
|
|
|
428
425
|
}
|
|
429
426
|
|
|
430
427
|
if (typeof options.nativeAddon !== 'boolean') {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
if (semver.parse(options.version).minor >= '83' && options.nativeAddon !== false) {
|
|
436
|
-
throw new Error('Native addons are not supported for NW.js v0.82.0 and below');
|
|
437
|
-
}
|
|
428
|
+
throw new Error('Expected options.nativeAddon to be a boolean. Got ' + typeof options.nativeAddon);
|
|
429
|
+
}
|
|
438
430
|
|
|
439
|
-
|
|
431
|
+
if (typeof options.zip !== 'boolean' &
|
|
440
432
|
options.zip !== 'zip' &&
|
|
441
433
|
options.zip !== 'tar' &&
|
|
442
434
|
options.zip !== 'tgz') {
|
|
443
435
|
throw new Error('Expected options.zip to be a boolean, `zip`, `tar` or `tgz`. Got ' + typeof options.zip);
|
|
444
436
|
}
|
|
445
|
-
}
|
|
446
437
|
|
|
447
438
|
if (options.platform === 'linux') {
|
|
448
439
|
if (options.app.name && typeof options.app.name !== 'string') {
|