electron builder.Interface.MacConfiguration
Electron-Builder / electron-builder / MacConfiguration
继承¶
扩展自¶
属性¶
additionalArguments?¶
readonlyoptionaladditionalArguments:null|string[]
指定传递给 codesign 命令以签名特定文件的额外参数的字符串数组。
您可能包含在 Electron 应用程序中的某些子资源可能需要使用 --deep 进行签名,但这通常不安全,不应应用于整个 Electron 应用程序,而应仅应用于您的文件。用法示例:['--deep']
appId?¶
readonlyoptionalappId:null|string
应用程序 ID。用作 macOS 的 CFBundleIdentifier 和 Windows 的 应用程序用户模型 ID(仅限 NSIS 目标,不支持 Squirrel.Windows)。强烈建议设置显式 ID。
默认¶
com.electron.${name}
继承自¶
PlatformSpecificBuildOptions.appId
artifactName?¶
readonlyoptionalartifactName:null|string
工件文件名模板。默认为 ${productName}-${version}.${ext}(某些目标可能具有其他默认值,请参阅相应的选项)。
继承自¶
PlatformSpecificBuildOptions.artifactName
asar?¶
readonlyoptionalasar:null|boolean|AsarOptions
是否使用 Electron 的归档格式 将应用程序的源代码打包到归档文件中。
必须解包的 Node 模块将自动检测,您无需显式设置 asarUnpack - 如果这不起作用,请提交问题。
默认¶
true
继承自¶
PlatformSpecificBuildOptions.asar
asarUnpack?¶
readonlyoptionalasarUnpack:null|string|string[]
相对于 应用程序目录 的 glob 模式,指定在创建 asar 归档文件时要解包的文件。
继承自¶
PlatformSpecificBuildOptions.asarUnpack
binaries?¶
readonlyoptionalbinaries:null|string[]
任何需要签名的额外二进制文件的路径。
bundleShortVersion?¶
readonlyoptionalbundleShortVersion:null|string
CFBundleShortVersionString。除非您需要,否则请勿使用它。
bundleVersion?¶
readonlyoptionalbundleVersion:null|string
CFBundleVersion。除非 您需要,否则请勿使用它。
category?¶
readonlyoptionalcategory:null|string
应用程序类别类型,如在 Finder 中通过查看 -> 按应用程序类别排列查看“应用程序”目录时显示。
例如,"category": "public.app-category.developer-tools" 会将应用程序类别设置为开发者工具。
有效值列在 Apple 的文档中。
compression?¶
readonlyoptionalcompression:null|CompressionLevel
压缩级别。如果您想快速测试构建,store 可以显着减少构建时间。maximum 不会导致明显的尺寸差异,但会增加构建时间。
默认¶
normal
继承自¶
PlatformSpecificBuildOptions.compression
cscKeyPassword?¶
optionalcscKeyPassword:null|string
继承自¶
PlatformSpecificBuildOptions.cscKeyPassword
cscLink?¶
optionalcscLink:null|string
继承自¶
PlatformSpecificBuildOptions.cscLink
darkModeSupport?¶
readonlyoptionaldarkModeSupport:boolean
是否支持深色模式。如果您的应用程序具有深色模式,您可以使您的应用程序遵循系统范围的深色模式设置。
默认¶
false
defaultArch?¶
readonlyoptionaldefaultArch:string
继承自¶
PlatformSpecificBuildOptions.defaultArch
detectUpdateChannel?¶
readonlyoptionaldetectUpdateChannel:boolean
是否从应用程序版本预发布组件推断更新频道。例如,如果版本为 0.12.1-alpha.1,频道将设置为 alpha。否则设置为 latest。这不适用于 github 发布,它将 永远不会自动检测更新频道。
默认¶
true
继承自¶
PlatformSpecificBuildOptions.detectUpdateChannel
disableDefaultIgnoredFiles?¶
optionaldisableDefaultIgnoredFiles:null|boolean
是否排除所有默认忽略的文件(https://builder.electron.js.cn/contents#files)和选项。默认为 false。
默认¶
false
继承自¶
PlatformSpecificBuildOptions.disableDefaultIgnoredFiles
electronLanguages?¶
readonlyoptionalelectronLanguages:string|string[]
要保留的 Electron 语言环境。默认情况下,所有 Electron 语言环境都按原样使用。
继承自¶
PlatformSpecificBuildOptions.electronLanguages
electronUpdaterCompatibility?¶
readonlyoptionalelectronUpdaterCompatibility:null|string
electron-updater 兼容性 semver 范围。
继承自¶
PlatformSpecificBuildOptions.electronUpdaterCompatibility
entitlements?¶
readonlyoptionalentitlements:null|string
用于签署应用程序的授权文件的路径。如果存在,将使用 build/entitlements.mac.plist(这是推荐的设置方式)。MAS 授权在 mas 中指定。有关示例,请参阅 osx-sign 仓库中的此文件夹。请注意,如果未设置正确的授权,您的应用程序可能会崩溃,例如在带有 Electron 20+ 的 arm64 构建上,com.apple.security.cs.allow-jit。有关更多信息,请参阅 Electron 文档中的签署和公证 macOS 构建。
entitlementsInherit?¶
readonlyoptionalentitlementsInherit:null|string
子授权的路径,这些授权继承用于签署发行版的框架和捆绑包的安全设置。如果存在,将使用 build/entitlements.mac.inherit.plist(这是推荐的设置方式)。有关示例,请参阅 osx-sign 仓库中的此文件夹。
此选项仅在提供 entitlements 进行签名时适用。
entitlementsLoginHelper?¶
readonlyoptionalentitlementsLoginHelper:null|string
登录助手授权文件的路径。当使用 App Sandbox 时,通常位于继承的授权中的 com.apple.security.inherit 密钥无法继承,因为登录助手是独立的exe文件。默认为为 entitlements 提供的值。此选项仅在提供 entitlements 进行签名时适用。
executableName?¶
readonlyoptionalexecutableName:null|string
可执行文件名。默认为 productName。
继承自¶
PlatformSpecificBuildOptions.executableName
extendInfo?¶
readonlyoptionalextendInfo:any
Info.plist 的额外条目。
extraDistFiles?¶
readonlyoptionalextraDistFiles:null|string|string[]
要放入归档文件中的额外文件。不适用于 tar.*。
extraFiles?¶
optionalextraFiles:null|string|FileSet| (string|FileSet)[]
与 extraResources 相同,但复制到应用程序的内容目录(macOS 为 Contents,Linux 和 Windows 为根目录)。
继承自¶
PlatformSpecificBuildOptions.extraFiles
extraResources?¶
optionalextraResources:null|string|FileSet| (string|FileSet)[]
相对于项目目录的 glob 模式,指定后,将匹配的文件或目录直接复制到应用程序的 resources 目录中(macOS 为 Contents/Resources,Linux 和 Windows 为 resources)。
文件模式(以及对 from 和 to 字段的支持)与 files 相同。
继承自¶
PlatformSpecificBuildOptions.extraResources
fileAssociations?¶
readonlyoptionalfileAssociations:FileAssociation|FileAssociation[]
文件关联。
继承自¶
PlatformSpecificBuildOptions.fileAssociations
files?¶
optionalfiles:null|string|FileSet| (string|FileSet)[]
相对于 应用程序目录 的 glob 模式,指定在复制文件以创建包时要包含哪些文件。
默认为
[
"**/*",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
"!.editorconfig",
"!**/._*",
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
"!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
"!**/{appveyor.yml,.travis.yml,circle.yml}",
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
]
在任何情况下都不会复制开发依赖项。您无需显式忽略它。默认情况下不忽略隐藏文件,但默认情况下会忽略所有应忽略的文件。
如果您的某些模式不是忽略模式(即不是以 ! 开头),则默认模式 **/* 不会添加到您的自定义模式中。在任何情况下,package.json 和 **/node_modules/**/*(仅复制生产依赖项)都会添加到您的自定义模式中。所有默认忽略项都会在任何情况下添加 - 如果您配置自己的模式,则无需重复它。
可以在平台选项(例如 mac 中)中指定。
您还可以通过使用 FileSet 对象而不是简单的 glob 模式来指定自定义源目录和目标目录。
[
{
"from": "path/to/source",
"to": "path/to/destination",
"filter": ["**/*", "!foo/*.js"]
}
]
您可以在 from 和 to 字段中使用 文件宏。from 和 to 可以是文件,您可以使用它在打包时 重命名 文件。
继承自¶
PlatformSpecificBuildOptions.files
forceCodeSigning?¶
readonlyoptionalforceCodeSigning:boolean
如果应用程序未进行代码签名,是否失败。
继承自¶
PlatformSpecificBuildOptions.forceCodeSigning
gatekeeperAssess?¶
readonlyoptionalgatekeeperAssess:boolean
是否让 @electron/osx-sign 验证签名。
默认¶
false
generateUpdatesFilesForAllChannels?¶
readonlyoptionalgenerateUpdatesFilesForAllChannels:boolean
请参阅 使用频道构建和发布。
默认¶
false
继承自¶
PlatformSpecificBuildOptions.generateUpdatesFilesForAllChannels
hardenedRuntime?¶
readonlyoptionalhardenedRuntime:boolean
您的应用程序是否必须使用硬化运行时签名。
默认¶
true
helperBundleId?¶
readonlyoptionalhelperBundleId:null|string
要在应用程序助手的 plist 中使用的捆绑包标识符。
默认¶
${appBundleIdentifier}.helper
helperEHBundleId?¶
readonlyoptionalhelperEHBundleId:null|string
要在 EH 助手的 plist 中使用的捆绑包标识符。
默认¶
${appBundleIdentifier}.helper.EH
helperGPUBundleId?¶
readonlyoptionalhelperGPUBundleId:null|string
要在 GPU 助手的 plist 中使用的捆绑包标识符。
默认¶
${appBundleIdentifier}.helper.GPU
helperNPBundleId?¶
readonlyoptionalhelperNPBundleId:null|string
要在 NP 助手的 plist 中使用的捆绑包标识符。
默认¶
${appBundleIdentifier}.helper.NP
helperPluginBundleId?¶
readonlyoptionalhelperPluginBundleId:null|string
要在 Plugin 助手的 plist 中使用的捆绑包标识符。
默认¶
${appBundleIdentifier}.helper.Plugin
helperRendererBundleId?¶
readonlyoptionalhelperRendererBundleId:null|string
要在 Renderer 助手的 plist 中使用的捆绑包标识符。
默认¶
${appBundleIdentifier}.helper.Renderer
icon?¶
readonlyoptionalicon:null|string
应用程序图标的路径。
默认¶
build/icon.icns
覆盖¶
PlatformSpecificBuildOptions.icon
identity?¶
readonlyoptionalidentity:null|string
签名时要使用的证书名称。考虑使用环境变量 CSC_LINK 或 CSC_NAME 而不是指定此选项。MAS 安装程序标识在 mas 中指定。
mergeASARs?¶
readonlyoptionalmergeASARs:boolean
是否合并不同架构的 ASAR 文件。
除非为“通用”架构构建,否则此选项无效。
默认¶
true
minimumSystemVersion?¶
readonlyoptionalminimumSystemVersion:null|string
应用程序运行所需的最低 macOS 版本。对应于 LSMinimumSystemVersion。
notarize?¶
readonlyoptionalnotarize:boolean
是否禁用 electron-builder 的 @electron/notarize 集成。
注意:为了激活公证步骤,您必须通过环境变量指定以下选项之一
APPLE_API_KEY、APPLE_API_KEY_ID和APPLE_API_ISSUER。APPLE_ID、APPLE_APP_SPECIFIC_PASSWORD和APPLE_TEAM_IDAPPLE_KEYCHAIN和APPLE_KEYCHAIN_PROFILE
出于安全原因,建议使用第一个选项(请参阅 https://github.com/electron-userland/electron-builder/issues/7859)
preAutoEntitlements?¶
readonlyoptionalpreAutoEntitlements:boolean
是否启用来自 @electron/osx-sign 的授权自动化。
默认¶
true
protocols?¶
URL 协议方案。
继承自¶
PlatformSpecificBuildOptions.protocols
provisioningProfile?¶
readonlyoptionalprovisioningProfile:null|string
用于签名时使用的配置文件路径,绝对路径或相对于应用程序根目录的路径。
publish?¶
optionalpublish:Publish
发布者配置。有关更多信息,请参阅 自动更新。
继承自¶
PlatformSpecificBuildOptions.publish
releaseInfo?¶
readonlyoptionalreleaseInfo:ReleaseInfo
发布信息。 适用于命令行用法
-c.releaseInfo.releaseNotes="new features"
继承自¶
PlatformSpecificBuildOptions.releaseInfo
requirements?¶
readonlyoptionalrequirements:null|string
需求文件的路径,用于签名。 不适用于 MAS。
sign?¶
readonlyoptionalsign:null|string|CustomMacSign
用于签署应用程序包的自定义函数(或文件路径或模块 ID)。
signIgnore?¶
readonlyoptionalsignIgnore:null|string|string[]
用于指示跳过签名文件的正则表达式或正则表达式数组。
singleArchFiles?¶
readonlyoptionalsingleArchFiles:null|string
允许存在于其中一个 ASAR 文件中,但不能存在于另一个 ASAR 文件中的路径的 Minimatch 模式。
除非为“通用”架构构建,否则此选项无效,并且仅当 mergeASARs 为 true 时适用。
strictVerify?¶
readonlyoptionalstrictVerify:boolean
是否让 @electron/osx-sign 验证内容。
默认¶
true
target?¶
readonlyoptionaltarget:null|TargetConfiguration|MacOsTargetName| TargetConfiguration | MacOsTargetName[]
目标包类型:default、dmg、mas、mas-dev、pkg、7z、zip、tar.xz、tar.lz、tar.gz、tar.bz2、dir 列表。默认为 default(Squirrel.Mac 为 dmg 和 zip)。注意:Squirrel.Mac 自动更新机制需要同时启用 dmg 和 zip,即使仅使用 dmg 也是如此。禁用 zip 将破坏 dmg 包中的自动更新。
覆盖¶
PlatformSpecificBuildOptions.target
timestamp?¶
readonlyoptionaltimestamp:null|string
指定时间戳授权服务器的 URL
type?¶
readonlyoptionaltype:null|"distribution"|"development"
是否为开发或发行版签署应用程序。
默认¶
distribution
x64ArchFiles?¶
readonlyoptionalx64ArchFiles:null|string
允许在两个 ASAR 文件中都作为 x64 二进制文件的路径的 Minimatch 模式
除非为“通用”架构构建,否则此选项无效,并且仅当 mergeASARs 为 true 时适用。