Private
Public Access
1
0

新增:文档体系重构+CHANGELOG补充+发布产物清理

This commit is contained in:
2026-05-01 22:22:06 +08:00
parent 3e1a540b83
commit 6eaaa56eb6
164 changed files with 40346 additions and 64 deletions

View File

@@ -2,6 +2,166 @@
> 本文档记录所有技术细节,包括代码重构、构建优化等内部改动
## [0.5.0] - 2026-05-01 (fs-only-v3)
### Wails v3 迁移 🏗️
#### 框架升级
- **Wails v2.12 → v3 alpha.80**: 全面迁移至 Wails v3 架构
- **入口重构**: `main.go` 使用 `application.New()` + `application.WebviewWindowOptions`
- **Asset Server**: 从 v2 的 embed.FS 直接服务改为 v3 的 `application.AssetFileServerFS(assets)` + Middleware 模式
- **Bindings**: 手动维护的 `wailsjs/wailsjs/`v2 runtime→ 自动生成的 `v3-bindings/` + `bindings/`
#### main.go 关键变更
```go
// 新增: AssetOptions Middleware 解决 custom.js 404
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
Middleware: func(next http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if req.URL.Path == "/wails/custom.js" {
rw.Header().Set("Content-Type", "application/javascript")
rw.WriteHeader(200)
return
}
next.ServeHTTP(rw, req)
})
},
},
// 新增: 延迟 DevTools 启动production+devtools build tag
go func() {
time.Sleep(2 * time.Second)
_ = window.OpenDevTools()
}()
```
#### 窗口配置
- Frameless 模式 + Windows 11 CustomTheme圆角 + Aero 阴影)
- 亮/暗模式标题栏颜色独立配置:`titleBarLight=0xF0F0F0`, `titleBarDark=0x2D2D2D`
- MinWidth/MinHeight: 1000×600
---
### 构建系统重构 🔨
#### Taskfile.yml 对齐官方模板
```
executes:
- task: common:install:frontend:deps # once
- task: common:dev:frontend # background (Vite)
- task: build # blocking (Go compile)
- task: run # primary (run exe)
```
**旧方案问题**: 使用自定义 `dev.ps1` 脚本,无法正确处理 Vite proxy 502 错误
**新方案收益**:
- ✅ 官方标准流水线502 问题消除production build mode 服务嵌入 dist
- ✅ 自动依赖安装、自动 bindings 生成
- ✅ 跨平台构建模板Android/iOS/Linux/macOS/Docker
#### Build Tags 策略
| Tag | 用途 |
|-----|------|
| `production` | 使用嵌入 FS不启动 Vite dev server |
| `devtools` | 编译保留 DevTools/OpenDevTools API |
| `windows && (!production \|\| devtools)` | DevTools 条件编译 |
**关键**: `build/windows/Taskfile.yml` BUILD_FLAGS 硬编码 `,devtools`
```yaml
BUILD_FLAGS: '{{if eq .DEV "true"}}...{{else}}-tags production,devtools ...{{end}}'
```
---
### 前端目录规范化 📁
#### web/ → frontend/
- Wails v3 标准目录名为 `frontend/`
- git rename 78 个文件保持历史连续性
- 删除旧的 `web/vite.config.js``web/package-lock.json`
#### 新增文件
| 文件 | 说明 |
|------|------|
| `frontend/vite.config.js` | v3 格式port 9245 |
| `frontend/src/types/window.d.ts` | v3 window API 类型声明 |
| `frontend/src/api/wails-transport.ts` | v3 transport 层 |
| `frontend/src/wailsjs/v3-bindings/` | 自动生成绑定 |
| `frontend/bindings/` | TypeScript 绑定输出 |
---
### Sidebar 滚动架构优化 🎨
#### 问题
旧结构:`.sidebar { overflow-y: auto }` 整体滚动,收藏多了把帮助区块推到窗口外
#### 方案:三段式 Flex 布局
```css
.sidebar {
display: flex;
flex-direction: column;
overflow: hidden; /* 不再整体滚动 */
}
/* 收藏夹内容区 — 内部独立滚动 */
.section-content:not(.help-content) {
flex: 1;
min-height: 0;
overflow-y: auto; /* 收藏列表内部滚动 */
}
/* 帮助区块 — 固定底部 */
.sidebar-section:last-child {
flex-shrink: 0; /* 不被压缩 */
}
```
#### 折叠状态管理
- `favCollapsed = ref(false)` — 默认展开
- `helpCollapsed = ref(false)` — 默认展开(用户要求可见)
- 折叠动画:`max-height` + `opacity` CSS transition非 Vue Transition更轻量
---
### Bug 修复 🐛
#### longPressTimer TypeError (`useFavorites.ts:168`)
```diff
- const longPressTimer = ref<ReturnType<typeof setTimeout> | null>(null)
+ let longPressTimer = ref<ReturnType<typeof setTimeout> | null>(null)
```
原因:`const` 声明后 `onLongPressStart``longPressTimer = setTimeout(...)` 重复赋值
#### Arco Tabs padding-top (`App.vue`)
```css
.arco-tabs-content { padding-top: 0; }
```
Arco Design 默认 16px padding 导致内容偏移
---
### 核心文件变更
| 文件 | 类型 | 说明 |
|------|------|------|
| `main.go` | 重构 | +11 行Middleware + DevTools |
| `build/config.yml` | 重构 | executes 流水线对齐官方模板 |
| `build/windows/Taskfile.yml` | 修改 | BUILD_FLAGS 加 devtools tag |
| `Taskfile.yml` | 新增 | 根级 dev 任务 |
| `frontend/src/components/Sidebar.vue` | 修改 | 折叠架构 + 内部滚动 |
| `frontend/src/composables/useFavorites.ts` | 修复 | const→let |
| `frontend/src/App.vue` | 修改 | Tabs padding 覆盖 |
### 归档清理
移动到 `.archive/` 目录(不删除):
- `u-desk.exe``frontend.bak/``web-old/``greetservice.go`
- clipboard png、`package.json.md5`、v2 wailsjs bindings
---
## [0.3.3] - 2026-04-13
### 架构新增 🏗️