Files
oci-portal-dash/README.md
T
2026-07-21 19:26:22 +08:00

42 lines
1.7 KiB
Markdown
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.
# OCI Portal Dash
[OCI Portal](https://github.com/wangdefaa/oci-portal) 的前端工程:Vue 3 + Vite + TypeScript + Naive UI + Tailwind CSS v4 + ECharts + Pinia。
## 开发
```bash
npm install
npm run dev # http://localhost:5173,默认 mock 模式开箱可视
```
| 环境变量 | 默认值 | 说明 |
| --- | --- | --- |
| `VITE_MOCK` | dev 为 `1` | `1` 走内置 mock 数据不依赖后端;置 `0` 走真实请求(dev server 将 `/api``/ai/` 代理到 `http://localhost:8080`,需先启动后端) |
## 质量检查与构建
```bash
npm run lint # ESLint + Prettier(带 --fix)
npm run typecheck # vue-tsc --noEmit
npm run build # 类型检查 + 产物构建到 dist/
```
## 部署
两种形态:
1. **静态直出**`dist/` 交给 Caddy/nginx 伺服,`/api/*``/ai/*` 反代到后端
2. **单文件嵌入**:产物经后端 `go:embed` 打进单个二进制。本仓库 Release 流程(tag `v*`)自动构建并发布 `dist.zip`,后端 Release 流程从这里下载嵌入;本地则 `npm run build` 后把 `dist/` 内容拷入后端 `internal/webui/dist/`
### PWA
构建产物自带 PWAvite-plugin-pwa`manifest.webmanifest` + Service Worker),HTTPS 部署下手机浏览器可「添加到主屏幕」以独立窗口运行;前端发版后用户刷新即自动更新(`registerType: autoUpdate`)。Service Worker 只预缓存应用壳(约 4.6MB,office 预览大块按需缓存),`/api/*``/ai/*` 一律直连不缓存。图标源自 `public/favicon.svg`,改版时需同步重生成 `public/pwa-*.png``apple-touch-icon.png`
## 规范
编码规范与项目约定见 [AGENTS.md](AGENTS.md) 与 [.trellis/spec/](.trellis/spec/)。
## License
[MIT](LICENSE)