- 集成 MetonaToast v2.0.0 替换自研 Toast 组件(右上角、进度条、自动关闭、主题联动) - 修复 sidebar resize 未持久化到 IndexedDB - 修复 Ctrl+Tab MRU 切换逻辑与文档不一致 - 完善 WYSIWYG 模式标签切换选区恢复 - 清理死代码(useActiveHeading observerRef、旧 Toast 样式、重复滚动条样式、SearchReplace 重复检查) - 同步 DESIGN.md / docs 文档(CodeMirror→Milkdown、stores 计数、editorStore 字段) - 新增 .npmrc.example 模板 - 更新关于对话框与文档远程地址为 Gitea - 版本号 0.3.12 → 0.3.13
2.4 KiB
2.4 KiB
贡献指南
感谢你对 MarkLite 项目的关注!以下是参与贡献的指南。
开发环境
-
前置要求
- Node.js >= 18.x
- npm >= 9.x
- Windows 10/11 x64
-
克隆并安装
git clone https://git.metona.cn/MetonaTeam/MarkLite.git cd MarkLite npm install -
启动开发
npm run dev
代码规范
- TypeScript: 严格模式,所有函数参数需显式类型标注
- ESLint: 提交前确保
npm run lint通过 - Prettier: 提交前确保
npm run format:check通过 - Git Hooks: pre-commit 自动执行 ESLint + typecheck
分支策略
main— 稳定版本dev— 开发分支feature/*— 功能分支fix/*— 修复分支
提交规范
使用语义化提交信息:
<type>(<scope>): <description>
[optional body]
类型(type):
feat: 新功能fix: 修复 Bugdocs: 文档变更style: 代码格式(不影响逻辑)refactor: 重构perf: 性能优化test: 测试相关chore: 构建/工具链变更
示例:
feat(editor): 添加代码折叠功能
fix(tab): 修复关闭标签后焦点丢失问题
perf(markdown): 引入 processor LRU 缓存
Pull Request 流程
- Fork 仓库并创建功能分支
- 确保所有检查通过:
npm run lint # ESLint npm run typecheck # TypeScript 类型检查 npm run test # 单元测试 - 编写清晰的 PR 描述,说明变更内容和原因
- 等待代码审查
添加测试
- 测试文件放在
__tests__/目录下,命名为*.test.ts或*.test.tsx - 使用 Vitest + React Testing Library
- 至少覆盖 stores、hooks、lib 目录下的核心模块
# 运行测试
npm run test
# 监听模式
npm run test:watch
# 覆盖率报告
npm run test:coverage
项目结构
src/
├── main/ # 主进程 (Node.js)
├── preload/ # 预加载脚本
├── renderer/ # 渲染进程 (React)
│ ├── components/ # UI 组件
│ ├── stores/ # Zustand 状态管理
│ ├── hooks/ # 自定义 Hooks
│ ├── lib/ # 工具库
│ ├── db/ # IndexedDB 持久化
│ ├── types/ # TypeScript 类型
│ └── styles/ # 全局样式
└── shared/ # 主进程/渲染进程共享
许可证
贡献的代码将遵循项目的 MIT 许可证。