跳到内容

app builder lib.Interface.MasConfiguration

Electron-Builder / app-builder-lib / MasConfiguration

继承自

属性

additionalArguments?

readonly optional **additionalArguments**: null | string[]

字符串数组,用于指定传递给 codesign 命令以签名特定文件的附加参数。

您在 Electron 应用中包含的某些子资源可能需要使用 –deep 进行签名,但这通常不安全地应用于整个 Electron 应用,因此应仅应用于您的文件。 用法示例: `['--deep']`

继承自

MacConfiguration.additionalArguments


appId?

readonly optional **appId**: null | string

应用程序 ID。在 MacOS 中用作 CFBundleIdentifier,在 Windows 中用作 应用程序用户模型 ID(仅限 NSIS 目标,不支持 Squirrel.Windows)。强烈建议显式设置 ID。

默认值

com.electron.${name}

继承自

MacConfiguration.appId


artifactName?

readonly optional **artifactName**: null | string

产物文件名模板。默认为 ${productName}-${version}.${ext} (某些目标可能具有其他默认值,请参阅相应的选项)。

继承自

MacConfiguration.artifactName


asar?

readonly optional **asar**: null | boolean | AsarOptions

是否将应用程序的源代码打包到归档文件中,使用 Electron 的归档格式

必须解包的 Node 模块将自动检测到,您无需显式设置 asarUnpack - 如果这不起作用,请提交问题。

默认值

true

继承自

MacConfiguration.asar


asarUnpack?

readonly optional **asarUnpack**: null | string | string[]

相对于 应用目录glob 模式,用于指定在创建 asar 归档文件时要解包的文件。

继承自

MacConfiguration.asarUnpack


binaries?

readonly optional **binaries**: null | string[]

任何需要签名的额外二进制文件的路径。

覆盖

MacConfiguration.binaries


bundleShortVersion?

readonly optional **bundleShortVersion**: null | string

CFBundleShortVersionString。除非您需要,否则请勿使用。

继承自

MacConfiguration.bundleShortVersion


bundleVersion?

readonly optional **bundleVersion**: null | string

CFBundleVersion。除非 您需要,否则请勿使用。

继承自

MacConfiguration.bundleVersion


category?

readonly optional **category**: null | string

应用程序类别类型,如在 Finder 中查看“应用程序”目录时,通过“查看”->“按应用程序类别排列”所显示。

例如,"category": "public.app-category.developer-tools" 将应用程序类别设置为“开发者工具”。

有效值在 Apple 的文档中列出。

继承自

MacConfiguration.category


compression?

readonly optional **compression**: null | CompressionLevel

压缩级别。如果您想快速测试构建,store 可以显著减少构建时间。maximum 不会导致明显的尺寸差异,但会增加构建时间。

默认值

normal

继承自

MacConfiguration.compression


cscKeyPassword?

optional **cscKeyPassword**: null | string

继承自

MacConfiguration.cscKeyPassword


optional **cscLink**: null | string

继承自

MacConfiguration.cscLink


darkModeSupport?

readonly optional **darkModeSupport**: boolean

是否支持黑暗模式。如果您的应用确实具有黑暗模式,您可以使您的应用遵循系统范围的黑暗模式设置。

默认值

false

继承自

MacConfiguration.darkModeSupport


defaultArch?

readonly optional **defaultArch**: string

继承自

MacConfiguration.defaultArch


detectUpdateChannel?

readonly optional **detectUpdateChannel**: boolean

是否从应用程序版本预发布组件推断更新渠道。例如,如果版本为 0.12.1-alpha.1,渠道将设置为 alpha。否则为 latest。这*不*适用于 github 发布,github 发布永远不会 自动检测更新渠道

默认值

true

继承自

MacConfiguration.detectUpdateChannel


disableDefaultIgnoredFiles?

optional **disableDefaultIgnoredFiles**: null | boolean

