nw-builder 4.2.4 → 4.2.6
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/package.json +1 -1
- package/src/bld/build.js +9 -11
- package/src/bld/osxCfg.js +7 -7
- package/src/bld/winCfg.js +1 -1
- package/src/index.js +0 -1
- package/src/util/parse.js +1 -0
package/package.json
CHANGED
package/src/bld/build.js
CHANGED
|
@@ -11,14 +11,13 @@ import { setWinConfig } from "./winCfg.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* Generate NW build artifacts
|
|
13
13
|
*
|
|
14
|
-
* @param {string | string[]} files
|
|
15
|
-
* @param {string} nwDir
|
|
16
|
-
* @param {string} outDir
|
|
17
|
-
* @param {"linux" | "osx" | "win"} platform
|
|
18
|
-
* @param {"zip" | boolean} zip
|
|
19
|
-
* @param {object}
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {string} nwPkg NW.js manifest file
|
|
14
|
+
* @param {string | string[]} files Array of NW app files
|
|
15
|
+
* @param {string} nwDir Directory to hold NW binaries
|
|
16
|
+
* @param {string} outDir Directory to store build artifacts
|
|
17
|
+
* @param {"linux" | "osx" | "win"} platform Platform is the operating system type
|
|
18
|
+
* @param {"zip" | boolean} zip Specify if the build artifacts are to be zipped
|
|
19
|
+
* @param {object} app Multi platform configuration options
|
|
20
|
+
* @param {string} nwPkg NW.js manifest file
|
|
22
21
|
* @return {Promise<undefined>}
|
|
23
22
|
*/
|
|
24
23
|
export const build = async (
|
|
@@ -27,14 +26,13 @@ export const build = async (
|
|
|
27
26
|
outDir,
|
|
28
27
|
platform,
|
|
29
28
|
zip,
|
|
30
|
-
releaseInfo,
|
|
31
29
|
app,
|
|
32
30
|
nwPkg
|
|
33
31
|
) => {
|
|
34
32
|
log.debug(`Remove any files at ${outDir} directory`);
|
|
35
33
|
await rm(outDir, { force: true, recursive: true });
|
|
36
34
|
log.debug(`Copy ${nwDir} files to ${outDir} directory`);
|
|
37
|
-
await cp(nwDir, outDir, { recursive: true });
|
|
35
|
+
await cp(nwDir, outDir, { recursive: true, verbatimSymlinks: true });
|
|
38
36
|
|
|
39
37
|
log.debug(`Copy files in srcDir to ${outDir} directory`);
|
|
40
38
|
|
|
@@ -88,7 +86,7 @@ export const build = async (
|
|
|
88
86
|
await setWinConfig(app, outDir);
|
|
89
87
|
break;
|
|
90
88
|
case "osx":
|
|
91
|
-
await setOsxConfig(app, outDir
|
|
89
|
+
await setOsxConfig(app, outDir);
|
|
92
90
|
break;
|
|
93
91
|
default:
|
|
94
92
|
break;
|
package/src/bld/osxCfg.js
CHANGED
|
@@ -9,18 +9,18 @@ import { log } from "../log.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* OSX specific configuration steps
|
|
11
11
|
*
|
|
12
|
-
* @param {object}
|
|
12
|
+
* @param {object} app Resource configuration options for MacOS
|
|
13
13
|
* @param {string} outDir The directory to hold build artifacts
|
|
14
14
|
* @return {Promise<undefined>}
|
|
15
15
|
*/
|
|
16
|
-
const setOsxConfig = async (
|
|
16
|
+
const setOsxConfig = async (app, outDir) => {
|
|
17
17
|
if (platform === "win32") {
|
|
18
18
|
log.warn(
|
|
19
19
|
"MacOS apps built on Windows platform do not preserve all file permissions. See #716"
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
try {
|
|
23
|
-
const outApp = path.resolve(outDir, `${
|
|
23
|
+
const outApp = path.resolve(outDir, `${app.name}.app`);
|
|
24
24
|
await fs.rename(path.resolve(outDir, "nwjs.app"), outApp);
|
|
25
25
|
|
|
26
26
|
// Rename CFBundleDisplayName in Contents/Info.plist
|
|
@@ -28,7 +28,7 @@ const setOsxConfig = async (pkg, outDir) => {
|
|
|
28
28
|
const contentsInfoPlistJson = plist.parse(
|
|
29
29
|
await fs.readFile(contentsInfoPlistPath, "utf-8")
|
|
30
30
|
);
|
|
31
|
-
contentsInfoPlistJson.CFBundleDisplayName =
|
|
31
|
+
contentsInfoPlistJson.CFBundleDisplayName = app.name;
|
|
32
32
|
const contentsInfoPlist = plist.build(contentsInfoPlistJson);
|
|
33
33
|
await fs.writeFile(contentsInfoPlistPath, contentsInfoPlist);
|
|
34
34
|
|
|
@@ -43,14 +43,14 @@ const setOsxConfig = async (pkg, outDir) => {
|
|
|
43
43
|
);
|
|
44
44
|
const newPlistStrings = contentsInfoPlistStrings.replace(
|
|
45
45
|
/CFBundleGetInfoString = "nwjs /,
|
|
46
|
-
`CFBundleGetInfoString = "${
|
|
46
|
+
`CFBundleGetInfoString = "${app.name} `
|
|
47
47
|
);
|
|
48
48
|
await fs.writeFile(contentsInfoPlistStringsPath, newPlistStrings);
|
|
49
49
|
|
|
50
50
|
// Add product_string property to package.json
|
|
51
51
|
// const packageJsonPath = path.resolve(outApp, "Contents/Resources/app.nw/package.json");
|
|
52
|
-
//
|
|
53
|
-
// await fs.writeFile(packageJsonPath, JSON.stringify(
|
|
52
|
+
// app.product_string = app.name;
|
|
53
|
+
// await fs.writeFile(packageJsonPath, JSON.stringify(app, null, 4));
|
|
54
54
|
} catch (error) {
|
|
55
55
|
log.error(error);
|
|
56
56
|
}
|
package/src/bld/winCfg.js
CHANGED
|
@@ -64,7 +64,7 @@ const setWinConfig = async (app, outDir) => {
|
|
|
64
64
|
});
|
|
65
65
|
} catch (error) {
|
|
66
66
|
log.warn(
|
|
67
|
-
"Renaming EXE failed or unable to modify EXE. If it's the latter, ensure WINE is installed or build
|
|
67
|
+
"Renaming EXE failed or unable to modify EXE. If it's the latter, ensure WINE is installed or build your application Windows platform"
|
|
68
68
|
);
|
|
69
69
|
log.error(error);
|
|
70
70
|
}
|
package/src/index.js
CHANGED
package/src/util/parse.js
CHANGED