Repository: nwutils/nw-builder (JavaScript)

Issue:
New mac-specific option needed: `NSLocalNetworkUsageDescription`
### Issue Type

- [ ] Bug Report
- [x] Feature Request
- [ ] Other

### Current/Missing Behaviour

macOS 15 now requires `NSLocalNetworkUsageDescription` in the `Info.plist` to enable local networking, so we need to be able to specify it.

### Expected/Proposed Behaviour

When passed to `app` for a macOS build, the `NSLocalNetworkUsageDescription` key is added to `Info.plist` like the other keys.

### Additional Info

- Package version: latest
- Operating System: macOS 15
- Node version: latest
- NW.js version: latest
- ...



Discussion: https://developer.apple.com/documentation/bundleresources/information_property_list/nslocalnetworkusagedescription
@beaugunderson Looks like it is supported since MacOS 11. Are you open to creating a pull request?
There's a FAQ here as well: https://developer.apple.com/forums/thread/663858
Very open! I'll do that now. :)
Done!



Fix (patch):
diff --git a/README.md b/README.md
index 7324dfc8..e824474d 100644
--- a/README.md
+++ b/README.md
@@ -286,6 +286,7 @@ This object defines additional properties used for building for a specific platf
 | CFBundleVersion | `string` | The version of the build that identifies an iteration of the bundle. |
 | CFBundleShortVersionString | `string` | The release or version number of the bundle. |
 | NSHumanReadableCopyright | `string` | A human-readable copyright notice for the bundle. |
+| NSLocalNetworkUsageDescription | `string` | A human-readable description of why the application needs access to the local network. |
 
 
 ## Guides
diff --git a/src/bld.js b/src/bld.js
index 073ec84c..d2895854 100644
--- a/src/bld.js
+++ b/src/bld.js
@@ -44,17 +44,18 @@ import setOsxConfig from './bld/osx.js';
 /**
  * References:
  * https://developer.apple.com/documentation/bundleresources/information_property_list
- * @typedef  {object} OsxRc                       OSX resource configuration options
- * @property {string} name                        The name of the application
- * @property {string} icon                        The path to the icon file. It should be a .icns file.
- * @property {string} LSApplicationCategoryType   The category that best describes your app for the App Store.
- * @property {string} CFBundleIdentifier          A unique identifier for a bundle usually in reverse DNS format.
- * @property {string} CFBundleName                A user-visible short name for the bundle.
- * @property {string} CFBundleDisplayName         The user-visible name for the bundle.
- * @property {string} CFBundleSpokenName          A replacement for the app name in text-to-speech operations.
- * @property {string} CFBundleVersion             The version of the build that identifies an iteration of the bundle.
- * @property {string} CFBundleShortVersionString  The release or version number of the bundle.
- * @property {string} NSHumanReadableCopyright    A human-readable copyright notice for the bundle.
+ * @typedef  {object} OsxRc                           OSX resource configuration options
+ * @property {string} name                            The name of the application
+ * @property {string} icon                            The path to the icon file. It should be a .icns file.
+ * @property {string} LSApplicationCategoryType       The category that best describes your app for the App Store.
+ * @property {string} CFBundleIdentifier              A unique identifier for a bundle usually in reverse DNS format.
+ * @property {string} CFBundleName                    A user-visible short name for the bundle.
+ * @property {string} CFBundleDisplayName             The user-visible name for the bundle.
+ * @property {string} CFBundleSpokenName              A replacement for the app name in text-to-speech operations.
+ * @property {string} CFBundleVersion                 The version of the build that identifies an iteration of the bundle.
+ * @property {string} CFBundleShortVersionString      The release or version number of the bundle.
+ * @property {string} NSHumanReadableCopyright        A human-readable copyright notice for the bundle.
+ * @property {string} NSLocalNetworkUsageDescription  A human-readable description of why the application needs access to the local network.
  */
 
 /**
diff --git a/src/bld/osx.js b/src/bld/osx.js
index 1601adb6..41f01c7f 100644
--- a/src/bld/osx.js
+++ b/src/bld/osx.js
@@ -151,6 +151,7 @@ export default async function setOsxConfig({ app, outDir, releaseInfo }) {
     contentsInfoPlistJson.CFBundleVersion = app.CFBundleVersion;
     contentsInfoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString;
     contentsInfoPlistJson.CFBundleExecutable = app.name;
+    contentsInfoPlistJson.NSLocalNetworkUsageDescription = app.NSLocalNetworkUsageDescription;
 
     /* Remove properties that were not updated by the user. */
     Object.keys(contentsInfoPlistJson).forEach((option) => {
diff --git a/src/index.d.ts b/src/index.d.ts
index febf704e..05a23304 100644
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -167,6 +167,8 @@ export interface OsxAppOptions {
     CFBundleShortVersionString?: string,
     /** A human-readable copyright notice for the bundle. */
     NSHumanReadableCopyright?: string,
+    /** A human-readable description of why the application needs access to the local network. */
+    NSLocalNetworkUsageDescription?: string,
 }
 
 /**
diff --git a/src/util.js b/src/util.js
index 259b2b98..e8a8319e 100644
--- a/src/util.js
+++ b/src/util.js
@@ -263,6 +263,8 @@ export const parse = async (options, pkg) => {
       options.app.CFBundleShortVersionString ?? pkg.version;
     options.app.NSHumanReadableCopyright =
       options.app.NSHumanReadableCopyright ?? undefined;
+    options.app.NSLocalNetworkUsageDescription =
+      options.app.NSLocalNetworkUsageDescription ?? undefined;
   }
 
   return { ...options };