5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 17:39:58 +08:00

Change frontend:dev to frontend:dev:build (#1691)

This commit is contained in:
LGiki 2022-08-03 19:19:06 +08:00 committed by GitHub
parent baff28bb20
commit b33211495e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 11 deletions

View File

@ -22,6 +22,7 @@ type Project struct {
// Commands used in `wails dev` // Commands used in `wails dev`
DevCommand string `json:"frontend:dev"` DevCommand string `json:"frontend:dev"`
DevBuildCommand string `json:"frontend:dev:build"`
DevInstallCommand string `json:"frontend:dev:install"` DevInstallCommand string `json:"frontend:dev:install"`
DevWatcherCommand string `json:"frontend:dev:watcher"` DevWatcherCommand string `json:"frontend:dev:watcher"`
// The url of the external wails dev server. If this is set, this server is used for the frontend. Default "" // The url of the external wails dev server. If this is set, this server is used for the frontend. Default ""
@ -85,6 +86,16 @@ type Project struct {
NSISType string `json:"nsisType"` NSISType string `json:"nsisType"`
} }
func (p *Project) GetDevBuildCommand() string {
if p.DevBuildCommand != "" {
return p.DevBuildCommand
}
if p.DevCommand != "" {
return p.DevCommand
}
return p.BuildCommand
}
func (p *Project) GetDevInstallerCommand() string { func (p *Project) GetDevInstallerCommand() string {
if p.DevInstallCommand != "" { if p.DevInstallCommand != "" {
return p.DevInstallCommand return p.DevInstallCommand

View File

@ -534,15 +534,9 @@ func (b *BaseBuilder) BuildFrontend(outputLogger *clilogger.CLILogger) error {
} }
// Check if there is a build command // Check if there is a build command
var buildCommand string buildCommand := b.projectData.BuildCommand
switch b.projectData.OutputType { if b.projectData.OutputType == "dev" {
case "dev": buildCommand = b.projectData.GetDevBuildCommand()
buildCommand = b.projectData.DevCommand
if buildCommand == "" {
buildCommand = b.projectData.BuildCommand
}
default:
buildCommand = b.projectData.BuildCommand
} }
if buildCommand == "" { if buildCommand == "" {
outputLogger.Println(" - No Build command. Skipping.") outputLogger.Println(" - No Build command. Skipping.")

View File

@ -13,7 +13,8 @@ The project config resides in the `wails.json` file in the project directory. Th
"reloaddirs": "[Additional directories to trigger reloads (comma separated), this is only used for some advanced asset configurations]", "reloaddirs": "[Additional directories to trigger reloads (comma separated), this is only used for some advanced asset configurations]",
"frontend:install": "[The command to install node dependencies, run in the frontend directory - often `npm install`]", "frontend:install": "[The command to install node dependencies, run in the frontend directory - often `npm install`]",
"frontend:build": "[The command to build the assets, run in the frontend directory - often `npm run build`]", "frontend:build": "[The command to build the assets, run in the frontend directory - often `npm run build`]",
"frontend:dev": "[This command is the dev equivalent of frontend:build. If not specified falls back to frontend:build]", "frontend:dev": "[This command has been replaced by frontend:dev:build. If frontend:dev:build is not specified will falls back to this command. If this command is also not specified will falls back to frontend:build]",
"frontend:dev:build": "[This command is the dev equivalent of frontend:build. If not specified falls back to frontend:dev]",
"frontend:dev:install": "[This command is the dev equivalent of frontend:install. If not specified falls back to frontend:install]", "frontend:dev:install": "[This command is the dev equivalent of frontend:install. If not specified falls back to frontend:install]",
"frontend:dev:watcher": "[This command is run in a separate process on `wails dev`. Useful for 3rd party watchers or starting 3d party dev servers]", "frontend:dev:watcher": "[This command is run in a separate process on `wails dev`. Useful for 3rd party watchers or starting 3d party dev servers]",
"frontend:dev:serverUrl": "[URL to a 3rd party dev server to be used to serve assets, EG Vite. If this is set to 'auto' then the devServerUrl will be inferred from the Vite output]", "frontend:dev:serverUrl": "[URL to a 3rd party dev server to be used to serve assets, EG Vite. If this is set to 'auto' then the devServerUrl will be inferred from the Vite output]",

View File

@ -13,7 +13,8 @@ sidebar_position: 5
"reloaddirs": "[触发重新加载的附加目录(逗号分隔),这仅用于一些重要资源配置]", "reloaddirs": "[触发重新加载的附加目录(逗号分隔),这仅用于一些重要资源配置]",
"frontend:install": "[安装 node 依赖的命令,在 frontend 目录下运行 - 通常是 `npm install`]", "frontend:install": "[安装 node 依赖的命令,在 frontend 目录下运行 - 通常是 `npm install`]",
"frontend:build": "[构建资源的命令,在 frontend 目录下运行 - 通常是 `npm run build`]", "frontend:build": "[构建资源的命令,在 frontend 目录下运行 - 通常是 `npm run build`]",
"frontend:dev": "[此命令等效于开发模式中的 frontend:build如果没有指定则只有 frontend:build]", "frontend:dev": "[此命令已被 frontend:dev:build 替代。如果没有指定 frontend:dev:build 将回退到该命令,如果此命令也没有指定将回退到 frontend:build]",
"frontend:dev:build": "[此命令等效于开发模式中的 frontend:build如果没有指定则回退到 frontend:dev]",
"frontend:dev:install": "[此命令等效于开发模式中的 frontend:install如果没有指定则只有 frontend:install]", "frontend:dev:install": "[此命令等效于开发模式中的 frontend:install如果没有指定则只有 frontend:install]",
"frontend:dev:watcher": "[此命令在 `wails dev` 上的单独进程中运行。对第 3 方观察者有用]", "frontend:dev:watcher": "[此命令在 `wails dev` 上的单独进程中运行。对第 3 方观察者有用]",
"frontend:dev:serverUrl": "[使用第三方开发服务器提供资源,比如 Vite", "frontend:dev:serverUrl": "[使用第三方开发服务器提供资源,比如 Vite",