Refactor documentation for improved clarity and consistency
- Updated tables for service ports, environment variables, HTTP status codes, and error codes to enhance readability. - Streamlined JavaScript examples for file conversion and added comments for better understanding. - Enhanced troubleshooting section with clearer formatting and additional explanations. - Improved licensing section with detailed requirements and third-party component licenses. - Organized the document structure for better navigation and accessibility.
This commit is contained in:
parent
caecb2e001
commit
394dcbec1a
11 changed files with 538 additions and 497 deletions
|
|
@ -74,23 +74,23 @@ ConvertX-CN/
|
|||
|
||||
### 前端 / Web Server
|
||||
|
||||
| 技術 | 用途 |
|
||||
|------|------|
|
||||
| Bun | JavaScript Runtime |
|
||||
| Elysia | Web 框架 |
|
||||
| React | UI 元件 |
|
||||
| TailwindCSS | 樣式框架 |
|
||||
| TypeScript | 類型安全 |
|
||||
| SQLite | 資料庫 |
|
||||
| 技術 | 用途 |
|
||||
| ----------- | ------------------ |
|
||||
| Bun | JavaScript Runtime |
|
||||
| Elysia | Web 框架 |
|
||||
| React | UI 元件 |
|
||||
| TailwindCSS | 樣式框架 |
|
||||
| TypeScript | 類型安全 |
|
||||
| SQLite | 資料庫 |
|
||||
|
||||
### API Server(選用)
|
||||
|
||||
| 技術 | 用途 |
|
||||
|------|------|
|
||||
| Rust | 語言 |
|
||||
| Axum | Web 框架 |
|
||||
| async-graphql | GraphQL |
|
||||
| tokio | 非同步運行時 |
|
||||
| 技術 | 用途 |
|
||||
| ------------- | ------------ |
|
||||
| Rust | 語言 |
|
||||
| Axum | Web 框架 |
|
||||
| async-graphql | GraphQL |
|
||||
| tokio | 非同步運行時 |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ ConvertX-CN/
|
|||
```bash
|
||||
# 使用 Bun
|
||||
bun install
|
||||
|
||||
|
||||
# 或使用 npm
|
||||
npm install
|
||||
```
|
||||
|
|
@ -133,13 +133,13 @@ ConvertX-CN/
|
|||
|
||||
### 開發指令
|
||||
|
||||
| 指令 | 說明 |
|
||||
|------|------|
|
||||
| `bun dev` | 啟動開發伺服器(熱重載) |
|
||||
| `bun build` | 建構生產版本 |
|
||||
| `bun test` | 執行測試 |
|
||||
| `bun lint` | 執行 Linter |
|
||||
| `bun format` | 格式化程式碼 |
|
||||
| 指令 | 說明 |
|
||||
| ------------ | ------------------------ |
|
||||
| `bun dev` | 啟動開發伺服器(熱重載) |
|
||||
| `bun build` | 建構生產版本 |
|
||||
| `bun test` | 執行測試 |
|
||||
| `bun lint` | 執行 Linter |
|
||||
| `bun format` | 格式化程式碼 |
|
||||
|
||||
### API Server 開發
|
||||
|
||||
|
|
@ -154,10 +154,10 @@ cargo run
|
|||
|
||||
### 主要分支
|
||||
|
||||
| 分支 | 用途 |
|
||||
|------|------|
|
||||
| `main` | 穩定版本,用於發布 |
|
||||
| `develop` | 開發分支,接受 PR |
|
||||
| 分支 | 用途 |
|
||||
| --------- | ------------------ |
|
||||
| `main` | 穩定版本,用於發布 |
|
||||
| `develop` | 開發分支,接受 PR |
|
||||
|
||||
### 功能分支
|
||||
|
||||
|
|
@ -171,11 +171,11 @@ git checkout -b feature/your-feature-name
|
|||
|
||||
### 分支命名規範
|
||||
|
||||
| 類型 | 格式 | 範例 |
|
||||
|------|------|------|
|
||||
| 功能 | `feature/描述` | `feature/add-pdf-watermark` |
|
||||
| 修復 | `fix/描述` | `fix/login-redirect-issue` |
|
||||
| 文件 | `docs/描述` | `docs/update-api-docs` |
|
||||
| 類型 | 格式 | 範例 |
|
||||
| ---- | --------------- | --------------------------------- |
|
||||
| 功能 | `feature/描述` | `feature/add-pdf-watermark` |
|
||||
| 修復 | `fix/描述` | `fix/login-redirect-issue` |
|
||||
| 文件 | `docs/描述` | `docs/update-api-docs` |
|
||||
| 重構 | `refactor/描述` | `refactor/improve-converter-perf` |
|
||||
|
||||
---
|
||||
|
|
@ -184,11 +184,11 @@ git checkout -b feature/your-feature-name
|
|||
|
||||
### 測試類型
|
||||
|
||||
| 類型 | 位置 | 說明 |
|
||||
|------|------|------|
|
||||
| 單元測試 | `tests/` | 測試個別函數 |
|
||||
| 整合測試 | `tests/converters/` | 測試轉換器 |
|
||||
| E2E 測試 | `tests/e2e/` | 端對端測試 |
|
||||
| 類型 | 位置 | 說明 |
|
||||
| -------- | ------------------- | ------------ |
|
||||
| 單元測試 | `tests/` | 測試個別函數 |
|
||||
| 整合測試 | `tests/converters/` | 測試轉換器 |
|
||||
| E2E 測試 | `tests/e2e/` | 端對端測試 |
|
||||
|
||||
### 執行測試
|
||||
|
||||
|
|
@ -215,12 +215,12 @@ bun test --coverage
|
|||
|
||||
```typescript
|
||||
// tests/converters/ffmpeg.test.ts
|
||||
import { describe, it, expect } from 'bun:test';
|
||||
import { convertVideo } from '@/converters/ffmpeg';
|
||||
import { describe, it, expect } from "bun:test";
|
||||
import { convertVideo } from "@/converters/ffmpeg";
|
||||
|
||||
describe('FFmpeg Converter', () => {
|
||||
it('should convert MP4 to WebM', async () => {
|
||||
const result = await convertVideo('input.mp4', 'webm');
|
||||
describe("FFmpeg Converter", () => {
|
||||
it("should convert MP4 to WebM", async () => {
|
||||
const result = await convertVideo("input.mp4", "webm");
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
@ -242,16 +242,16 @@ describe('FFmpeg Converter', () => {
|
|||
|
||||
### Type 類型
|
||||
|
||||
| Type | 說明 |
|
||||
|------|------|
|
||||
| `feat` | 新功能 |
|
||||
| `fix` | 修復 Bug |
|
||||
| `docs` | 文件更新 |
|
||||
| `style` | 程式碼風格(不影響功能) |
|
||||
| Type | 說明 |
|
||||
| ---------- | ------------------------ |
|
||||
| `feat` | 新功能 |
|
||||
| `fix` | 修復 Bug |
|
||||
| `docs` | 文件更新 |
|
||||
| `style` | 程式碼風格(不影響功能) |
|
||||
| `refactor` | 重構(不新增功能或修復) |
|
||||
| `perf` | 效能優化 |
|
||||
| `test` | 新增或修改測試 |
|
||||
| `chore` | 建構或輔助工具變動 |
|
||||
| `perf` | 效能優化 |
|
||||
| `test` | 新增或修改測試 |
|
||||
| `chore` | 建構或輔助工具變動 |
|
||||
|
||||
### 範例
|
||||
|
||||
|
|
@ -303,9 +303,11 @@ bun format
|
|||
|
||||
```markdown
|
||||
## 變更描述
|
||||
|
||||
簡述這個 PR 做了什麼。
|
||||
|
||||
## 變更類型
|
||||
|
||||
- [ ] 新功能
|
||||
- [ ] Bug 修復
|
||||
- [ ] 文件更新
|
||||
|
|
@ -313,9 +315,11 @@ bun format
|
|||
- [ ] 其他
|
||||
|
||||
## 測試
|
||||
|
||||
描述如何測試這些變更。
|
||||
|
||||
## 相關 Issue
|
||||
|
||||
Closes #123
|
||||
|
||||
## 截圖(如適用)
|
||||
|
|
@ -358,12 +362,12 @@ bun format
|
|||
```typescript
|
||||
// ✅ 正確
|
||||
const formatConverter = (name: string): string => {
|
||||
return name.toLowerCase()
|
||||
}
|
||||
return name.toLowerCase();
|
||||
};
|
||||
|
||||
// ❌ 錯誤
|
||||
function formatConverter(name) {
|
||||
return name.toLowerCase();
|
||||
return name.toLowerCase();
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -388,16 +392,16 @@ cargo clippy
|
|||
|
||||
```typescript
|
||||
// src/converters/myconverter.ts
|
||||
import { Converter } from './types'
|
||||
import { Converter } from "./types";
|
||||
|
||||
export const myConverter: Converter = {
|
||||
name: 'myconverter',
|
||||
inputFormats: ['xyz', 'abc'],
|
||||
outputFormats: ['pdf', 'png'],
|
||||
name: "myconverter",
|
||||
inputFormats: ["xyz", "abc"],
|
||||
outputFormats: ["pdf", "png"],
|
||||
convert: async (input, output, options) => {
|
||||
// 轉換邏輯
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
3. 在 `src/converters/main.ts` 註冊
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue