5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 00:41:59 +08:00
wails/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdx
github-actions[bot] 78f638a9bc
docs: sync documents (#2514)
Co-authored-by: misitebao <misitebao@users.noreply.github.com>
2023-04-01 16:04:43 +11:00

97 lines
4.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebar_position: 5
---
# 项目配置
项目配置在项目目录中的 `wails.json` 文件中。 配置的结构是:
```json
{
// 项目配置版本
"version": "",
// 项目名称
"name": "",
// 包含编译资产的目录的相对路径,这通常是推断的并且可以留空
"assetdir": "",
// 触发重新加载的附加目录(逗号分隔),这仅用于某些高级资产配置
"reloaddirs": "",
// 构建文件所在的目录。默认为“build”
"build:dir": "",
// 前端目录的相对路径。默认为“frontend”
"frontend:dir": "",
// 安装 Node 依赖的命令,在前端目录运行 - 通常是`npm install`
"frontend:install": "",
// 构建资产的命令,在前端目录中运行 - 通常是 `npm run build`
"frontend:build": "",
// 此命令已被 frontend:dev:build 取代。如果未指定 frontend:dev:build 将回退到此命令。如果此命令也未指定,将回退到 frontend:build
"frontend:dev": "",
// 此命令是 frontend:build 的 dev 等价物。如果未指定回退到 frontend:dev
"frontend:dev:build": "",
// 此命令是 frontend:install 的 dev 等价物。如果未指定回退到 frontend:install
"frontend:dev:install": "",
// 此命令在 `wails dev`上的单独进程中运行。用于第 3 方观察者或启动 3d 方开发服务器
"frontend:dev:watcher": "",
// 用于服务资产的第 3 方开发服务器的 URL比如 Vite。如果设置为 'auto' 那么 devServerUrl 将从 Vite 输出中推断出来
"frontend:dev:serverUrl": "",
// 创建自动生成的 JS 模块的目录的相对路径
"wailsjsdir": "",
// 二进制文件的名称
"outputfilename": "",
// 开发服务器在检测到资产更改时等待重新加载的默认时间
"debounceMS": 100,
// 将 wails 开发服务器绑定到的地址。默认为localhost:34115
"devServer": "",
// 在开发模式下以 shell 样式传递给应用程序的参数
"appargs": "",
// 定义是否应该运行构建 Hooks尽管它们是为主机操作系统以外的操作系统定义的。
"runNonNativeBuildHooks": false,
// 构建前 Hooks
"preBuildHooks": {
// 在构建指定的 GOOS/GOARCH 之前将执行的命令:${platform} 被替换为“GOOS/GOARCH”。 “GOOS/GOARCH” hook 在“GOOS/*”和“*/*” hook 之前执行。
"GOOS/GOARCH": "",
// 在指定 GOOS 的构建之前将执行的命令:${platform} 被替换为“GOOS/GOARCH”。 “GOOS/*” hook 在“*/*” hook 之前执行。
"GOOS/*": "",
// 将在每次构建之前执行的命令:${platform} 替换为“GOOS/GOARCH”。
"*/*": ""
},
// 构建后 Hooks
"postBuildHooks": {
// 在构建指定的 GOOS/GOARCH 之后将执行的命令:${platform} 替换为“GOOS/GOARCH”${bin} 替换为已编译二进制文件的路径。 “GOOS/GOARCH” hook 在“GOOS/*”和“*/*” hook 之前执行。
"GOOS/GOARCH": "",
// 在构建指定的 GOOS 之后将执行的命令:${platform} 替换为“GOOS/GOARCH”${bin} 替换为已编译二进制文件的路径。 “GOOS/*” hook 在“*/*” hook 之前执行。
"GOOS/*": "",
// The command that will be executed after every build: ${platform} is replaced with the "GOOS/GOARCH" and ${bin} with the path to the compiled binary.
// 每次构建后将执行的命令:${platform} 替换为“GOOS/GOARCH”${bin} 替换为已编译二进制文件的路径。
"*/*": ""
},
// 用于填充 manifest 和版本信息的数据。
"info": {
// 公司名称。 默认值:[项目名]
"companyName": "",
// 产品名称。 默认值:[项目名]
"productName": "",
// 产品版本。默认值:'1.0.0'
"productVersion": "",
// 产品的版权。默认值:'Copyright.........'
"copyright": "",
// 该应用程序的简短评论。默认值:'Built using Wails (https://wails.app)'
"comments": ""
},
// 'multiple': 每个架构一个安装程序。
// 'single': 适用于正在构建的所有体系结构的单一通用安装程序。
// 默认值:'multiple'
"nsisType": "",
// 应用程序是否应该被混淆。默认值false
"obfuscated": "",
// 使用 obfuscated 标志时传递给乱码命令的参数
"garbleargs": ""
}
```
该文件将在运行 `wails build` 或 `wails dev` 时,由 Wails CLI 读取。
`wails build/dev` 命令中的 `assetdir`、`reloaddirs`、`wailsjsdir`、`debounceMS`、`devserver` 和 `frontenddevserverurl` 标志将覆盖项目配置并作为后续运行的默认值。
此文件的 `JSON Schema` 位于 [此处](https://wails.io/schemas/config.v2.json)。