release: v0.5.0 — 升级 MetonaEditor 0.4.0 / MetonaToast 0.5.0,数据库迁移 MetonaSqlark 0.4.1
- 编辑器升级 0.4.0:TypeScript 全模块重构、启用浮动格式工具栏 - 通知升级 0.5.0:钩子系统、新增动画 - 移除 Dexie.js,迁移至 MetonaSqlark 0.4.1(AriaEngine:LSM-Tree + WAL + MVCC) - 数据库更换为 MarkLiteV2,旧 Dexie 数据放弃 - 修复 Editor 组件无条件重渲染(getActiveTab 返回新引用) - 更新关于弹框、README、DESIGN 文档
This commit is contained in:
+123
-123
@@ -1,123 +1,123 @@
|
||||
# 贡献指南
|
||||
|
||||
感谢你对 MarkLite 项目的关注!以下是参与贡献的指南。
|
||||
|
||||
## 开发环境
|
||||
|
||||
1. **前置要求**
|
||||
- Node.js >= 18.x
|
||||
- npm >= 9.x
|
||||
- Windows 10/11 x64
|
||||
|
||||
2. **克隆并安装**
|
||||
```bash
|
||||
git clone https://git.metona.cn/MetonaTeam/MarkLite.git
|
||||
cd MarkLite
|
||||
npm install
|
||||
```
|
||||
|
||||
3. **启动开发**
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 代码规范
|
||||
|
||||
- **TypeScript**: 严格模式,所有函数参数需显式类型标注
|
||||
- **ESLint**: 提交前确保 `npm run lint` 通过
|
||||
- **Prettier**: 提交前确保 `npm run format:check` 通过
|
||||
- **Git Hooks**: pre-commit 自动执行 ESLint + typecheck
|
||||
|
||||
## 分支策略
|
||||
|
||||
- `master` — 稳定版本
|
||||
- `dev` — 开发分支
|
||||
- `feature/*` — 功能分支
|
||||
- `fix/*` — 修复分支
|
||||
|
||||
## 提交规范
|
||||
|
||||
使用语义化提交信息:
|
||||
|
||||
```
|
||||
<type>(<scope>): <description>
|
||||
|
||||
[optional body]
|
||||
```
|
||||
|
||||
类型(type):
|
||||
- `feat`: 新功能
|
||||
- `fix`: 修复 Bug
|
||||
- `docs`: 文档变更
|
||||
- `style`: 代码格式(不影响逻辑)
|
||||
- `refactor`: 重构
|
||||
- `perf`: 性能优化
|
||||
- `test`: 测试相关
|
||||
- `chore`: 构建/工具链变更
|
||||
|
||||
示例:
|
||||
```
|
||||
feat(editor): 添加代码折叠功能
|
||||
fix(tab): 修复关闭标签后焦点丢失问题
|
||||
perf(markdown): 引入 processor LRU 缓存
|
||||
```
|
||||
|
||||
## Pull Request 流程
|
||||
|
||||
1. Fork 仓库并创建功能分支
|
||||
2. 确保所有检查通过:
|
||||
```bash
|
||||
npm run lint # ESLint
|
||||
npm run typecheck # TypeScript 类型检查
|
||||
npm run test # 单元测试
|
||||
```
|
||||
3. 编写清晰的 PR 描述,说明变更内容和原因
|
||||
4. 等待代码审查
|
||||
|
||||
## 添加测试
|
||||
|
||||
- 测试文件放在 `__tests__/` 目录下,命名为 `*.test.ts` 或 `*.test.tsx`
|
||||
- 使用 Vitest + React Testing Library
|
||||
- 至少覆盖 stores、hooks、lib 目录下的核心模块
|
||||
|
||||
```bash
|
||||
# 运行测试
|
||||
npm run test
|
||||
|
||||
# 监听模式
|
||||
npm run test:watch
|
||||
|
||||
# 覆盖率报告
|
||||
npm run test:coverage
|
||||
```
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── main/ # 主进程 (Node.js)
|
||||
├── preload/ # 预加载脚本
|
||||
├── renderer/ # 渲染进程 (React)
|
||||
│ ├── components/ # UI 组件(Toolbar · TabBar · Editor · Sidebar 等)
|
||||
│ ├── stores/ # Zustand 状态管理(tabStore · editorStore · sidebarStore · autoSaveStore)
|
||||
│ ├── hooks/ # 自定义 Hooks(useTheme · useAutoSave · useKeyboard 等)
|
||||
│ ├── lib/ # 工具库(markdown · fileUtils · errorHandler · toast)
|
||||
│ ├── db/ # IndexedDB 持久化(schema · repositories)
|
||||
│ ├── types/ # TypeScript 类型定义
|
||||
│ └── styles/ # 全局样式(variables · global · markdown-body)
|
||||
└── shared/ # 主进程/渲染进程共享(IPC 通道 · 共享类型 · 常量)
|
||||
```
|
||||
|
||||
### 编辑器架构
|
||||
|
||||
MarkLite 使用 [MetonaEditor](https://git.metona.cn/MetonaTeam/MetonaEditor) v0.1.3 作为编辑器核心:
|
||||
|
||||
- **三模式视图**(编辑 / 分屏 / 预览),由 MetonaEditor 内置工具栏切换
|
||||
- **渲染管线**:通过 `render` 钩子接入 unified/rehype 管线,处理图片路径修复和代码高亮
|
||||
- **插件**:searchReplace(搜索替换)+ imagePaste(粘贴图片)
|
||||
- **自动保存**:自定义 `useAutoSave` hook,通过 Electron IPC 保存到文件系统(非 localStorage)
|
||||
- **主题同步**:应用暗色模式与编辑器主题双向同步
|
||||
|
||||
## 许可证
|
||||
|
||||
贡献的代码将遵循项目的 [MIT 许可证](LICENSE)。
|
||||
# 贡献指南
|
||||
|
||||
感谢你对 MarkLite 项目的关注!以下是参与贡献的指南。
|
||||
|
||||
## 开发环境
|
||||
|
||||
1. **前置要求**
|
||||
- Node.js >= 18.x
|
||||
- npm >= 9.x
|
||||
- Windows 10/11 x64
|
||||
|
||||
2. **克隆并安装**
|
||||
```bash
|
||||
git clone https://git.metona.cn/MetonaTeam/MarkLite.git
|
||||
cd MarkLite
|
||||
npm install
|
||||
```
|
||||
|
||||
3. **启动开发**
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 代码规范
|
||||
|
||||
- **TypeScript**: 严格模式,所有函数参数需显式类型标注
|
||||
- **ESLint**: 提交前确保 `npm run lint` 通过
|
||||
- **Prettier**: 提交前确保 `npm run format:check` 通过
|
||||
- **Git Hooks**: pre-commit 自动执行 ESLint + typecheck
|
||||
|
||||
## 分支策略
|
||||
|
||||
- `master` — 稳定版本
|
||||
- `dev` — 开发分支
|
||||
- `feature/*` — 功能分支
|
||||
- `fix/*` — 修复分支
|
||||
|
||||
## 提交规范
|
||||
|
||||
使用语义化提交信息:
|
||||
|
||||
```
|
||||
<type>(<scope>): <description>
|
||||
|
||||
[optional body]
|
||||
```
|
||||
|
||||
类型(type):
|
||||
- `feat`: 新功能
|
||||
- `fix`: 修复 Bug
|
||||
- `docs`: 文档变更
|
||||
- `style`: 代码格式(不影响逻辑)
|
||||
- `refactor`: 重构
|
||||
- `perf`: 性能优化
|
||||
- `test`: 测试相关
|
||||
- `chore`: 构建/工具链变更
|
||||
|
||||
示例:
|
||||
```
|
||||
feat(editor): 添加代码折叠功能
|
||||
fix(tab): 修复关闭标签后焦点丢失问题
|
||||
perf(markdown): 引入 processor LRU 缓存
|
||||
```
|
||||
|
||||
## Pull Request 流程
|
||||
|
||||
1. Fork 仓库并创建功能分支
|
||||
2. 确保所有检查通过:
|
||||
```bash
|
||||
npm run lint # ESLint
|
||||
npm run typecheck # TypeScript 类型检查
|
||||
npm run test # 单元测试
|
||||
```
|
||||
3. 编写清晰的 PR 描述,说明变更内容和原因
|
||||
4. 等待代码审查
|
||||
|
||||
## 添加测试
|
||||
|
||||
- 测试文件放在 `__tests__/` 目录下,命名为 `*.test.ts` 或 `*.test.tsx`
|
||||
- 使用 Vitest + React Testing Library
|
||||
- 至少覆盖 stores、hooks、lib 目录下的核心模块
|
||||
|
||||
```bash
|
||||
# 运行测试
|
||||
npm run test
|
||||
|
||||
# 监听模式
|
||||
npm run test:watch
|
||||
|
||||
# 覆盖率报告
|
||||
npm run test:coverage
|
||||
```
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── main/ # 主进程 (Node.js)
|
||||
├── preload/ # 预加载脚本
|
||||
├── renderer/ # 渲染进程 (React)
|
||||
│ ├── components/ # UI 组件(Toolbar · TabBar · Editor · Sidebar 等)
|
||||
│ ├── stores/ # Zustand 状态管理(tabStore · editorStore · sidebarStore · autoSaveStore)
|
||||
│ ├── hooks/ # 自定义 Hooks(useTheme · useAutoSave · useKeyboard 等)
|
||||
│ ├── lib/ # 工具库(markdown · fileUtils · errorHandler · toast)
|
||||
│ ├── db/ # IndexedDB 持久化(schema · repositories)
|
||||
│ ├── types/ # TypeScript 类型定义
|
||||
│ └── styles/ # 全局样式(variables · global · markdown-body)
|
||||
└── shared/ # 主进程/渲染进程共享(IPC 通道 · 共享类型 · 常量)
|
||||
```
|
||||
|
||||
### 编辑器架构
|
||||
|
||||
MarkLite 使用 [MetonaEditor](https://git.metona.cn/MetonaTeam/MetonaEditor) v0.1.3 作为编辑器核心:
|
||||
|
||||
- **三模式视图**(编辑 / 分屏 / 预览),由 MetonaEditor 内置工具栏切换
|
||||
- **渲染管线**:通过 `render` 钩子接入 unified/rehype 管线,处理图片路径修复和代码高亮
|
||||
- **插件**:searchReplace(搜索替换)+ imagePaste(粘贴图片)
|
||||
- **自动保存**:自定义 `useAutoSave` hook,通过 Electron IPC 保存到文件系统(非 localStorage)
|
||||
- **主题同步**:应用暗色模式与编辑器主题双向同步
|
||||
|
||||
## 许可证
|
||||
|
||||
贡献的代码将遵循项目的 [MIT 许可证](LICENSE)。
|
||||
|
||||
Reference in New Issue
Block a user