Skip to content

Commit 22737b2

Browse files
authoredMay 20, 2024··
feat(mac): support macos signature additionalArguments parameter (#8218)
1 parent 0885236 commit 22737b2

File tree

8 files changed

+65
-3
lines changed

8 files changed

+65
-3
lines changed
 

‎.changeset/four-taxis-doubt.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": minor
3+
---
4+
5+
feat(mac): support macos signature `additionalArguments` parameter

‎docs/configuration/configuration.md

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ Env file `electron-builder.env` in the current dir ([example](https://github.com
147147
<li><code id="Configuration-launchUiVersion">launchUiVersion</code> Boolean | String | “undefined” - <em>libui-based frameworks only</em> The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.</li>
148148
<li><code id="Configuration-framework">framework</code> String | “undefined” - The framework name. One of <code>electron</code>, <code>proton</code>, <code>libui</code>. Defaults to <code>electron</code>.</li>
149149
<li><code id="Configuration-beforePack">beforePack</code> module:app-builder-lib/out/configuration.__type | String | “undefined” - The function (or path to file or module id) to be <a href="#beforepack">run before pack</a></li>
150+
<li><code id="Configuration-afterExtract">afterExtract</code> module:app-builder-lib/out/configuration.__type | String | “undefined” - The function (or path to file or module id) to be <a href="#afterextract">run after the prebuilt Electron binary has been extracted to the output directory</a></li>
150151
</ul>
151152
<hr>
152153
<ul>

‎docs/configuration/mac.md

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ The top-level [mac](configuration.md#Configuration-mac) key contains set of opti
110110
<p>This option has no effect unless building for “universal” arch and applies only if <code>mergeASARs</code> is <code>true</code>.</p>
111111
</li>
112112
<li>
113+
<p><code id="MacConfiguration-additionalArguments">additionalArguments</code> Array&lt;String&gt; | “undefined” - Array of strings specifying additional arguments to pass to the <code>codesign</code> command used to sign a specific file.</p>
114+
<p>Some subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file. Usage Example: <code>['--deep']</code></p>
115+
</li>
116+
<li>
113117
<p><code id="MacConfiguration-notarize">notarize</code> <a href="#NotarizeLegacyOptions">NotarizeLegacyOptions</a> | <a href="#NotarizeNotaryOptions">NotarizeNotaryOptions</a> | Boolean | “undefined” - Options to use for @electron/notarize (ref: <a href="https://github.com/electron/notarize">https://github.com/electron/notarize</a>). Use <code>false</code> to explicitly disable</p>
114118
<p>Note: In order to activate the notarization step You MUST specify one of the following via environment variables: 1. <code>APPLE_API_KEY</code>, <code>APPLE_API_KEY_ID</code> and <code>APPLE_API_ISSUER</code>. 2. <code>APPLE_ID</code>, <code>APPLE_APP_SPECIFIC_PASSWORD</code>, and <code>APPLE_TEAM_ID</code> 3. <code>APPLE_KEYCHAIN</code> and <code>APPLE_KEYCHAIN_PROFILE</code></p>
115119
<p>For security reasons it is recommended to use the first option (see <a href="https://github.com/electron-userland/electron-builder/issues/7859">https://github.com/electron-userland/electron-builder/issues/7859</a>)</p>

‎packages/app-builder-lib/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"dependencies": {
4949
"@develar/schema-utils": "~2.6.5",
5050
"@electron/notarize": "2.3.0",
51-
"@electron/osx-sign": "1.0.5",
51+
"@electron/osx-sign": "1.3.0",
5252
"@electron/rebuild": "3.6.0",
5353
"@electron/universal": "2.0.1",
5454
"@malept/flatpak-bundler": "^0.4.0",

‎packages/app-builder-lib/scheme.json

+28
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,20 @@
21252125
"MacConfiguration": {
21262126
"additionalProperties": false,
21272127
"properties": {
2128+
"additionalArguments": {
2129+
"anyOf": [
2130+
{
2131+
"items": {
2132+
"type": "string"
2133+
},
2134+
"type": "array"
2135+
},
2136+
{
2137+
"type": "null"
2138+
}
2139+
],
2140+
"description": "Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.\n\nSome subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file.\nUsage Example: `['--deep']`"
2141+
},
21282142
"appId": {
21292143
"default": "com.electron.${name}",
21302144
"description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.",
@@ -2744,6 +2758,20 @@
27442758
"MasConfiguration": {
27452759
"additionalProperties": false,
27462760
"properties": {
2761+
"additionalArguments": {
2762+
"anyOf": [
2763+
{
2764+
"items": {
2765+
"type": "string"
2766+
},
2767+
"type": "array"
2768+
},
2769+
{
2770+
"type": "null"
2771+
}
2772+
],
2773+
"description": "Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.\n\nSome subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file.\nUsage Example: `['--deep']`"
2774+
},
27472775
"appId": {
27482776
"default": "com.electron.${name}",
27492777
"description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.",

‎packages/app-builder-lib/src/macPackager.ts

+1
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ export class MacPackager extends PlatformPackager<MacConfiguration> {
378378
hardenedRuntime: hardenedRuntime ?? undefined,
379379
timestamp: customSignOptions.timestamp || undefined,
380380
requirements: requirements || undefined,
381+
additionalArguments: customSignOptions.additionalArguments || [],
381382
}
382383
log.debug({ file: log.filePath(filePath), ...args }, "selecting signing options")
383384
return args

‎packages/app-builder-lib/src/options/macOptions.ts

+8
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
212212
*/
213213
readonly x64ArchFiles?: string | null
214214

215+
/**
216+
* Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.
217+
*
218+
* Some subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file.
219+
* Usage Example: `['--deep']`
220+
*/
221+
readonly additionalArguments?: Array<string> | null
222+
215223
/**
216224
* Options to use for @electron/notarize (ref: https://github.com/electron/notarize).
217225
* Use `false` to explicitly disable

‎pnpm-lock.yaml

+17-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.