diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5ffe2c4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,89 @@ +# Contributing to Math++ Client + +感谢你有兴趣参与贡献!以下是开发设置和贡献流程。 + +## 开发环境 + +### 前置要求 +- Node.js >= 18 +- npm + +### 安装 + +```bash +# 克隆项目 +git clone https://github.com/iamtouchskyer/math-project-client.git +cd math-project-client + +# 安装依赖 +npm install + +# 启动开发服务器 +npm start +``` + +开发服务器默认运行在 http://localhost:3000(Vite)。 + +后端 API 默认连接 http://localhost:8888,参考 `.env.example` 配置。 + +## 代码规范 + +项目已配置 ESLint 和 Prettier: + +```bash +# 检查代码风格 +npm run lint + +# 自动修复 +npm run lint:fix + +# 格式化代码 +npm run format +``` + +## 测试 + +```bash +# 运行测试 +npm test + +# 运行测试并生成覆盖率报告 +npm run test:coverage +``` + +## 提交流程 + +1. Fork 本仓库 +2. 创建特性分支:`git checkout -b feat/your-feature` +3. 确保 lint 和 test 通过 +4. 提交更改,使用清晰的 commit message +5. 发起 Pull Request 到 `main` 分支 + +### Commit 规范 + +``` +feat: 新功能 +fix: 修复 bug +docs: 文档更新 +style: 代码格式(不影响功能) +refactor: 重构 +test: 测试相关 +chore: 构建/工具相关 +``` + +## 项目结构 + +``` +src/ +├── api/ # API 请求封装 +├── components/ # 可复用组件 +├── context/ # React Context +├── hooks/ # 自定义 Hooks +├── pages/ # 页面组件 +├── redux/ # 状态管理 +└── i18n/ # 国际化 +``` + +## 报告问题 + +发现 bug 或有改进建议?请在 GitHub Issues 中反馈。