1f487c3163
从 wails/v2 v2.12.0 迁到 v3 v3.0.0-alpha2.117,采用 v3 工程规范:
Go 侧:
- main.go:wails.Run(options.App) → application.New(Options{Services,Assets,Mac})
+ app.Window.NewWithOptions(WebviewWindowOptions) + app.Run();窗口选项照搬
(1440×900/min 1100×700/#0b0d12/Mac TitleBarHiddenInset)
- app.go:App 结构体绑定 → v3 Service(application.NewService);去 startup/ctx 注入;
SaveFileDialog 改 v3 链式 API(application.Get().Dialog.SaveFile().SetFilename().
AddFilter().PromptForSingleSelection());5 个原生方法保留
- go.mod wails/v2→v3、go 1.25
构建:
- wails.json → Taskfile.yml + build/(config.yml 填产品信息 + 各平台配置)
- 删移动端脚手架(ios/android),桌面端只留 darwin/windows/linux
- .gitignore 改为只忽略 build/bin(build/ 构建系统需提交)
前端:
- vite.config 接 @wailsio/runtime/plugins/vite 插件 + WAILS_VITE_PORT
- package.json 加 @wailsio/runtime;wails3 generate bindings → frontend/bindings/
- desktop.ts:window.go.main.App → import { App } from bindings;桌面态检测改
window._wails.environment(原生注入);isMacDesktop 用 System.IsMac()
- version.ts:runtime.BrowserOpenURL → @wailsio/runtime Browser.OpenURL;测试同步更新
- tsconfig 加 allowJs(消费 JSDoc 绑定)
验证进度:Go 编译过 + tsc 干净 + 48 前端测试绿 + 前端 vite build 通过。
**未完成:整体 wails3 build/dev 原生窗口实跑 + 原生能力(另存为/打开/外链)联调**——下次续。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
APP_NAME: "sundynix_desktop"
|
|
BIN_DIR: "bin"
|
|
PACKAGE_MANAGER: '{{.PACKAGE_MANAGER | default "npm"}}'
|
|
VITE_PORT: '{{.WAILS_VITE_PORT | default 9245}}'
|
|
# Target OS for build/package/run. Defaults to the host OS, and is overridden
|
|
# by `wails3 build GOOS=...` (or the GOOS env var) for cross-compilation. The
|
|
# tasks below dispatch to the matching platform Taskfile via this variable.
|
|
GOOS: '{{.GOOS | default OS}}'
|
|
|
|
includes:
|
|
common: ./build/Taskfile.yml
|
|
windows: ./build/windows/Taskfile.yml
|
|
darwin: ./build/darwin/Taskfile.yml
|
|
linux: ./build/linux/Taskfile.yml
|
|
|
|
tasks:
|
|
build:
|
|
summary: Builds the application
|
|
cmds:
|
|
- task: "{{.GOOS}}:build"
|
|
|
|
package:
|
|
summary: Packages a production build of the application
|
|
cmds:
|
|
- task: "{{.GOOS}}:package"
|
|
|
|
run:
|
|
summary: Runs the application
|
|
cmds:
|
|
- task: "{{.GOOS}}:run"
|
|
|
|
dev:
|
|
summary: Runs the application in development mode
|
|
cmds:
|
|
- wails3 dev -config ./build/config.yml -port {{.VITE_PORT}}
|
|
|
|
setup:docker:
|
|
summary: Builds Docker image for cross-compilation (~800MB download)
|
|
cmds:
|
|
- task: common:setup:docker
|
|
|
|
build:server:
|
|
summary: Builds the application in server mode (no GUI, HTTP server only)
|
|
cmds:
|
|
- task: common:build:server
|
|
|
|
run:server:
|
|
summary: Runs the application in server mode
|
|
cmds:
|
|
- task: common:run:server
|
|
|
|
build:docker:
|
|
summary: Builds a Docker image for server mode deployment
|
|
cmds:
|
|
- task: common:build:docker
|
|
|
|
run:docker:
|
|
summary: Builds and runs the Docker image
|
|
cmds:
|
|
- task: common:run:docker
|