1 | import { PlatformSpecificBuildOptions, TargetConfiguration, TargetSpecificOptions } from "../index";
|
2 | import { CustomMacSign } from "../macPackager";
|
3 | export type MacOsTargetName = "default" | "dmg" | "mas" | "mas-dev" | "pkg" | "7z" | "zip" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "dir";
|
4 | export interface MacConfiguration extends PlatformSpecificBuildOptions {
|
5 | /**
|
6 | * The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.
|
7 | *
|
8 | * For example, `"category": "public.app-category.developer-tools"` will set the application category to *Developer Tools*.
|
9 | *
|
10 | * Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).
|
11 | */
|
12 | readonly category?: string | null;
|
13 | /**
|
14 | * The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (`dmg` and `zip` for Squirrel.Mac). Note: Squirrel.Mac auto update mechanism requires both `dmg` and `zip` to be enabled, even when only `dmg` is used. Disabling `zip` will break auto update in `dmg` packages.
|
15 | */
|
16 | readonly target?: Array<MacOsTargetName | TargetConfiguration> | MacOsTargetName | TargetConfiguration | null;
|
17 | /**
|
18 | * The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option.
|
19 | * MAS installer identity is specified in the [mas](/configuration/mas).
|
20 | */
|
21 | readonly identity?: string | null;
|
22 | /**
|
23 | * The path to application icon.
|
24 | * @default build/icon.icns
|
25 | */
|
26 | readonly icon?: string | null;
|
27 | /**
|
28 | * The path to entitlements file for signing the app. `build/entitlements.mac.plist` will be used if exists (it is a recommended way to set).
|
29 | * MAS entitlements is specified in the [mas](/configuration/mas).
|
30 | * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.
|
31 | * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.
|
32 | * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.
|
33 | */
|
34 | readonly entitlements?: string | null;
|
35 | /**
|
36 | * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mac.inherit.plist` will be used if exists (it is a recommended way to set).
|
37 | * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.
|
38 | *
|
39 | * This option only applies when signing with `entitlements` provided.
|
40 | */
|
41 | readonly entitlementsInherit?: string | null;
|
42 | /**
|
43 | * Path to login helper entitlement file.
|
44 | * When using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inherited entitlements cannot be inherited since the login helper is a standalone executable.
|
45 | * Defaults to the value provided for `entitlements`. This option only applies when signing with `entitlements` provided.
|
46 | */
|
47 | readonly entitlementsLoginHelper?: string | null;
|
48 | /**
|
49 | * The path to the provisioning profile to use when signing, absolute or relative to the app root.
|
50 | */
|
51 | readonly provisioningProfile?: string | null;
|
52 | /**
|
53 | * The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).
|
54 | */
|
55 | readonly bundleVersion?: string | null;
|
56 | /**
|
57 | * The `CFBundleShortVersionString`. Do not use it unless you need to.
|
58 | */
|
59 | readonly bundleShortVersion?: string | null;
|
60 | /**
|
61 | * Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.
|
62 | * @default false
|
63 | */
|
64 | readonly darkModeSupport?: boolean;
|
65 | /**
|
66 | * The bundle identifier to use in the application helper's plist.
|
67 | * @default ${appBundleIdentifier}.helper
|
68 | */
|
69 | readonly helperBundleId?: string | null;
|
70 | /**
|
71 | * The bundle identifier to use in the Renderer helper's plist.
|
72 | * @default ${appBundleIdentifier}.helper.Renderer
|
73 | */
|
74 | readonly helperRendererBundleId?: string | null;
|
75 | /**
|
76 | * The bundle identifier to use in the Plugin helper's plist.
|
77 | * @default ${appBundleIdentifier}.helper.Plugin
|
78 | */
|
79 | readonly helperPluginBundleId?: string | null;
|
80 | /**
|
81 | * The bundle identifier to use in the GPU helper's plist.
|
82 | * @default ${appBundleIdentifier}.helper.GPU
|
83 | */
|
84 | readonly helperGPUBundleId?: string | null;
|
85 | /**
|
86 | * The bundle identifier to use in the EH helper's plist.
|
87 | * @default ${appBundleIdentifier}.helper.EH
|
88 | */
|
89 | readonly helperEHBundleId?: string | null;
|
90 | /**
|
91 | * The bundle identifier to use in the NP helper's plist.
|
92 | * @default ${appBundleIdentifier}.helper.NP
|
93 | */
|
94 | readonly helperNPBundleId?: string | null;
|
95 | /**
|
96 | * Whether to sign app for development or for distribution.
|
97 | * @default distribution
|
98 | */
|
99 | readonly type?: "distribution" | "development" | null;
|
100 | /**
|
101 | * The extra entries for `Info.plist`.
|
102 | */
|
103 | readonly extendInfo?: any;
|
104 | /**
|
105 | * Paths of any extra binaries that need to be signed.
|
106 | */
|
107 | readonly binaries?: Array<string> | null;
|
108 | /**
|
109 | * The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.
|
110 | */
|
111 | readonly minimumSystemVersion?: string | null;
|
112 | /**
|
113 | * Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.
|
114 | */
|
115 | readonly requirements?: string | null;
|
116 | /** @private */
|
117 | readonly cscInstallerLink?: string | null;
|
118 | /** @private */
|
119 | readonly cscInstallerKeyPassword?: string | null;
|
120 | /**
|
121 | * Extra files to put in archive. Not applicable for `tar.*`.
|
122 | */
|
123 | readonly extraDistFiles?: Array<string> | string | null;
|
124 | /**
|
125 | * Whether your app has to be signed with hardened runtime.
|
126 | * @default true
|
127 | */
|
128 | readonly hardenedRuntime?: boolean;
|
129 | /**
|
130 | * Whether to let `@electron/osx-sign` validate the signing or not.
|
131 | * @default false
|
132 | */
|
133 | readonly gatekeeperAssess?: boolean;
|
134 | /**
|
135 | * Whether to let `@electron/osx-sign` verify the contents or not.
|
136 | * @default true
|
137 | */
|
138 | readonly strictVerify?: boolean;
|
139 | /**
|
140 | * Whether to enable entitlements automation from `@electron/osx-sign`.
|
141 | * @default true
|
142 | */
|
143 | readonly preAutoEntitlements?: boolean;
|
144 | /**
|
145 | * Regex or an array of regex's that signal skipping signing a file.
|
146 | */
|
147 | readonly signIgnore?: Array<string> | string | null;
|
148 | /**
|
149 | * The custom function (or path to file or module id) to sign an app bundle.
|
150 | */
|
151 | readonly sign?: CustomMacSign | string | null;
|
152 | /**
|
153 | * Specify the URL of the timestamp authority server
|
154 | */
|
155 | readonly timestamp?: string | null;
|
156 | /**
|
157 | * Whether to merge ASAR files for different architectures or not.
|
158 | *
|
159 | * This option has no effect unless building for "universal" arch.
|
160 | * @default true
|
161 | */
|
162 | readonly mergeASARs?: boolean;
|
163 | /**
|
164 | * Minimatch pattern of paths that are allowed to be present in one of the
|
165 | * ASAR files, but not in the other.
|
166 | *
|
167 | * This option has no effect unless building for "universal" arch and applies
|
168 | * only if `mergeASARs` is `true`.
|
169 | */
|
170 | readonly singleArchFiles?: string | null;
|
171 | /**
|
172 | * Minimatch pattern of paths that are allowed to be x64 binaries in both
|
173 | * ASAR files
|
174 | *
|
175 | * This option has no effect unless building for "universal" arch and applies
|
176 | * only if `mergeASARs` is `true`.
|
177 | */
|
178 | readonly x64ArchFiles?: string | null;
|
179 | /**
|
180 | * Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.
|
181 | *
|
182 | * 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.
|
183 | * Usage Example: `['--deep']`
|
184 | */
|
185 | readonly additionalArguments?: Array<string> | null;
|
186 | /**
|
187 | * Options to use for @electron/notarize (ref: https://github.com/electron/notarize).
|
188 | * Use `false` to explicitly disable
|
189 | *
|
190 | * Note: In order to activate the notarization step You MUST specify one of the following via environment variables:
|
191 | * 1. `APPLE_API_KEY`, `APPLE_API_KEY_ID` and `APPLE_API_ISSUER`.
|
192 | * 2. `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`
|
193 | * 3. `APPLE_KEYCHAIN` and `APPLE_KEYCHAIN_PROFILE`
|
194 | *
|
195 | * For security reasons it is recommended to use the first option (see https://github.com/electron-userland/electron-builder/issues/7859)
|
196 | */
|
197 | readonly notarize?: NotarizeNotaryOptions | boolean | null;
|
198 | }
|
199 | export interface NotarizeNotaryOptions {
|
200 | /**
|
201 | * The team ID you want to notarize under for when using `notarytool`
|
202 | * @deprecated Set the `APPLE_TEAM_ID` environment variable instead
|
203 | */
|
204 | readonly teamId?: string;
|
205 | }
|
206 | export interface DmgOptions extends TargetSpecificOptions {
|
207 | /**
|
208 | * The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.
|
209 | * If background is not specified, use `window.size`. Default locations expected background size to be 540x380.
|
210 | * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).
|
211 | */
|
212 | background?: string | null;
|
213 | /**
|
214 | * The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.
|
215 | */
|
216 | backgroundColor?: string | null;
|
217 | /**
|
218 | * The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
|
219 | * Defaults to the application icon (`build/icon.icns`).
|
220 | */
|
221 | icon?: string | null;
|
222 | /**
|
223 | * The size of all the icons inside the DMG.
|
224 | * @default 80
|
225 | */
|
226 | readonly iconSize?: number | null;
|
227 | /**
|
228 | * The size of all the icon texts inside the DMG.
|
229 | * @default 12
|
230 | */
|
231 | readonly iconTextSize?: number | null;
|
232 | /**
|
233 | * The title of the produced DMG, which will be shown when mounted (volume name).
|
234 | *
|
235 | * Macro `${productName}`, `${version}` and `${name}` are supported.
|
236 | * @default ${productName} ${version}
|
237 | */
|
238 | readonly title?: string | null;
|
239 | /**
|
240 | * The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account.
|
241 | */
|
242 | contents?: Array<DmgContent>;
|
243 | /**
|
244 | * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).
|
245 | * @default UDZO
|
246 | */
|
247 | format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO";
|
248 | /**
|
249 | * The DMG window position and size. With y co-ordinates running from bottom to top.
|
250 | *
|
251 | * The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `"x": 0, "y": 100000` as the x, y co-ordinates.
|
252 | * It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.
|
253 | */
|
254 | window?: DmgWindow;
|
255 | /**
|
256 | * Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file).
|
257 | * @default false
|
258 | */
|
259 | readonly internetEnabled?: boolean;
|
260 | /**
|
261 | * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.
|
262 | * @default false
|
263 | */
|
264 | readonly sign?: boolean;
|
265 | /**
|
266 | * @private
|
267 | * @default true
|
268 | */
|
269 | writeUpdateInfo?: boolean;
|
270 | }
|
271 | export interface DmgWindow {
|
272 | /**
|
273 | * The X position relative to left of the screen.
|
274 | * @default 400
|
275 | */
|
276 | x?: number;
|
277 | /**
|
278 | * The Y position relative to bottom of the screen.
|
279 | * @default 100
|
280 | */
|
281 | y?: number;
|
282 | /**
|
283 | * The width. Defaults to background image width or 540.
|
284 | */
|
285 | width?: number;
|
286 | /**
|
287 | * The height. Defaults to background image height or 380.
|
288 | */
|
289 | height?: number;
|
290 | }
|
291 | export interface DmgContent {
|
292 | /**
|
293 | * The device-independent pixel offset from the left of the window to the **center** of the icon.
|
294 | */
|
295 | x: number;
|
296 | /**
|
297 | * The device-independent pixel offset from the top of the window to the **center** of the icon.
|
298 | */
|
299 | y: number;
|
300 | type?: "link" | "file" | "dir";
|
301 | /**
|
302 | * The name of the file within the DMG. Defaults to basename of `path`.
|
303 | */
|
304 | name?: string;
|
305 | /**
|
306 | * The path of the file within the DMG.
|
307 | */
|
308 | path?: string;
|
309 | }
|
310 | export interface MasConfiguration extends MacConfiguration {
|
311 | /**
|
312 | * The path to entitlements file for signing the app. `build/entitlements.mas.plist` will be used if exists (it is a recommended way to set).
|
313 | * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.
|
314 | * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.
|
315 | * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.
|
316 | */
|
317 | readonly entitlements?: string | null;
|
318 | /**
|
319 | * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mas.inherit.plist` will be used if exists (it is a recommended way to set).
|
320 | * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.
|
321 | */
|
322 | readonly entitlementsInherit?: string | null;
|
323 | /**
|
324 | * Paths of any extra binaries that need to be signed.
|
325 | */
|
326 | readonly binaries?: Array<string> | null;
|
327 | }
|