是否排除所有默认忽略的文件 (https://builder.electron.js.cn/contents#files) 和选项。默认为 false

默认值

false

继承自

MacConfiguration.disableDefaultIgnoredFiles


electronLanguages?

readonly optional **electronLanguages**: string | string[]

要保留的 electron 语言环境。默认情况下,所有 Electron 语言环境都按原样使用。

继承自

MacConfiguration.electronLanguages


electronUpdaterCompatibility?

readonly optional **electronUpdaterCompatibility**: null | string

electron-updater 兼容性 semver 范围。

继承自

MacConfiguration.electronUpdaterCompatibility


entitlements?

readonly optional **entitlements**: null | string

用于签名应用程序的权限文件的路径。如果 build/entitlements.mas.plist 存在,则将使用它(这是推荐的设置方式)。有关示例,请参阅 osx-sign 存储库中的此文件夹。请注意,如果未设置正确的权限,例如在 Electron 20+ 的 arm64 构建上设置 com.apple.security.cs.allow-jit,您的应用程序可能会崩溃。有关更多信息,请参阅 Electron 文档中的签名和公证 macOS 构建

覆盖

MacConfiguration.entitlements


entitlementsInherit?

readonly optional **entitlementsInherit**: null | string

子权限的路径,子权限继承用于对分发的框架和捆绑包进行签名的安全设置。如果 build/entitlements.mas.inherit.plist 存在,则将使用它(这是推荐的设置方式)。有关示例,请参阅 osx-sign 存储库中的此文件夹

覆盖

MacConfiguration.entitlementsInherit


entitlementsLoginHelper?

readonly optional **entitlementsLoginHelper**: null | string

登录助手权限文件的路径。当使用 App Sandbox 时,通常在继承的权限中的 com.apple.security.inherit 密钥无法被继承,因为登录助手是一个独立的执行文件。默认为为 entitlements 提供的值。此选项仅在提供 entitlements 进行签名时适用。

继承自

MacConfiguration.entitlementsLoginHelper


executableName?

readonly optional **executableName**: null | string

可执行文件名。默认为 productName

继承自

MacConfiguration.executableName


extendInfo?

readonly optional **extendInfo**: any

Info.plist 的额外条目。

继承自

MacConfiguration.extendInfo


extraDistFiles?

readonly optional **extraDistFiles**: null | string | string[]

要放入归档文件中的额外文件。不适用于 tar.*

继承自

MacConfiguration.extraDistFiles


extraFiles?

optional **extraFiles**: null | string | FileSet | (string | FileSet)[]

extraResources 相同,但复制到应用程序的内容目录中(MacOS 的 Contents,Linux 和 Windows 的根目录)。

继承自

MacConfiguration.extraFiles


extraResources?

optional **extraResources**: null | string | FileSet | (string | FileSet)[]

相对于项目目录的 glob 模式,指定后,将匹配的文件或目录直接复制到应用程序的资源目录中(MacOS 的 Contents/Resources,Linux 和 Windows 的 resources)。

文件模式(以及对 fromto 字段的支持)与 files 相同。

继承自

MacConfiguration.extraResources


fileAssociations?

readonly optional **fileAssociations**: FileAssociation | FileAssociation[]

文件关联。

继承自

MacConfiguration.fileAssociations


files?

optional **files**: 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"]
}
]

您也可以在 fromto 字段中使用文件宏fromto 可以是文件,您可以使用它在打包时重命名文件。

继承自

MacConfiguration.files


forceCodeSigning?

readonly optional **forceCodeSigning**: boolean

如果应用程序未进行代码签名,是否失败。

继承自

MacConfiguration.forceCodeSigning


gatekeeperAssess?

readonly optional **gatekeeperAssess**: boolean

是否让 @electron/osx-sign 验证签名。

默认值

false

继承自

MacConfiguration.gatekeeperAssess


generateUpdatesFilesForAllChannels?

readonly optional **generateUpdatesFilesForAllChannels**: boolean

请参阅 使用渠道构建和发布

默认值

false

继承自

MacConfiguration.generateUpdatesFilesForAllChannels


hardenedRuntime?

readonly optional **hardenedRuntime**: boolean

您的应用是否必须使用硬化运行时签名。

默认值

true

继承自

MacConfiguration.hardenedRuntime


helperBundleId?

readonly optional **helperBundleId**: null | string

要在应用程序助手的 plist 中使用的捆绑包标识符。

默认值

${appBundleIdentifier}.helper

继承自

MacConfiguration.helperBundleId


helperEHBundleId?

readonly optional **helperEHBundleId**: null | string

要在 EH 助手的 plist 中使用的捆绑包标识符。

默认值

${appBundleIdentifier}.helper.EH

继承自

MacConfiguration.helperEHBundleId


helperGPUBundleId?

readonly optional **helperGPUBundleId**: null | string

要在 GPU 助手的 plist 中使用的捆绑包标识符。

默认值

${appBundleIdentifier}.helper.GPU

继承自

MacConfiguration.helperGPUBundleId


helperNPBundleId?

readonly optional **helperNPBundleId**: null | string

要在 NP 助手的 plist 中使用的捆绑包标识符。

默认值

${appBundleIdentifier}.helper.NP

继承自

MacConfiguration.helperNPBundleId


helperPluginBundleId?

readonly optional **helperPluginBundleId**: null | string

要在插件助手的 plist 中使用的捆绑包标识符。

默认值

${appBundleIdentifier}.helper.Plugin

继承自

MacConfiguration.helperPluginBundleId


helperRendererBundleId?

readonly optional **helperRendererBundleId**: null | string

