docs: 重组 docs/manual/ 指南结构,区分普通用户与开发者双入口
- 新增 00-目录与导读.md 双入口导航 - 用户面(01-04):项目介绍、安装指南、版本记录、其他信息 - 开发者面(05-10):技术栈、构建、架构、云同步、代码规范、MCP - 拆分旧01为 01(用户)+05(开发者);旧02为 02(用户)+06(开发者) - 合并旧08+09 MCP文档为 10-MCP服务集成 - 同步更新 README.md 与 .trae/rules/项目/ 交叉引用
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
# 开发环境与构建
|
||||
|
||||
> 本文档面向开发者,介绍如何搭建开发环境、从源码构建和部署。
|
||||
|
||||
## 1. 开发环境搭建
|
||||
|
||||
### 1.1 前提要求
|
||||
|
||||
- .NET 10 SDK
|
||||
- Node.js 18+
|
||||
- Visual Studio 2022+(推荐)或 VS Code
|
||||
- Inno Setup 6(仅 Windows 打包需要)
|
||||
|
||||
### 1.2 克隆与安装
|
||||
|
||||
```bash
|
||||
git clone https://git.we965.cn/Tools/Hua.Todo.git
|
||||
cd Hua.Todo
|
||||
```
|
||||
|
||||
前端依赖安装:
|
||||
|
||||
```bash
|
||||
cd src/Hua.Todo.Web
|
||||
npm install
|
||||
```
|
||||
|
||||
### 1.3 启动开发环境
|
||||
|
||||
**方式一:Windows 三件套(推荐)**
|
||||
|
||||
```powershell
|
||||
# 终端 1:启动 Host(API 服务端)
|
||||
.\start-host.ps1
|
||||
|
||||
# 终端 2:启动前端开发服务器
|
||||
.\start-dev.ps1
|
||||
```
|
||||
|
||||
**方式二:MAUI 嵌入模式**
|
||||
|
||||
在 Visual Studio 中直接调试运行 `Hua.Todo.Maui` 项目,MAUI 会自动启动内嵌 WebServer 并加载前端。
|
||||
|
||||
## 2. 版本构建 (Release Build)
|
||||
|
||||
### 2.1 脚本入口
|
||||
|
||||
位于根目录的 `publish.ps1` 系列脚本:
|
||||
|
||||
```powershell
|
||||
# 全平台一键构建
|
||||
.\publish.ps1 -Windows -Linux
|
||||
|
||||
# Windows 单独构建
|
||||
.\publish-windows.ps1
|
||||
|
||||
# Linux 单独构建
|
||||
.\publish-linux.ps1 -RuntimeIdentifier linux-x64 -SelfContained
|
||||
```
|
||||
|
||||
### 2.2 产物输出位置
|
||||
|
||||
| 平台 | 路径 |
|
||||
|---|---|
|
||||
| Windows 安装包 | `artifacts\windows\win-x64\installer\` |
|
||||
| Windows 绿色版 | `artifacts\windows\win-x64\publish\` |
|
||||
| Linux | `artifacts\linux\linux-x64\`(`.tar.gz`) |
|
||||
|
||||
## 3. 服务端部署
|
||||
|
||||
### 3.1 Docker 部署(推荐)
|
||||
|
||||
```bash
|
||||
docker build -t hua-todo-server -f src/Hua.Todo.Host/Dockerfile .
|
||||
docker run -d \
|
||||
--name hua-todo-server \
|
||||
-p 5173:5173 \
|
||||
-v /data/hua-todo/db:/app/data \
|
||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||
hua-todo-server
|
||||
```
|
||||
|
||||
### 3.2 直接部署
|
||||
|
||||
```bash
|
||||
dotnet publish src/Hua.Todo.Host -c Release -o ./dist
|
||||
# 将 ./dist 同步到服务器,可选配置 Systemd 服务
|
||||
```
|
||||
|
||||
## 4. 数据库
|
||||
|
||||
- **开发/测试**:SQLite,路径 `src/Hua.Todo.Host/Hua.Todo.db`
|
||||
- **生产**:SQLite(默认)或切换其他 EF Core 支持的数据库
|
||||
- **迁移**:嵌入式宿主启动时自动执行 `db.Database.Migrate()`
|
||||
|
||||
## 5. 下一步
|
||||
|
||||
- 了解架构细节 → [07-技术架构设计](./07-技术架构设计.md)
|
||||
- 了解云同步 → [08-云同步规则](./08-云同步规则.md)
|
||||
- 编码规范 → [09-代码规范](./09-代码规范.md)
|
||||
Reference in New Issue
Block a user