nw-builder 4.10.0 → 4.11.1
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 +1 -2
- package/package.json +13 -12
- package/src/bld/osx.js +75 -311
- package/src/bld.js +12 -11
- package/src/cli.js +23 -86
- package/src/index.d.ts +4 -0
- package/src/util.js +2 -0
package/README.md
CHANGED
|
@@ -286,6 +286,7 @@ This object defines additional properties used for building for a specific platf
|
|
|
286
286
|
| CFBundleVersion | `string` | The version of the build that identifies an iteration of the bundle. |
|
|
287
287
|
| CFBundleShortVersionString | `string` | The release or version number of the bundle. |
|
|
288
288
|
| NSHumanReadableCopyright | `string` | A human-readable copyright notice for the bundle. |
|
|
289
|
+
| NSLocalNetworkUsageDescription | `string` | A human-readable description of why the application needs access to the local network. |
|
|
289
290
|
|
|
290
291
|
|
|
291
292
|
## Guides
|
|
@@ -375,7 +376,6 @@ nwbuild({
|
|
|
375
376
|
### Features
|
|
376
377
|
|
|
377
378
|
- feat(get): support canary releases
|
|
378
|
-
- feat(bld): rename MacOS Helper apps
|
|
379
379
|
- feat(pkg): add `AppImage` installer
|
|
380
380
|
- feat(pkg): add `NSIS` installer
|
|
381
381
|
- feat(pkg): add `DMG` installer
|
|
@@ -389,7 +389,6 @@ nwbuild({
|
|
|
389
389
|
- chore: annotate file paths as `fs.PathLike` instead of `string`.
|
|
390
390
|
- chore(bld): factor out core build step
|
|
391
391
|
- chore(bld): factor out linux config
|
|
392
|
-
- chore(bld): factor out macos config
|
|
393
392
|
- chore(bld): factor out windows config
|
|
394
393
|
- chore(bld): factor out native addon
|
|
395
394
|
- chore(bld): factor out compressing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nw-builder",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NW.js",
|
|
@@ -47,33 +47,34 @@
|
|
|
47
47
|
"test": "vitest run --coverage",
|
|
48
48
|
"test:cov": "vitest --coverage.enabled true",
|
|
49
49
|
"demo:bld": "node ./tests/fixtures/demo.js",
|
|
50
|
-
"demo:exe": "./tests/fixtures/out/nwapp.app/Contents/MacOS/nwapp"
|
|
50
|
+
"demo:exe": "./tests/fixtures/out/nwapp.app/Contents/MacOS/nwapp",
|
|
51
|
+
"demo:cli": "nwbuild --mode run ./src ./app/**"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@eslint/js": "^9.
|
|
54
|
-
"@vitest/coverage-v8": "^2.
|
|
54
|
+
"@eslint/js": "^9.11.1",
|
|
55
|
+
"@vitest/coverage-v8": "^2.1.1",
|
|
55
56
|
"base-volta-off-of-nwjs": "^1.0.5",
|
|
56
|
-
"eslint": "^9.
|
|
57
|
-
"eslint-plugin-jsdoc": "^50.
|
|
58
|
-
"globals": "^15.
|
|
59
|
-
"nw": "^0.
|
|
60
|
-
"selenium-webdriver": "^4.
|
|
57
|
+
"eslint": "^9.11.1",
|
|
58
|
+
"eslint-plugin-jsdoc": "^50.3.1",
|
|
59
|
+
"globals": "^15.10.0",
|
|
60
|
+
"nw": "^0.92.0",
|
|
61
|
+
"selenium-webdriver": "^4.25.0",
|
|
61
62
|
"vitest": "^2.0.4"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
65
|
"archiver": "^7.0.1",
|
|
65
|
-
"axios": "^1.7.
|
|
66
|
+
"axios": "^1.7.7",
|
|
67
|
+
"commander": "^12.1.0",
|
|
66
68
|
"glob": "^11.0.0",
|
|
67
69
|
"node-gyp": "^10.2.0",
|
|
68
70
|
"plist": "^3.1.0",
|
|
69
71
|
"resedit": "^2.0.2",
|
|
70
72
|
"semver": "^7.6.3",
|
|
71
73
|
"tar": "^7.4.3",
|
|
72
|
-
"yargs": "^17.7.2",
|
|
73
74
|
"yauzl-promise": "^4.0.0"
|
|
74
75
|
},
|
|
75
76
|
"volta": {
|
|
76
|
-
"node": "22.
|
|
77
|
+
"node": "22.7.0",
|
|
77
78
|
"npm": "10.8.2"
|
|
78
79
|
}
|
|
79
80
|
}
|
package/src/bld/osx.js
CHANGED
|
@@ -5,6 +5,23 @@ import process from 'node:process';
|
|
|
5
5
|
|
|
6
6
|
import plist from 'plist';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Function to update Helper App Plist Files
|
|
10
|
+
* @param {string} plistPath - Path to Helper App Plist File
|
|
11
|
+
* @param {string} helperName - Helper App Name
|
|
12
|
+
* @param {string} helperId - Helper App ID
|
|
13
|
+
* @param {string} appCFBundleIdentifier - options.app.CFBundleIdentifier
|
|
14
|
+
*/
|
|
15
|
+
async function updateHelperPlist (plistPath, helperName, helperId, appCFBundleIdentifier) {
|
|
16
|
+
const plistFullPath = path.resolve(plistPath, 'Contents/Info.plist');
|
|
17
|
+
const plistJson = plist.parse(await fs.promises.readFile(plistFullPath, 'utf-8'));
|
|
18
|
+
plistJson.CFBundleDisplayName = helperName;
|
|
19
|
+
plistJson.CFBundleName = helperName;
|
|
20
|
+
plistJson.CFBundleExecutable = helperName;
|
|
21
|
+
plistJson.CFBundleIdentifier = `${appCFBundleIdentifier}.${helperId}`;
|
|
22
|
+
await fs.promises.writeFile(plistFullPath, plist.build(plistJson));
|
|
23
|
+
}
|
|
24
|
+
|
|
8
25
|
/**
|
|
9
26
|
*
|
|
10
27
|
* @param {object} options - Options.
|
|
@@ -40,111 +57,6 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
|
40
57
|
*/
|
|
41
58
|
const outApp = path.resolve(outDir, `${app.name}.app`);
|
|
42
59
|
|
|
43
|
-
const nwjsHelperAlertsAppPath = path.resolve(
|
|
44
|
-
outApp,
|
|
45
|
-
'Contents',
|
|
46
|
-
'Frameworks',
|
|
47
|
-
'nwjs Framework.framework',
|
|
48
|
-
'Versions',
|
|
49
|
-
chromiumVersion,
|
|
50
|
-
'Helpers',
|
|
51
|
-
'nwjs Helper (Alerts).app',
|
|
52
|
-
);
|
|
53
|
-
const HelperAlertsAppPath = path.resolve(
|
|
54
|
-
outApp,
|
|
55
|
-
'Contents',
|
|
56
|
-
'Frameworks',
|
|
57
|
-
'nwjs Framework.framework',
|
|
58
|
-
'Versions',
|
|
59
|
-
chromiumVersion,
|
|
60
|
-
'Helpers',
|
|
61
|
-
`${app.name} Helper (Alerts).app`,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const nwjsHelperGpuAppPath = path.resolve(
|
|
65
|
-
outApp,
|
|
66
|
-
'Contents',
|
|
67
|
-
'Frameworks',
|
|
68
|
-
'nwjs Framework.framework',
|
|
69
|
-
'Versions',
|
|
70
|
-
chromiumVersion,
|
|
71
|
-
'Helpers',
|
|
72
|
-
'nwjs Helper (GPU).app',
|
|
73
|
-
);
|
|
74
|
-
const HelperGpuAppPath = path.resolve(
|
|
75
|
-
outApp,
|
|
76
|
-
'Contents',
|
|
77
|
-
'Frameworks',
|
|
78
|
-
'nwjs Framework.framework',
|
|
79
|
-
'Versions',
|
|
80
|
-
chromiumVersion,
|
|
81
|
-
'Helpers',
|
|
82
|
-
`${app.name} Helper (GPU).app`,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const nwjsHelperPluginAppPath = path.resolve(
|
|
86
|
-
outApp,
|
|
87
|
-
'Contents',
|
|
88
|
-
'Frameworks',
|
|
89
|
-
'nwjs Framework.framework',
|
|
90
|
-
'Versions',
|
|
91
|
-
chromiumVersion,
|
|
92
|
-
'Helpers',
|
|
93
|
-
'nwjs Helper (Plugin).app',
|
|
94
|
-
);
|
|
95
|
-
const HelperPluginAppPath = path.resolve(
|
|
96
|
-
outApp,
|
|
97
|
-
'Contents',
|
|
98
|
-
'Frameworks',
|
|
99
|
-
'nwjs Framework.framework',
|
|
100
|
-
'Versions',
|
|
101
|
-
chromiumVersion,
|
|
102
|
-
'Helpers',
|
|
103
|
-
`${app.name} Helper (Plugin).app`,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const nwjsHelperRendererAppPath = path.resolve(
|
|
107
|
-
outApp,
|
|
108
|
-
'Contents',
|
|
109
|
-
'Frameworks',
|
|
110
|
-
'nwjs Framework.framework',
|
|
111
|
-
'Versions',
|
|
112
|
-
chromiumVersion,
|
|
113
|
-
'Helpers',
|
|
114
|
-
'nwjs Helper (Renderer).app',
|
|
115
|
-
);
|
|
116
|
-
const HelperRendererAppPath = path.resolve(
|
|
117
|
-
outApp,
|
|
118
|
-
'Contents',
|
|
119
|
-
'Frameworks',
|
|
120
|
-
'nwjs Framework.framework',
|
|
121
|
-
'Versions',
|
|
122
|
-
chromiumVersion,
|
|
123
|
-
'Helpers',
|
|
124
|
-
`${app.name} Helper (Renderer).app`,
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
const nwjsHelperAppPath = path.resolve(
|
|
128
|
-
outApp,
|
|
129
|
-
'Contents',
|
|
130
|
-
'Frameworks',
|
|
131
|
-
'nwjs Framework.framework',
|
|
132
|
-
'Versions',
|
|
133
|
-
chromiumVersion,
|
|
134
|
-
'Helpers',
|
|
135
|
-
'nwjs Helper.app',
|
|
136
|
-
);
|
|
137
|
-
const HelperAppPath = path.resolve(
|
|
138
|
-
outApp,
|
|
139
|
-
'Contents',
|
|
140
|
-
'Frameworks',
|
|
141
|
-
'nwjs Framework.framework',
|
|
142
|
-
'Versions',
|
|
143
|
-
chromiumVersion,
|
|
144
|
-
'Helpers',
|
|
145
|
-
`${app.name} Helper.app`,
|
|
146
|
-
);
|
|
147
|
-
|
|
148
60
|
/* Rename `nwjs.app` to `${app.name}.app` */
|
|
149
61
|
await fs.promises.rename(nwjsApp, outApp);
|
|
150
62
|
|
|
@@ -154,65 +66,40 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
|
154
66
|
path.resolve(outApp, 'Contents', 'MacOS', app.name),
|
|
155
67
|
);
|
|
156
68
|
|
|
157
|
-
/* Rename Helper
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
/* Rename `${app.name} Helper (GPU)/Contents/MacOS/nwjs Helper (GPU)` to `${app.name} Helper (GPU)/Contents/MacOS/${app.name} Helper (GPU)` */
|
|
194
|
-
await fs.promises.rename(
|
|
195
|
-
path.resolve(HelperGpuAppPath, 'Contents', 'MacOS', 'nwjs Helper (GPU)'),
|
|
196
|
-
path.resolve(HelperGpuAppPath, 'Contents', 'MacOS', `${app.name} Helper (GPU)`),
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
/* Rename `${app.name} Helper (Plugin)/Contents/MacOS/nwjs Helper (Plugin)` to `${app.name} Helper (Plugin)/Contents/MacOS/${app.name} Helper (Plugin)` */
|
|
200
|
-
await fs.promises.rename(
|
|
201
|
-
path.resolve(HelperPluginAppPath, 'Contents', 'MacOS', 'nwjs Helper (Plugin)'),
|
|
202
|
-
path.resolve(HelperPluginAppPath, 'Contents', 'MacOS', `${app.name} Helper (Plugin)`),
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
/* Rename `${app.name} Helper (Renderer)/Contents/MacOS/nwjs Helper (Renderer)` to `${app.name} Helper (Renderer)/Contents/MacOS/${app.name} Helper (Renderer)` */
|
|
206
|
-
await fs.promises.rename(
|
|
207
|
-
path.resolve(HelperRendererAppPath, 'Contents', 'MacOS', 'nwjs Helper (Renderer)'),
|
|
208
|
-
path.resolve(HelperRendererAppPath, 'Contents', 'MacOS', `${app.name} Helper (Renderer)`),
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
/* Rename `${app.name} Helper/Contents/MacOS/nwjs Helper` to `${app.name} Helper/Contents/MacOS/${app.name} Helper` */
|
|
212
|
-
await fs.promises.rename(
|
|
213
|
-
path.resolve(HelperAppPath, 'Contents', 'MacOS', 'nwjs Helper'),
|
|
214
|
-
path.resolve(HelperAppPath, 'Contents', 'MacOS', `${app.name} Helper`),
|
|
215
|
-
);
|
|
69
|
+
/* Rename all Helper apps */
|
|
70
|
+
const helperBaseDir = path.resolve(
|
|
71
|
+
outApp,
|
|
72
|
+
'Contents/Frameworks/nwjs Framework.framework/Versions',
|
|
73
|
+
chromiumVersion,
|
|
74
|
+
'Helpers/'
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const helperApps = [
|
|
78
|
+
{ name: 'nwjs Helper (Alerts).app', id: 'helper.alert' },
|
|
79
|
+
{ name: 'nwjs Helper (GPU).app', id: 'helper.gpu' },
|
|
80
|
+
{ name: 'nwjs Helper (Plugin).app', id: 'helper.plugin' },
|
|
81
|
+
{ name: 'nwjs Helper (Renderer).app', id: 'helper.renderer' },
|
|
82
|
+
{ name: 'nwjs Helper.app', id: 'helper' },
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
for (const helperApp of helperApps) {
|
|
86
|
+
const newHelperAppName = helperApp.name.replace(/^nwjs/, app.name);
|
|
87
|
+
const oldPath = path.resolve(helperBaseDir, helperApp.name);
|
|
88
|
+
const newPath = path.resolve(helperBaseDir, newHelperAppName);
|
|
89
|
+
|
|
90
|
+
// Rename Helper base directory
|
|
91
|
+
await fs.promises.rename(oldPath, newPath);
|
|
92
|
+
|
|
93
|
+
// Rename Helper sub-directory
|
|
94
|
+
const helperBaseName = helperApp.name.replace(/.app$/, '');
|
|
95
|
+
const subPathBase = path.resolve(newPath, 'Contents/MacOS/');
|
|
96
|
+
const oldSubPath = path.resolve(subPathBase, helperBaseName);
|
|
97
|
+
const newSubPath = path.resolve(subPathBase, helperBaseName.replace(/^nwjs/, app.name));
|
|
98
|
+
await fs.promises.rename(oldSubPath, newSubPath);
|
|
99
|
+
|
|
100
|
+
// Update Helper Plist file
|
|
101
|
+
await updateHelperPlist(newPath, newHelperAppName.replace(/.app$/, ''), helperApp.id, app.CFBundleIdentifier);
|
|
102
|
+
}
|
|
216
103
|
|
|
217
104
|
/* Replace default icon with user defined icon if specified. */
|
|
218
105
|
if (app.icon !== undefined) {
|
|
@@ -226,7 +113,7 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
|
226
113
|
* Path to `nwjs.app/Contents/Info.plist`
|
|
227
114
|
* @type {string}
|
|
228
115
|
*/
|
|
229
|
-
const
|
|
116
|
+
const contentsInfoPlistPath = path.resolve(
|
|
230
117
|
outApp,
|
|
231
118
|
'Contents',
|
|
232
119
|
'Info.plist'
|
|
@@ -236,7 +123,7 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
|
236
123
|
* Path to `nwjs.app/Contents/Resources/en.lproj/InfoPlist.settings`
|
|
237
124
|
* @type {string}
|
|
238
125
|
*/
|
|
239
|
-
const
|
|
126
|
+
const contentsResourcesEnLprojInfoPlistStringsPath = path.resolve(
|
|
240
127
|
outApp,
|
|
241
128
|
'Contents',
|
|
242
129
|
'Resources',
|
|
@@ -248,144 +135,40 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
|
248
135
|
* JSON from `nwjs.app/Contents/Info.plist`
|
|
249
136
|
* @type {object}
|
|
250
137
|
*/
|
|
251
|
-
const
|
|
252
|
-
await fs.promises.readFile(
|
|
253
|
-
ContentsInfoPlistPath,
|
|
254
|
-
'utf-8'
|
|
255
|
-
)
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* JSON from `${app.name} Helper.app (Alerts)/Contents/Info.plist`
|
|
260
|
-
* @type {object}
|
|
261
|
-
*/
|
|
262
|
-
const HelperAlertsAppJson = plist.parse(
|
|
263
|
-
await fs.promises.readFile(
|
|
264
|
-
path.resolve(
|
|
265
|
-
HelperAlertsAppPath,
|
|
266
|
-
'Contents',
|
|
267
|
-
'Info.plist'
|
|
268
|
-
),
|
|
269
|
-
'utf-8'
|
|
270
|
-
)
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* JSON from `${app.name} Helper (GPU).app/Contents/Info.plist`
|
|
275
|
-
* @type {object}
|
|
276
|
-
*/
|
|
277
|
-
const HelperGpuAppJson = plist.parse(
|
|
278
|
-
await fs.promises.readFile(
|
|
279
|
-
path.resolve(
|
|
280
|
-
HelperGpuAppPath,
|
|
281
|
-
'Contents',
|
|
282
|
-
'Info.plist'
|
|
283
|
-
),
|
|
284
|
-
'utf-8'
|
|
285
|
-
)
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* JSON from `${app.name} Helper (Plugin).app/Contents/Info.plist`
|
|
290
|
-
* @type {object}
|
|
291
|
-
*/
|
|
292
|
-
const HelperPluginAppJson = plist.parse(
|
|
293
|
-
await fs.promises.readFile(
|
|
294
|
-
path.resolve(
|
|
295
|
-
HelperPluginAppPath,
|
|
296
|
-
'Contents',
|
|
297
|
-
'Info.plist'
|
|
298
|
-
),
|
|
299
|
-
'utf-8'
|
|
300
|
-
)
|
|
301
|
-
);
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* JSON from `${app.name} Helper (Renderer).app/Contents/Info.plist`
|
|
305
|
-
* @type {object}
|
|
306
|
-
*/
|
|
307
|
-
const HelperRendererAppJson = plist.parse(
|
|
308
|
-
await fs.promises.readFile(
|
|
309
|
-
path.resolve(
|
|
310
|
-
HelperRendererAppPath,
|
|
311
|
-
'Contents',
|
|
312
|
-
'Info.plist'
|
|
313
|
-
),
|
|
314
|
-
'utf-8'
|
|
315
|
-
)
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* JSON from `${app.name} Helper.app/Contents/Info.plist`
|
|
320
|
-
* @type {object}
|
|
321
|
-
*/
|
|
322
|
-
const HelperAppJson = plist.parse(
|
|
138
|
+
const contentsInfoPlistJson = plist.parse(
|
|
323
139
|
await fs.promises.readFile(
|
|
324
|
-
|
|
325
|
-
HelperAppPath,
|
|
326
|
-
'Contents',
|
|
327
|
-
'Info.plist'
|
|
328
|
-
),
|
|
140
|
+
contentsInfoPlistPath,
|
|
329
141
|
'utf-8'
|
|
330
142
|
)
|
|
331
143
|
);
|
|
332
144
|
|
|
333
145
|
/* Update Plist with user defined values. */
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
146
|
+
contentsInfoPlistJson.LSApplicationCategoryType = app.LSApplicationCategoryType;
|
|
147
|
+
contentsInfoPlistJson.CFBundleIdentifier = app.CFBundleIdentifier;
|
|
148
|
+
contentsInfoPlistJson.CFBundleName = app.CFBundleName;
|
|
149
|
+
contentsInfoPlistJson.CFBundleDisplayName = app.CFBundleDisplayName;
|
|
150
|
+
contentsInfoPlistJson.CFBundleSpokenName = app.CFBundleSpokenName;
|
|
151
|
+
contentsInfoPlistJson.CFBundleVersion = app.CFBundleVersion;
|
|
152
|
+
contentsInfoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString;
|
|
153
|
+
contentsInfoPlistJson.CFBundleExecutable = app.name;
|
|
154
|
+
contentsInfoPlistJson.NSLocalNetworkUsageDescription = app.NSLocalNetworkUsageDescription;
|
|
342
155
|
|
|
343
156
|
/* Remove properties that were not updated by the user. */
|
|
344
|
-
Object.keys(
|
|
345
|
-
if (
|
|
346
|
-
delete
|
|
157
|
+
Object.keys(contentsInfoPlistJson).forEach((option) => {
|
|
158
|
+
if (contentsInfoPlistJson[option] === undefined) {
|
|
159
|
+
delete contentsInfoPlistJson[option];
|
|
347
160
|
}
|
|
348
161
|
});
|
|
349
162
|
|
|
350
|
-
/* Update Helper (Alerts) app's Plist values. */
|
|
351
|
-
HelperAlertsAppJson.CFBundleDisplayName = `${app.name} Helper (Alerts)`;
|
|
352
|
-
HelperAlertsAppJson.CFBundleName = `${app.name} Helper (Alerts)`;
|
|
353
|
-
HelperAlertsAppJson.CFBundleExecutable = `${app.name} Helper (Alerts)`;
|
|
354
|
-
HelperAlertsAppJson.CFBundleIdentifier = `${app.CFBundleIdentifier}.helper.alert`;
|
|
355
|
-
|
|
356
|
-
/* Update Helper (GPU) app's Plist values. */
|
|
357
|
-
HelperGpuAppJson.CFBundleDisplayName = `${app.name} Helper (GPU)`;
|
|
358
|
-
HelperGpuAppJson.CFBundleName = `${app.name} Helper (GPU)`;
|
|
359
|
-
HelperGpuAppJson.CFBundleExecutable = `${app.name} Helper (GPU)`;
|
|
360
|
-
HelperGpuAppJson.CFBundleIdentifier = `${app.CFBundleIdentifier}.helper.gpu`;
|
|
361
|
-
|
|
362
|
-
/* Update Helper (Plugin) app's Plist values. */
|
|
363
|
-
HelperPluginAppJson.CFBundleDisplayName = `${app.name} Helper (Plugin)`;
|
|
364
|
-
HelperPluginAppJson.CFBundleName = `${app.name} Helper (Plugin)`;
|
|
365
|
-
HelperPluginAppJson.CFBundleExecutable = `${app.name} Helper (Plugin)`;
|
|
366
|
-
HelperPluginAppJson.CFBundleIdentifier = `${app.CFBundleIdentifier}.helper.plugin`;
|
|
367
|
-
|
|
368
|
-
/* Update Helper (Renderer) app's Plist values. */
|
|
369
|
-
HelperRendererAppJson.CFBundleDisplayName = `${app.name} Helper (Renderer)`;
|
|
370
|
-
HelperRendererAppJson.CFBundleName = `${app.name} Helper (Renderer)`;
|
|
371
|
-
HelperRendererAppJson.CFBundleExecutable = `${app.name} Helper (Renderer)`;
|
|
372
|
-
HelperRendererAppJson.CFBundleIdentifier = `${app.CFBundleIdentifier}.helper.renderer`;
|
|
373
|
-
|
|
374
|
-
/* Update Helper app's Plist values. */
|
|
375
|
-
HelperAppJson.CFBundleDisplayName = `${app.name} Helper`;
|
|
376
|
-
HelperAppJson.CFBundleName = `${app.name} Helper`;
|
|
377
|
-
HelperAppJson.CFBundleExecutable = `${app.name} Helper`;
|
|
378
|
-
HelperAppJson.CFBundleIdentifier = `${app.CFBundleIdentifier}.helper`;
|
|
379
|
-
|
|
380
163
|
/**
|
|
381
164
|
* Data from `nwjs.app/Contents/Resources/en.lproj/InfoPlist.settings`
|
|
382
165
|
* @type {string[]}
|
|
383
166
|
*/
|
|
384
|
-
const
|
|
385
|
-
|
|
167
|
+
const contentsResourcesEnLprojInfoPlistStringsArray = (await fs.promises.readFile(
|
|
168
|
+
contentsResourcesEnLprojInfoPlistStringsPath,
|
|
386
169
|
'utf-8',
|
|
387
170
|
)).split('\n');
|
|
388
|
-
|
|
171
|
+
contentsResourcesEnLprojInfoPlistStringsArray.forEach((line, idx, arr) => {
|
|
389
172
|
if (line.includes('NSHumanReadableCopyright')) {
|
|
390
173
|
arr[idx] =
|
|
391
174
|
`NSHumanReadableCopyright = "${app.NSHumanReadableCopyright}";`;
|
|
@@ -394,32 +177,13 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
|
|
|
394
177
|
|
|
395
178
|
/* Write the updated values to their config files. */
|
|
396
179
|
await fs.promises.writeFile(
|
|
397
|
-
|
|
398
|
-
plist.build(
|
|
399
|
-
await fs.promises.writeFile(
|
|
400
|
-
ContentsResourcesEnLprojInfoPlistStringsPath,
|
|
401
|
-
ContentsResourcesEnLprojInfoPlistStringsArray.toString().replace(/,/g, '\n'),
|
|
402
|
-
);
|
|
180
|
+
contentsInfoPlistPath,
|
|
181
|
+
plist.build(contentsInfoPlistJson));
|
|
403
182
|
await fs.promises.writeFile(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
);
|
|
407
|
-
await fs.promises.writeFile(
|
|
408
|
-
path.resolve(HelperGpuAppPath, 'Contents', 'Info.plist'),
|
|
409
|
-
plist.build(HelperGpuAppJson)
|
|
410
|
-
);
|
|
411
|
-
await fs.promises.writeFile(
|
|
412
|
-
path.resolve(HelperPluginAppPath, 'Contents', 'Info.plist'),
|
|
413
|
-
plist.build(HelperPluginAppJson)
|
|
414
|
-
);
|
|
415
|
-
await fs.promises.writeFile(
|
|
416
|
-
path.resolve(HelperRendererAppPath, 'Contents', 'Info.plist'),
|
|
417
|
-
plist.build(HelperRendererAppJson)
|
|
418
|
-
);
|
|
419
|
-
await fs.promises.writeFile(
|
|
420
|
-
path.resolve(HelperAppPath, 'Contents', 'Info.plist'),
|
|
421
|
-
plist.build(HelperAppJson)
|
|
183
|
+
contentsResourcesEnLprojInfoPlistStringsPath,
|
|
184
|
+
contentsResourcesEnLprojInfoPlistStringsArray.toString().replace(/,/g, '\n'),
|
|
422
185
|
);
|
|
186
|
+
|
|
423
187
|
} catch (error) {
|
|
424
188
|
console.error(error);
|
|
425
189
|
}
|
package/src/bld.js
CHANGED
|
@@ -44,17 +44,18 @@ import setOsxConfig from './bld/osx.js';
|
|
|
44
44
|
/**
|
|
45
45
|
* References:
|
|
46
46
|
* https://developer.apple.com/documentation/bundleresources/information_property_list
|
|
47
|
-
* @typedef {object} OsxRc
|
|
48
|
-
* @property {string} name
|
|
49
|
-
* @property {string} icon
|
|
50
|
-
* @property {string} LSApplicationCategoryType
|
|
51
|
-
* @property {string} CFBundleIdentifier
|
|
52
|
-
* @property {string} CFBundleName
|
|
53
|
-
* @property {string} CFBundleDisplayName
|
|
54
|
-
* @property {string} CFBundleSpokenName
|
|
55
|
-
* @property {string} CFBundleVersion
|
|
56
|
-
* @property {string} CFBundleShortVersionString
|
|
57
|
-
* @property {string} NSHumanReadableCopyright
|
|
47
|
+
* @typedef {object} OsxRc OSX resource configuration options
|
|
48
|
+
* @property {string} name The name of the application
|
|
49
|
+
* @property {string} icon The path to the icon file. It should be a .icns file.
|
|
50
|
+
* @property {string} LSApplicationCategoryType The category that best describes your app for the App Store.
|
|
51
|
+
* @property {string} CFBundleIdentifier A unique identifier for a bundle usually in reverse DNS format.
|
|
52
|
+
* @property {string} CFBundleName A user-visible short name for the bundle.
|
|
53
|
+
* @property {string} CFBundleDisplayName The user-visible name for the bundle.
|
|
54
|
+
* @property {string} CFBundleSpokenName A replacement for the app name in text-to-speech operations.
|
|
55
|
+
* @property {string} CFBundleVersion The version of the build that identifies an iteration of the bundle.
|
|
56
|
+
* @property {string} CFBundleShortVersionString The release or version number of the bundle.
|
|
57
|
+
* @property {string} NSHumanReadableCopyright A human-readable copyright notice for the bundle.
|
|
58
|
+
* @property {string} NSLocalNetworkUsageDescription A human-readable description of why the application needs access to the local network.
|
|
58
59
|
*/
|
|
59
60
|
|
|
60
61
|
/**
|
package/src/cli.js
CHANGED
|
@@ -1,95 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import yargs from 'yargs/yargs';
|
|
6
|
-
import * as yargs_helpers from 'yargs/helpers';
|
|
3
|
+
import { program } from 'commander';
|
|
7
4
|
|
|
8
5
|
import nwbuild from './index.js';
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
.
|
|
12
|
-
.
|
|
13
|
-
.option('
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.option('
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.option('
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.option('
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
choices: ['linux', 'osx', 'win']
|
|
31
|
-
})
|
|
32
|
-
.option('arch', {
|
|
33
|
-
type: 'string',
|
|
34
|
-
description: 'NW.js supported architecture',
|
|
35
|
-
choices: ['ia32', 'x64', 'arm64']
|
|
36
|
-
})
|
|
37
|
-
.option('downloadUrl', {
|
|
38
|
-
type: 'string',
|
|
39
|
-
description: 'NW.js download server',
|
|
40
|
-
})
|
|
41
|
-
.option('manifestUrl', {
|
|
42
|
-
type: 'string',
|
|
43
|
-
description: 'NW.js version info',
|
|
44
|
-
})
|
|
45
|
-
.option('cacheDir', {
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Cache NW.js binaries',
|
|
48
|
-
})
|
|
49
|
-
.option('outDir', {
|
|
50
|
-
type: 'string',
|
|
51
|
-
description: 'NW.js build artifacts',
|
|
52
|
-
})
|
|
53
|
-
.option('app', {
|
|
54
|
-
type: 'object',
|
|
55
|
-
description: 'Platform specific app metadata. Refer to docs for more info',
|
|
56
|
-
})
|
|
57
|
-
.option('cache', {
|
|
58
|
-
type: 'boolean',
|
|
59
|
-
description: 'Flag to enable/disable caching',
|
|
60
|
-
})
|
|
61
|
-
.option('ffmpeg', {
|
|
62
|
-
type: 'boolean',
|
|
63
|
-
description: 'Flag to enable/disable downloading community ffmpeg',
|
|
64
|
-
})
|
|
65
|
-
.option('glob', {
|
|
66
|
-
type: 'boolean',
|
|
67
|
-
description: 'Flag to enable/disable globbing',
|
|
68
|
-
})
|
|
69
|
-
.option('logLevel', {
|
|
70
|
-
type: 'string',
|
|
71
|
-
description: 'Specify log level',
|
|
72
|
-
choices: ['error', 'warn', 'info', 'debug']
|
|
73
|
-
})
|
|
74
|
-
.option('zip', {
|
|
75
|
-
type: 'string',
|
|
76
|
-
description: 'Flag to enable/disable compression',
|
|
77
|
-
choices: ['zip', 'tar', 'tgz']
|
|
78
|
-
})
|
|
79
|
-
.option('managedManifest', {
|
|
80
|
-
type: 'string',
|
|
81
|
-
description: 'Managed manifest mode',
|
|
82
|
-
})
|
|
83
|
-
.option('nodeAddon', {
|
|
84
|
-
type: 'string',
|
|
85
|
-
description: 'Download NW.js Node headers',
|
|
86
|
-
choices: [false, 'gyp']
|
|
87
|
-
})
|
|
88
|
-
.strictOptions()
|
|
89
|
-
.parse();
|
|
7
|
+
program
|
|
8
|
+
.option('--mode', 'get, run or build mode')
|
|
9
|
+
.option('--version', 'NW.js version')
|
|
10
|
+
.option('--flavor', 'NW.js build flavor')
|
|
11
|
+
.option('--platform', 'NW.js supported platform')
|
|
12
|
+
.option('--arch', 'NW.js supported architecture')
|
|
13
|
+
.option('--downloadUrl', 'NW.js download server')
|
|
14
|
+
.option('--manifestUrl', 'NW.js version info')
|
|
15
|
+
.option('--cacheDir', 'Cache NW.js binaries')
|
|
16
|
+
.option('--outDir', 'NW.js build artifacts')
|
|
17
|
+
.option('--app', 'Platform specific app metadata. Refer to docs for more info')
|
|
18
|
+
.option('--cache', 'Flag to enable/disable caching')
|
|
19
|
+
.option('--ffmpeg', 'Flag to enable/disable downloading community ffmpeg')
|
|
20
|
+
.option('--glob', 'Flag to enable/disable globbing')
|
|
21
|
+
.option('--logLevel', 'Specify log level')
|
|
22
|
+
.option('--zip', 'Flag to enable/disable compression')
|
|
23
|
+
.option('--managedManifest', 'Managed manifest mode')
|
|
24
|
+
.option('--nodeAddon', 'Download NW.js Node headers');
|
|
25
|
+
|
|
26
|
+
program.parse();
|
|
90
27
|
|
|
91
28
|
nwbuild({
|
|
92
|
-
...
|
|
93
|
-
srcDir:
|
|
29
|
+
...program.opts(),
|
|
30
|
+
srcDir: program.args.join(' '),
|
|
94
31
|
cli: true,
|
|
95
32
|
});
|
package/src/index.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface Options<P extends SupportedPlatform = SupportedPlatform> {
|
|
|
39
39
|
glob?: boolean,
|
|
40
40
|
/** Specified log level. */
|
|
41
41
|
logLevel?: "error" | "warn" | "info" | "debug",
|
|
42
|
+
/** Managed manifest */
|
|
43
|
+
managedManifest?: boolean | string | object,
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
/** Platform-specific application options */
|
|
@@ -167,6 +169,8 @@ export interface OsxAppOptions {
|
|
|
167
169
|
CFBundleShortVersionString?: string,
|
|
168
170
|
/** A human-readable copyright notice for the bundle. */
|
|
169
171
|
NSHumanReadableCopyright?: string,
|
|
172
|
+
/** A human-readable description of why the application needs access to the local network. */
|
|
173
|
+
NSLocalNetworkUsageDescription?: string,
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
/**
|
package/src/util.js
CHANGED
|
@@ -263,6 +263,8 @@ export const parse = async (options, pkg) => {
|
|
|
263
263
|
options.app.CFBundleShortVersionString ?? pkg.version;
|
|
264
264
|
options.app.NSHumanReadableCopyright =
|
|
265
265
|
options.app.NSHumanReadableCopyright ?? undefined;
|
|
266
|
+
options.app.NSLocalNetworkUsageDescription =
|
|
267
|
+
options.app.NSLocalNetworkUsageDescription ?? undefined;
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
return { ...options };
|