要在渲染器助手的 plist 中使用的捆绑包标识符。

默认值

${appBundleIdentifier}.helper.Renderer

继承自

MacConfiguration.helperRendererBundleId


icon?

readonly optional **icon**: null | string

应用程序图标的路径。

默认值

build/icon.icns

继承自

MacConfiguration.icon


identity?

readonly optional **identity**: null | string

签名时要使用的证书名称。考虑使用环境变量 CSC_LINK 或 CSC_NAME 而不是指定此选项。MAS 安装程序身份在 mas 中指定。

继承自

MacConfiguration.identity


mergeASARs?

readonly optional **mergeASARs**: boolean

是否合并不同架构的 ASAR 文件。

除非为 “universal” 架构构建,否则此选项无效。

默认值

true

继承自

MacConfiguration.mergeASARs


minimumSystemVersion?

readonly optional **minimumSystemVersion**: null | string

应用程序运行所需的最低 macOS 版本。对应于 LSMinimumSystemVersion

继承自

MacConfiguration.minimumSystemVersion


notarize?

readonly optional **notarize**: boolean

是否禁用 electron-builder 的 @electron/notarize 集成。

注意:为了激活公证步骤,您必须通过环境变量指定以下其中一项

  1. APPLE_API_KEY, APPLE_API_KEY_IDAPPLE_API_ISSUER
  2. APPLE_ID, APPLE_APP_SPECIFIC_PASSWORDAPPLE_TEAM_ID
  3. APPLE_KEYCHAINAPPLE_KEYCHAIN_PROFILE

出于安全原因,建议使用第一个选项(请参阅 https://github.com/electron-userland/electron-builder/issues/7859

继承自

MacConfiguration.notarize


preAutoEntitlements?

readonly optional **preAutoEntitlements**: boolean

是否启用来自 @electron/osx-sign 的权限自动化。

默认值

true

继承自

MacConfiguration.preAutoEntitlements


protocols?

readonly optional **protocols**: Protocol | Protocol[]

URL 协议方案。

继承自

MacConfiguration.protocols


provisioningProfile?

readonly optional **provisioningProfile**: null | string

签名时要使用的配置文件的路径,可以是绝对路径或相对于应用程序根目录的路径。

继承自

MacConfiguration.provisioningProfile


publish?

optional **publish**: Publish

发布者配置。有关更多信息,请参阅 自动更新

继承自

MacConfiguration.publish


releaseInfo?

readonly optional **releaseInfo**: ReleaseInfo

发布信息。旨在用于命令行

-c.releaseInfo.releaseNotes="new features"

继承自

MacConfiguration.releaseInfo


requirements?

readonly optional requirements: null | string

签名中使用的需求文件的路径。不适用于 MAS。

继承自

MacConfiguration.requirements


sign?

readonly optional sign: null | string | CustomMacSign

用于签名应用 bundle 的自定义函数(或文件路径或模块 ID)。

继承自

MacConfiguration.sign


signIgnore?

readonly optional signIgnore: null | string | string[]

用于指示跳过文件签名的正则表达式或正则表达式数组。

继承自

MacConfiguration.signIgnore


singleArchFiles?

readonly optional singleArchFiles: null | string

允许存在于其中一个 ASAR 文件中,但不能存在于另一个 ASAR 文件中的路径的 Minimatch 模式。

除非为 “universal” 架构构建,否则此选项无效,并且仅当 mergeASARstrue 时适用。

继承自

MacConfiguration.singleArchFiles


strictVerify?

readonly optional strictVerify: boolean

是否允许 @electron/osx-sign 验证内容。

默认值

true

继承自

MacConfiguration.strictVerify


target?

readonly optional target: null | TargetConfiguration | MacOsTargetName | TargetConfiguration | MacOsTargetName[]

目标包类型:defaultdmgmasmas-devpkg7zziptar.xztar.lztar.gztar.bz2dir 列表。默认为 default (Squirrel.Mac 为 dmgzip)。注意:Squirrel.Mac 自动更新机制要求同时启用 dmgzip,即使仅使用 dmg。禁用 zip 将破坏 dmg 包中的自动更新。

继承自

MacConfiguration.target


timestamp?

readonly optional timestamp: null | string

指定时间戳授权服务器的 URL

继承自

MacConfiguration.timestamp


type?

readonly optional type: null | "distribution" | "development"

是否为开发或分发签名应用。

默认值

distribution

继承自

MacConfiguration.type


x64ArchFiles?

readonly optional x64ArchFiles: null | string

允许在两个 ASAR 文件中都是 x64 二进制文件的路径的 Minimatch 模式

除非为 “universal” 架构构建,否则此选项无效,并且仅当 mergeASARstrue 时适用。

继承自

MacConfiguration.x64ArchFiles