From 1a33a3453f5c53f23fddaa453e79300ee4f30fdf Mon Sep 17 00:00:00 2001 From: develar Date: Wed, 15 Feb 2017 18:24:35 +0100 Subject: [PATCH] feat(mac): The extra entries for `Info.plist` --- docs/Options.md | 1 + packages/electron-builder/package.json | 1 + packages/electron-builder/src/options/macOptions.ts | 5 +++++ packages/electron-builder/src/packager/mac.ts | 5 +++++ test/out/mac/__snapshots__/macPackagerTest.js.snap | 1 + test/src/mac/macPackagerTest.ts | 3 +++ 6 files changed, 16 insertions(+) diff --git a/docs/Options.md b/docs/Options.md index efbe744222b..71575d5dad1 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -158,6 +158,7 @@ On Windows works only if [nsis.perMachine](https://github.com/electron-userland/ | bundleVersion | The `CFBundleVersion`. Do not use it unless [you need to](see (https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643)). | helperBundleId | The bundle identifier to use in the application helper's plist. Defaults to `${appBundleIdentifier}.helper`. | type | Whether to sign app for development or for distribution. One of `development`, `distribution`. Defaults to `distribution`. +| extendInfo | The extra entries for `Info.plist`. ### `mas` MAS (Mac Application Store) Specific Options diff --git a/packages/electron-builder/package.json b/packages/electron-builder/package.json index e1c8eaae838..f6397914288 100644 --- a/packages/electron-builder/package.json +++ b/packages/electron-builder/package.json @@ -7,6 +7,7 @@ "out", "templates", "vendor", + "scheme.json", "certs/root_certs.keychain" ], "bin": { diff --git a/packages/electron-builder/src/options/macOptions.ts b/packages/electron-builder/src/options/macOptions.ts index f1b321576bb..8b7f43bf7ad 100644 --- a/packages/electron-builder/src/options/macOptions.ts +++ b/packages/electron-builder/src/options/macOptions.ts @@ -60,6 +60,11 @@ export interface MacOptions extends PlatformSpecificBuildOptions { Whether to sign app for development or for distribution. One of `development`, `distribution`. Defaults to `distribution`. */ readonly type?: "distribution" | "development" | null + + /** + The extra entries for `Info.plist`. + */ + readonly extendInfo?: any } /** diff --git a/packages/electron-builder/src/packager/mac.ts b/packages/electron-builder/src/packager/mac.ts index 97f93212f03..ecbb9323674 100644 --- a/packages/electron-builder/src/packager/mac.ts +++ b/packages/electron-builder/src/packager/mac.ts @@ -49,6 +49,11 @@ export async function createApp(packager: PlatformPackager, appOutDir: stri Object.assign(appPlist, parsePlist(fileContents[4])) } + const macOptions = buildMetadata.mac + if (macOptions != null && macOptions.extendInfo != null) { + Object.assign(appPlist, macOptions.extendInfo) + } + const appBundleIdentifier = filterCFBundleIdentifier(appInfo.id) const oldHelperBundleId = (buildMetadata)["helper-bundle-id"] diff --git a/test/out/mac/__snapshots__/macPackagerTest.js.snap b/test/out/mac/__snapshots__/macPackagerTest.js.snap index 3c9482af394..aafba95e51d 100644 --- a/test/out/mac/__snapshots__/macPackagerTest.js.snap +++ b/test/out/mac/__snapshots__/macPackagerTest.js.snap @@ -34,6 +34,7 @@ Object { "DTXcodeBuild": "8C1002", "LSApplicationCategoryType": "your.app.category.type", "LSMinimumSystemVersion": "10.9.0", + "LSUIElement": true, "NSHighResolutionCapable": true, "NSMainNibFile": "MainMenu", "NSPrincipalClass": "AtomApplication", diff --git a/test/src/mac/macPackagerTest.ts b/test/src/mac/macPackagerTest.ts index 54e1780940f..d2ad11efd36 100644 --- a/test/src/mac/macPackagerTest.ts +++ b/test/src/mac/macPackagerTest.ts @@ -16,6 +16,9 @@ test.ifMac("one-package", app({ url: "https://develar.s3.amazonaws.com/test/${os}/${arch}", }, mac: { + extendInfo: { + LSUIElement: true, + }, fileAssociations: [ { ext: "foo",