跳到内容

PKG

顶层 pkg 键包含一组选项,指示 electron-builder 如何构建 PKG (macOS 安装程序组件包)。

配置

Electron-Builder / app-builder-lib / PkgOptions

macOS 产品归档选项。

继承自

属性

allowAnywhere?

readonly optional allowAnywhere: null | boolean

是否可以安装在任何卷的根目录,包括非系统卷。否则,它不能安装在卷的根目录。

对应于 enable_anywhere

默认值
true

allowCurrentUserHome?

readonly optional allowCurrentUserHome: null | boolean

是否可以安装到当前用户的主目录。主目录安装以当前用户(而不是 root 用户)完成,并且它不能写入主目录之外。如果产品无法安装在用户的主目录中,并且无法从用户的主目录完全正常运行。

对应于 enable_currentUserHome

默认值
true

allowRootDirectory?

readonly optional allowRootDirectory: null | boolean

是否可以安装到根目录。通常应为 true,除非产品只能安装到用户的主目录。

对应于 enable_localSystem

默认值
true

artifactName?

readonly optional artifactName: null | string

工件文件名模板

继承自

TargetSpecificOptions.artifactName


background?

readonly optional background: null | PkgBackgroundOptions

安装程序背景图像的选项。


conclusion?

readonly optional conclusion: null | string

结论文件路径。这可以用于自定义安装程序最终“摘要”页面上的文本。


extraPkgsDir?

readonly optional extraPkgsDir: null | string

额外的组件包目录(相对于构建资源目录),用于 macOS 产品归档 Autoscans 目录,查找任何 .pkg 文件,并添加到 productbuild 命令中作为 --package-path--package


hasStrictIdentifier?

readonly optional hasStrictIdentifier: null | boolean

是否要求在安装路径上具有相同的捆绑包标识符?

默认值
true

identity?

readonly optional identity: null | string

用于签名的证书名称。考虑使用环境变量 CSC_LINK 或 CSC_NAME 而不是指定此选项。


installLocation?

readonly optional installLocation: null | string

安装位置。不要使用它来创建每个用户的包。大多数情况下你永远不需要更改此选项。如果选择了本地系统域,/Applications 会按预期将其安装到 /Applications 中,如果选择了主目录安装,则安装到 $HOME/Applications 中。

默认值
/Applications

isRelocatable?

readonly optional isRelocatable: null | boolean

如果用户移动了捆绑包,是否覆盖安装之前的版本?

默认值
true

isVersionChecked?

readonly optional isVersionChecked: null | boolean

如果磁盘上有更新的版本,则不安装捆绑包?

默认值
true

license?

readonly optional license: null | string

EULA 许可文件路径。默认为 license.txteula.txt(或大写变体)。除了 txt,还支持 rtfhtml(不要忘记为链接使用 target="_blank")。


mustClose?

readonly optional mustClose: null | string[]

标识在安装包之前必须关闭的应用程序。

对应于 must-close


overwriteAction?

readonly optional overwriteAction: null | "upgrade" | "update"

指定当安装包中的版本时,应如何处理磁盘上已存在的捆绑包版本。

如果指定 upgrade,则包中的捆绑包原子地替换磁盘上的任何版本;这具有删除新版本捆绑包中不再存在的旧路径的效果。

如果指定 update,则包中的捆绑包覆盖磁盘上的版本,并且包中未包含的任何文件将保持不变;当您交付仅更新包时,这很合适。

update 的另一个效果是,如果磁盘上还没有版本,则根本不会安装包捆绑包;这允许包为用户可能已删除的应用程序提供更新。

默认值
upgrade

publish?

optional publish: Publish

继承自

TargetSpecificOptions.publish


scripts?

readonly optional scripts: null | string

脚本目录,相对于 build(构建资源目录)。脚本可以是任何语言,只要文件标记为可执行文件并具有指示解释器路径的适当 shebang。脚本需要是可执行的 (chmod +x file)。

默认值
build/pkg-scripts
参见

安装程序包中的脚本.


welcome?

readonly optional welcome: null | string

欢迎文件路径。这可以用于自定义安装程序“简介”页面上的文本。