跳到内容

应用内容

文件内容

Electron-Builder / app-builder-lib / FilesBuildOptions

扩展自

属性

extraFiles?

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

extraResources 相同,但复制到应用的 content 目录(MacOS 为 Contents,Linux 和 Windows 为根目录)。


extraResources?

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

相对于项目目录的 glob 模式,当指定时,将匹配名称的文件或目录直接复制到应用的 resources 目录(MacOS 为 Contents/Resources,Linux 和 Windows 为 resources)。

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


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 可以是文件,您可以使用它在打包时 重命名 文件。

FileSet 配置

Electron-Builder / app-builder-lib / FileSet

属性

filter?

optional filter: string | string[]

glob 模式。默认为 “*/


from?

optional from: string

相对于以下路径的源路径,默认为

  • files应用目录
  • extraResourcesextraFiles 的项目目录。如果您不使用双 package.json 结构并且不设置自定义应用目录,则应用目录等于项目目录。

to?

optional to: string

相对于以下路径的目标路径,默认为

  • files 的 asar 归档根目录,
  • extraFiles 的应用 content 目录,
  • extraResources 的应用 resource 目录。