UNPKG

15 kBTypeScriptView Raw
1import { PlatformSpecificBuildOptions, TargetConfiguration, TargetSpecificOptions } from "../index";
2import { CustomMacSign } from "../macPackager";
3export type MacOsTargetName = "default" | "dmg" | "mas" | "mas-dev" | "pkg" | "7z" | "zip" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "dir";
4export 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 * Options to use for @electron/notarize (ref: https://github.com/electron/notarize).
181 * Use `false` to explicitly disable
182 *
183 * Note: In order to activate the notarization step You MUST specify one of the following via environment variables:
184 * 1. `APPLE_API_KEY`, `APPLE_API_KEY_ID` and `APPLE_API_ISSUER`.
185 * 2. `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`
186 * 3. `APPLE_KEYCHAIN` and `APPLE_KEYCHAIN_PROFILE`
187 *
188 * For security reasons it is recommended to use the first option (see https://github.com/electron-userland/electron-builder/issues/7859)
189 */
190 readonly notarize?: NotarizeLegacyOptions | NotarizeNotaryOptions | boolean | null;
191}
192/** @deprecated */
193export interface NotarizeLegacyOptions {
194 /**
195 * The app bundle identifier your Electron app is using. E.g. com.github.electron. Useful if notarization ID differs from app ID (unlikely).
196 * Only used by `legacy` notarization tool
197 */
198 readonly appBundleId?: string | null;
199 /**
200 * Your Team Short Name. Only used by `legacy` notarization tool
201 */
202 readonly ascProvider?: string | null;
203}
204export interface NotarizeNotaryOptions {
205 /**
206 * The team ID you want to notarize under for when using `notarytool`
207 * @deprecated Set the `APPLE_TEAM_ID` environment variable instead
208 */
209 readonly teamId?: string;
210}
211export interface DmgOptions extends TargetSpecificOptions {
212 /**
213 * 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.
214 * If background is not specified, use `window.size`. Default locations expected background size to be 540x380.
215 * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).
216 */
217 background?: string | null;
218 /**
219 * The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.
220 */
221 backgroundColor?: string | null;
222 /**
223 * 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.
224 * Defaults to the application icon (`build/icon.icns`).
225 */
226 icon?: string | null;
227 /**
228 * The size of all the icons inside the DMG.
229 * @default 80
230 */
231 readonly iconSize?: number | null;
232 /**
233 * The size of all the icon texts inside the DMG.
234 * @default 12
235 */
236 readonly iconTextSize?: number | null;
237 /**
238 * The title of the produced DMG, which will be shown when mounted (volume name).
239 *
240 * Macro `${productName}`, `${version}` and `${name}` are supported.
241 * @default ${productName} ${version}
242 */
243 readonly title?: string | null;
244 /**
245 * 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.
246 */
247 contents?: Array<DmgContent>;
248 /**
249 * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).
250 * @default UDZO
251 */
252 format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO";
253 /**
254 * The DMG window position and size. With y co-ordinates running from bottom to top.
255 *
256 * 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.
257 * 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.
258 */
259 window?: DmgWindow;
260 /**
261 * 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).
262 * @default false
263 */
264 readonly internetEnabled?: boolean;
265 /**
266 * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.
267 * @default false
268 */
269 readonly sign?: boolean;
270 /**
271 * @private
272 * @default true
273 */
274 writeUpdateInfo?: boolean;
275}
276export interface DmgWindow {
277 /**
278 * The X position relative to left of the screen.
279 * @default 400
280 */
281 x?: number;
282 /**
283 * The Y position relative to bottom of the screen.
284 * @default 100
285 */
286 y?: number;
287 /**
288 * The width. Defaults to background image width or 540.
289 */
290 width?: number;
291 /**
292 * The height. Defaults to background image height or 380.
293 */
294 height?: number;
295}
296export interface DmgContent {
297 /**
298 * The device-independent pixel offset from the left of the window to the **center** of the icon.
299 */
300 x: number;
301 /**
302 * The device-independent pixel offset from the top of the window to the **center** of the icon.
303 */
304 y: number;
305 type?: "link" | "file" | "dir";
306 /**
307 * The name of the file within the DMG. Defaults to basename of `path`.
308 */
309 name?: string;
310 /**
311 * The path of the file within the DMG.
312 */
313 path?: string;
314}
315export interface MasConfiguration extends MacConfiguration {
316 /**
317 * 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).
318 * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.
319 * 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+.
320 * 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.
321 */
322 readonly entitlements?: string | null;
323 /**
324 * 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).
325 * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.
326 */
327 readonly entitlementsInherit?: string | null;
328 /**
329 * Paths of any extra binaries that need to be signed.
330 */
331 readonly binaries?: Array<string> | null;
332}