From 5864c5b7458a8324abb90134c104e9b7a33dface Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra Date: Sat, 8 Jul 2023 17:08:32 +0530 Subject: [PATCH 1/5] fix: `NSHumanReadableCopyright` `MacOS` property --- src/bld/osxCfg.js | 13 ++++++++++++- test/fixture/demo.js | 6 ++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/bld/osxCfg.js b/src/bld/osxCfg.js index 54aaa9b00..8e92fdd04 100644 --- a/src/bld/osxCfg.js +++ b/src/bld/osxCfg.js @@ -47,6 +47,17 @@ const setOsxConfig = async (app, outDir) => { const infoPlistPath = resolve(outApp, "Contents", "Info.plist"); const infoPlistJson = plist.parse(await readFile(infoPlistPath, "utf-8")); + + const infoPlistStringsPath = resolve(outApp, "Contents", "Resources", "en.lproj", "InfoPlist.strings"); + const infoPlistStringsData = await readFile(infoPlistStringsPath, "utf-8"); + + let infoPlistStringsDataArray = infoPlistStringsData.split("\n"); + + infoPlistStringsDataArray.forEach((line, idx, arr) => { + if (line.includes("NSHumanReadableCopyright")) { + arr[idx] = `NSHumanReadableCopyright = "${app.NSHumanReadableCopyright}";`; + } + }); infoPlistJson.LSApplicationCategoryType = app.LSApplicationCategoryType; infoPlistJson.CFBundleIdentifier = app.CFBundleIdentifier; @@ -55,7 +66,6 @@ const setOsxConfig = async (app, outDir) => { infoPlistJson.CFBundleSpokenName = app.CFBundleSpokenName; infoPlistJson.CFBundleVersion = app.CFBundleVersion; infoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString; - infoPlistJson.NSHumanReadableCopyright = app.NSHumanReadableCopyright; Object.keys(infoPlistJson).forEach((option) => { if (infoPlistJson[option] === undefined) { @@ -64,6 +74,7 @@ const setOsxConfig = async (app, outDir) => { }); await writeFile(infoPlistPath, plist.build(infoPlistJson)); + await writeFile(infoPlistStringsPath, infoPlistStringsDataArray.toString().replace(/,/g, "\n")); } catch (error) { log.error(error); } diff --git a/test/fixture/demo.js b/test/fixture/demo.js index b2c7a1718..719f7f602 100644 --- a/test/fixture/demo.js +++ b/test/fixture/demo.js @@ -5,14 +5,12 @@ await nwbuild({ version: "latest", srcDir: "app", platform: "osx", - arch: "arm64", - downloadUrl: "https://github.com/corwin-of-amber/nw.js/releases/download", - manifestUrl: - "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json", + arch: "x64", outDir: "out", glob: false, app: { name: "demo", icon: "app/icon.icns", + NSHumanReadableCopyright: "Copyright 2023 NW Utils. All Rights Reserved." }, }); From 8ccfddfd92d986b27a67882ac779568017c06090 Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra Date: Sat, 8 Jul 2023 23:21:57 +0530 Subject: [PATCH 2/5] test: update demo --- src/bld/osxCfg.js | 15 ++++----------- test/fixture/demo.js | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/bld/osxCfg.js b/src/bld/osxCfg.js index 8e92fdd04..294b5630f 100644 --- a/src/bld/osxCfg.js +++ b/src/bld/osxCfg.js @@ -47,17 +47,6 @@ const setOsxConfig = async (app, outDir) => { const infoPlistPath = resolve(outApp, "Contents", "Info.plist"); const infoPlistJson = plist.parse(await readFile(infoPlistPath, "utf-8")); - - const infoPlistStringsPath = resolve(outApp, "Contents", "Resources", "en.lproj", "InfoPlist.strings"); - const infoPlistStringsData = await readFile(infoPlistStringsPath, "utf-8"); - - let infoPlistStringsDataArray = infoPlistStringsData.split("\n"); - - infoPlistStringsDataArray.forEach((line, idx, arr) => { - if (line.includes("NSHumanReadableCopyright")) { - arr[idx] = `NSHumanReadableCopyright = "${app.NSHumanReadableCopyright}";`; - } - }); infoPlistJson.LSApplicationCategoryType = app.LSApplicationCategoryType; infoPlistJson.CFBundleIdentifier = app.CFBundleIdentifier; @@ -66,6 +55,10 @@ const setOsxConfig = async (app, outDir) => { infoPlistJson.CFBundleSpokenName = app.CFBundleSpokenName; infoPlistJson.CFBundleVersion = app.CFBundleVersion; infoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString; + infoPlistJson.NSHumanReadableCopyright = app.NSHumanReadableCopyright; + + console.log(infoPlistJson); + process.exit(1); Object.keys(infoPlistJson).forEach((option) => { if (infoPlistJson[option] === undefined) { diff --git a/test/fixture/demo.js b/test/fixture/demo.js index 719f7f602..c4d07a8cf 100644 --- a/test/fixture/demo.js +++ b/test/fixture/demo.js @@ -11,6 +11,6 @@ await nwbuild({ app: { name: "demo", icon: "app/icon.icns", - NSHumanReadableCopyright: "Copyright 2023 NW Utils. All Rights Reserved." + NSHumanReadableCopyright: "Copyright 2023 NW.js Utils. All Rights Reserved." }, }); From 1430ef024f8c7da8b3a8f4581da4e51b176e2158 Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra Date: Sat, 8 Jul 2023 23:27:10 +0530 Subject: [PATCH 3/5] fix: osx build --- src/bld/osxCfg.js | 4 ---- test/fixture/demo.js | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/bld/osxCfg.js b/src/bld/osxCfg.js index 294b5630f..54aaa9b00 100644 --- a/src/bld/osxCfg.js +++ b/src/bld/osxCfg.js @@ -57,9 +57,6 @@ const setOsxConfig = async (app, outDir) => { infoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString; infoPlistJson.NSHumanReadableCopyright = app.NSHumanReadableCopyright; - console.log(infoPlistJson); - process.exit(1); - Object.keys(infoPlistJson).forEach((option) => { if (infoPlistJson[option] === undefined) { delete infoPlistJson[option]; @@ -67,7 +64,6 @@ const setOsxConfig = async (app, outDir) => { }); await writeFile(infoPlistPath, plist.build(infoPlistJson)); - await writeFile(infoPlistStringsPath, infoPlistStringsDataArray.toString().replace(/,/g, "\n")); } catch (error) { log.error(error); } diff --git a/test/fixture/demo.js b/test/fixture/demo.js index c4d07a8cf..33a96c81d 100644 --- a/test/fixture/demo.js +++ b/test/fixture/demo.js @@ -11,6 +11,7 @@ await nwbuild({ app: { name: "demo", icon: "app/icon.icns", - NSHumanReadableCopyright: "Copyright 2023 NW.js Utils. All Rights Reserved." + NSHumanReadableCopyright: + "Copyright 2023 NW.js Utils. All Rights Reserved.", }, }); From 5efa28dfdeb16b1276d02a99ec4e03c49e75f343 Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra Date: Wed, 19 Jul 2023 17:37:31 +0530 Subject: [PATCH 4/5] fix(osx): set `NSHumanReadableCopyright` --- src/bld/osxCfg.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/bld/osxCfg.js b/src/bld/osxCfg.js index 54aaa9b00..f5bba044d 100644 --- a/src/bld/osxCfg.js +++ b/src/bld/osxCfg.js @@ -48,6 +48,26 @@ const setOsxConfig = async (app, outDir) => { const infoPlistPath = resolve(outApp, "Contents", "Info.plist"); const infoPlistJson = plist.parse(await readFile(infoPlistPath, "utf-8")); + const infoPlistStringsPath = resolve( + outApp, + "Contents", + "Resources", + "en.lproj", + "InfoPlist.strings" + ); + const infoPlistStringsData = await readFile(infoPlistStringsPath, "utf-8"); + + let infoPlistStringsDataArray = infoPlistStringsData.split("\n"); + + infoPlistStringsDataArray.forEach((line, idx, arr) => { + if (line.includes("NSHumanReadableCopyright")) { + arr[ + idx + ] = `NSHumanReadableCopyright = "${app.NSHumanReadableCopyright}";`; + console.log(arr); + } + }); + infoPlistJson.LSApplicationCategoryType = app.LSApplicationCategoryType; infoPlistJson.CFBundleIdentifier = app.CFBundleIdentifier; infoPlistJson.CFBundleName = app.CFBundleName; @@ -55,7 +75,6 @@ const setOsxConfig = async (app, outDir) => { infoPlistJson.CFBundleSpokenName = app.CFBundleSpokenName; infoPlistJson.CFBundleVersion = app.CFBundleVersion; infoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString; - infoPlistJson.NSHumanReadableCopyright = app.NSHumanReadableCopyright; Object.keys(infoPlistJson).forEach((option) => { if (infoPlistJson[option] === undefined) { @@ -64,6 +83,10 @@ const setOsxConfig = async (app, outDir) => { }); await writeFile(infoPlistPath, plist.build(infoPlistJson)); + await writeFile( + infoPlistStringsPath, + infoPlistStringsDataArray.toString().replace(/,/g, "\n") + ); } catch (error) { log.error(error); } From a80960a19e3fd02c14a0ea71aebdc5084ba94dc2 Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra Date: Tue, 25 Jul 2023 10:09:58 +0530 Subject: [PATCH 5/5] docs: update changelog --- changelog.md | 10 ++++++++++ package-lock.json | 4 ++-- package.json | 2 +- src/bld/osxCfg.js | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 58700f448..397cc5a16 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [4.3.3] - 2023-07-11 + +## Changed + +- Set `NSHumanReadableCopyright` property in `*.app/Resources/en.lproj/InfoPlist.strings` to update copyright + +## Removed + +- `NSHumanReadableCopyright` from `Info.plist` + ## [4.3.2] - 2023-07-11 ## Added diff --git a/package-lock.json b/package-lock.json index 811d77183..9e17e109a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nw-builder", - "version": "4.3.2", + "version": "4.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nw-builder", - "version": "4.3.2", + "version": "4.3.3", "license": "MIT", "dependencies": { "cli-progress": "^3.12.0", diff --git a/package.json b/package.json index 5d5b9c5fa..d55b5d2e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nw-builder", - "version": "4.3.2", + "version": "4.3.3", "description": "Build NW.js desktop applications for MacOS, Windows and Linux.", "keywords": [ "NW.js", diff --git a/src/bld/osxCfg.js b/src/bld/osxCfg.js index f5bba044d..a4f4b99f8 100644 --- a/src/bld/osxCfg.js +++ b/src/bld/osxCfg.js @@ -64,7 +64,6 @@ const setOsxConfig = async (app, outDir) => { arr[ idx ] = `NSHumanReadableCopyright = "${app.NSHumanReadableCopyright}";`; - console.log(arr); } });