nw-builder 4.17.7 → 4.17.9
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 +3 -1
- package/package.json +8 -6
- package/src/bld/osx.js +8 -2
- package/src/index.js +7 -4
- package/src/run.js +0 -78
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
Build [NW.js](https://github.com/nwjs/nw.js) applications for Mac, Windows and Linux.
|
|
7
7
|
|
|
8
|
+
> The `stable` tag is deprecated and will be removed. Please use the default `latest` tag.
|
|
9
|
+
|
|
8
10
|
## Major Features
|
|
9
11
|
|
|
10
12
|
- Get, run or build applications.
|
|
@@ -166,7 +168,7 @@ Setting it to a `string` implies that you are passing the file path to the NW ma
|
|
|
166
168
|
```javascript
|
|
167
169
|
nwbuild({
|
|
168
170
|
mode: "build",
|
|
169
|
-
managedManifest: "./nw.
|
|
171
|
+
managedManifest: "./nw.json",
|
|
170
172
|
});
|
|
171
173
|
```
|
|
172
174
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nw-builder",
|
|
3
|
-
"version": "4.17.
|
|
3
|
+
"version": "4.17.9",
|
|
4
4
|
"description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NW.js",
|
|
@@ -56,26 +56,28 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@eslint/js": "^10.0.1",
|
|
59
|
-
"@vitest/coverage-v8": "^4.1.
|
|
59
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
60
60
|
"base-volta-off-of-nwjs": "^1.0.5",
|
|
61
|
-
"eslint": "^10.2.
|
|
61
|
+
"eslint": "^10.2.1",
|
|
62
62
|
"eslint-plugin-jsdoc": "^62.9.0",
|
|
63
63
|
"globals": "^17.5.0",
|
|
64
|
-
"nw": "^0.
|
|
64
|
+
"nw": "^0.111.0",
|
|
65
65
|
"selenium-webdriver": "^4.43.0",
|
|
66
66
|
"vitest": "^4.0.14"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@nwutils/getter": "^0.2.4",
|
|
70
|
+
"@nwutils/runner": "^0.2.3",
|
|
70
71
|
"archiver": "^7.0.1",
|
|
71
72
|
"commander": "^14.0.3",
|
|
72
73
|
"glob": "^13.0.6",
|
|
73
|
-
"plist": "^3.1.
|
|
74
|
+
"plist": "^3.1.1",
|
|
74
75
|
"resedit": "^3.0.2",
|
|
76
|
+
"semver": "^7.7.4",
|
|
75
77
|
"tar": "^7.5.10"
|
|
76
78
|
},
|
|
77
79
|
"volta": {
|
|
78
80
|
"node": "25.8.2",
|
|
79
|
-
"npm": "11.
|
|
81
|
+
"npm": "11.13.0"
|
|
80
82
|
}
|
|
81
83
|
}
|
package/src/bld/osx.js
CHANGED
|
@@ -4,6 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import process from 'node:process';
|
|
5
5
|
|
|
6
6
|
import plist from 'plist';
|
|
7
|
+
import semver from 'semver';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Function to update Helper App Plist Files
|
|
@@ -25,12 +26,13 @@ async function updateHelperPlist (plistPath, helperName, helperId, appCFBundleId
|
|
|
25
26
|
/**
|
|
26
27
|
*
|
|
27
28
|
* @param {object} options - Options.
|
|
29
|
+
* @param {string} options.version - NW.js version.
|
|
28
30
|
* @param {object} options.app - Application configuration.
|
|
29
31
|
* @param {string} options.outDir - Output directory.
|
|
30
32
|
* @param {string} options.releaseInfo - Release information.
|
|
31
33
|
* @returns {Promise<void>} - Promise.
|
|
32
34
|
*/
|
|
33
|
-
export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
35
|
+
export default async function setOsxConfig({ version, app, outDir, releaseInfo }) {
|
|
34
36
|
if (process.platform === 'win32') {
|
|
35
37
|
console.warn(
|
|
36
38
|
'MacOS apps built on Windows platform do not preserve all file permissions. See #716',
|
|
@@ -77,11 +79,15 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
|
77
79
|
const helperApps = [
|
|
78
80
|
{ name: 'nwjs Helper (Alerts).app', id: 'helper.alert' },
|
|
79
81
|
{ name: 'nwjs Helper (GPU).app', id: 'helper.gpu' },
|
|
80
|
-
{ name: 'nwjs Helper (Plugin).app', id: 'helper.plugin' },
|
|
81
82
|
{ name: 'nwjs Helper (Renderer).app', id: 'helper.renderer' },
|
|
82
83
|
{ name: 'nwjs Helper.app', id: 'helper' },
|
|
83
84
|
];
|
|
84
85
|
|
|
86
|
+
/* 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' });
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
for (const helperApp of helperApps) {
|
|
86
92
|
const newHelperAppName = helperApp.name.replace(/^nwjs/, app.name);
|
|
87
93
|
const oldPath = path.resolve(helperBaseDir, helperApp.name);
|
package/src/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import console from 'node:console';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
|
|
6
|
-
import bld from './bld.js';
|
|
7
6
|
import get from '@nwutils/getter';
|
|
8
|
-
import run from '
|
|
7
|
+
import run from '@nwutils/runner';
|
|
8
|
+
|
|
9
|
+
import bld from './bld.js';
|
|
9
10
|
import util from './util.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -55,7 +56,7 @@ async function nwbuild(options) {
|
|
|
55
56
|
util.log('debug', 'info', 'Get node manifest...');
|
|
56
57
|
manifest = await util.getNodeManifest({ srcDir: options.srcDir, glob: options.glob });
|
|
57
58
|
if (typeof manifest.json?.nwbuild === 'object') {
|
|
58
|
-
options = manifest.json.nwbuild;
|
|
59
|
+
options = { ...options, ...manifest.json.nwbuild };
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
util.log('info', options.logLevel, 'Parse final options using node manifest');
|
|
@@ -115,6 +116,9 @@ async function nwbuild(options) {
|
|
|
115
116
|
|
|
116
117
|
if (options.mode === 'run') {
|
|
117
118
|
util.log('info', options.logLevel, 'Running NW.js in run mode...');
|
|
119
|
+
if (options.glob) {
|
|
120
|
+
throw new Error('Glob option is not supported when mode is set to run.');
|
|
121
|
+
}
|
|
118
122
|
const nwProcess = await run({
|
|
119
123
|
version: options.version,
|
|
120
124
|
flavor: options.flavor,
|
|
@@ -122,7 +126,6 @@ async function nwbuild(options) {
|
|
|
122
126
|
arch: options.arch,
|
|
123
127
|
srcDir: options.srcDir,
|
|
124
128
|
cacheDir: options.cacheDir,
|
|
125
|
-
glob: options.glob,
|
|
126
129
|
argv: options.argv,
|
|
127
130
|
});
|
|
128
131
|
return nwProcess;
|
package/src/run.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import child_process from 'node:child_process';
|
|
2
|
-
import console from 'node:console';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import process from 'node:process';
|
|
5
|
-
|
|
6
|
-
import util from './util.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {object} RunOptions
|
|
10
|
-
* @property {string | "latest" | "stable" | "lts"} [version = "latest"] Runtime version
|
|
11
|
-
* @property {"normal" | "sdk"} [flavor = "normal"] Build flavor
|
|
12
|
-
* @property {"linux" | "osx" | "win"} [platform] Target platform
|
|
13
|
-
* @property {"ia32" | "x64" | "arm64"} [arch] Target arch
|
|
14
|
-
* @property {string} [srcDir = "./src"] Source directory
|
|
15
|
-
* @property {string} [cacheDir = "./cache"] Cache directory
|
|
16
|
-
* @property {boolean} [glob = false] If true, throw error
|
|
17
|
-
* @property {string[]} [argv = []] CLI arguments
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Run NW.js application.
|
|
22
|
-
* @async
|
|
23
|
-
* @function
|
|
24
|
-
* @param {RunOptions} options Run mode options
|
|
25
|
-
* @returns {Promise<child_process.ChildProcess | null>} - A Node.js process object
|
|
26
|
-
*/
|
|
27
|
-
async function run({
|
|
28
|
-
version = 'latest',
|
|
29
|
-
flavor = 'normal',
|
|
30
|
-
platform = util.PLATFORM_KV[process.platform],
|
|
31
|
-
arch = util.ARCH_KV[process.arch],
|
|
32
|
-
srcDir = './src',
|
|
33
|
-
cacheDir = './cache',
|
|
34
|
-
glob = false,
|
|
35
|
-
argv = [],
|
|
36
|
-
}) {
|
|
37
|
-
/**
|
|
38
|
-
* @type {child_process.ChildProcess | null}
|
|
39
|
-
*/
|
|
40
|
-
let nwProcess = null;
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
if (util.EXE_NAME[platform] === undefined) {
|
|
44
|
-
throw new Error('Unsupported platform.');
|
|
45
|
-
}
|
|
46
|
-
if (glob === true) {
|
|
47
|
-
throw new Error('Globbing is not supported with run mode.');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const nwDir = path.resolve(
|
|
51
|
-
cacheDir,
|
|
52
|
-
`nwjs${flavor === 'sdk' ? '-sdk' : ''}-v${version}-${platform}-${arch}`,
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
return new Promise((res, rej) => {
|
|
56
|
-
/* It is assumed that the package.json is located at `${options.srcDir}/package.json` */
|
|
57
|
-
nwProcess = child_process.spawn(
|
|
58
|
-
path.resolve(nwDir, util.EXE_NAME[platform]),
|
|
59
|
-
[...[srcDir], ...argv],
|
|
60
|
-
{ stdio: 'inherit' },
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
nwProcess.on('close', () => {
|
|
64
|
-
res();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
nwProcess.on('error', (error) => {
|
|
68
|
-
console.error(error);
|
|
69
|
-
rej(error);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error(error);
|
|
74
|
-
}
|
|
75
|
-
return nwProcess;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export default run;
|