Skip to content

Commit

Permalink
docs: add CONTRIBUTING.md (#114)
Browse files Browse the repository at this point in the history
* docs: add CONTRIBUTING.md
  • Loading branch information
DarrenY authored Apr 1, 2020
1 parent 2661f0b commit 0ffd5b2
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 0 deletions.
107 changes: 107 additions & 0 deletions COMMIT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
## 1.总结
Commit信息需要能通过如下正则校验:
```
/^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore)(\(.+\))?: .{1,50}/
```
## 2.完整规范的提交信息格式
Commit信息规范的格式:
```
<type>(<scope>): <subject>
<空行>
<body>
<空行>
<footer>
```
一个完整的Commit信息包含如下三部分:
* header(格式中的第一行`<type>(<scope>): <subject>`)
* body
* footer


其中`header`是必须的,`body``footer`是可选的

header主要包含:
* type(commit类别,详细解释参考2.1)
* scope(影响范围)
* subject(提交信息)

其中`type``subject`是必须的,`scope`是可选的

如果是回滚某个commit信息需要使用 `revert:`开头,后面加的是需要回滚的commit信息,同时在body部分应该写上本次revert的`commit hash:This reverts commit <hash>.`

```
revert:<type>(<scope>): <subject>
<空行>
<body>
<空行>
<footer>
```
2.1 header中type的可选指如下:
Type对应使用场景:


| Commit Type | Description |
| :---------- | ------------------------------------------------------------ |
| feat | 新增功能 |
| fix | 修复问题 |
| polish | 优化某部分功能 |
| docs | 文档更新 |
| style | 格式化,代码格式规范修改 |
| refactor | 重构某一部分功能 |
| perf | 性能提升的改动 |
| test | 单元测试相关更新 |
| workflow | 工作流,脚手架 |
| ci | 持续集成相关 |
| chore | 其他不影响代码的改动的操作,如:更新文档页面赞助商信息,更新贡献者信息等 |


### 2.2 scope
指定改动的范围,尽可能精确到我们改动的内容、如(component、core、dashborad、template、request)如果涉及到多个
### 2.3 subject
主题主要包括一个简洁的改动信息,需要遵循如下规则
>* 使用现在式,如使用change、不使用changed或者changes
* 不用大写第一个字符
* 结尾不要加.
* 冒号后需要加一个空格
* 尽量不要加标点符号

### 2.4 body
Body中需要包含修改的背景以及与之前的差异

### 2.5 footer
Footer主要包含重大更新的信息或者关联的GitHub issues信息。
1)关联的GitHub issues:
```
fix(workflow): handle project init error on linux for scaffold
close #28
```

2)重大更新:
```
perf(core): imporve header render by removing 'logo' option
BREAKING CHANGE: The 'logo' option has been removed from header conf.
```


## 3.示例
### 3.1 组件中新增新功能
```
feat(component): add nodata tip for nvtrend
```
### 3.2 修复脚手架Bug
```
fix(workflow): handle project init error on linux for scaffold
```
### 3.3 文档更新
```
docs: fix link for logo
```
### 3.4 回滚组件更新
```
revert: feat(component): add nodata tip for nvtrend
This reverts commit e80a92447717dc9cc9187a14e469a38c164a8600.
```
48 changes: 48 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# NoahV贡献指南

感谢使用NoahV,NoahV是一个基于Vue技术栈的前端开发框架,旨在通过工程化(脚手架、开发联调工具、编译构建等)和组件化(业务组件、页面模版、仪表盘)两个维度来帮助开发者提升前端开发效率,主要适用于运维、监控、数据报表等常见的后台管理系统。

如果你愿意为 NoahV 贡献代码或提供建议,请阅读以下内容。

## 1.前言

在贡献代码或提供建议前请先了解下NoahV开源代码的目录结构:

NoahV开源代码主要包括5个大块,分别是:组件库、功能模块(导航栏/页面布局配置功能、多语言、数据模拟、数据请求、运行统计)、项目模版、脚手架、使用文档,他们分别对应的目录是:

- components(组件库)
- common (包含业务组件和模版)
- visual (可视化组件)
-
- packages (功能模块)
- noahv-core (处理框架的启动相关功能)
- noahv-i18n (多语言)
- noahv-mockup (处理模拟数据)
- noahv-request (封装数据请求)
- noahv-tongji (数据统计)
-
- template (项目模板)
- common (通用项目模版)
- dashboard (包含仪表盘功能的项目模版)
- common-ts (通用项目模版 Typescript 版本)
-
- tools/noahv-cli (脚手架)
- doc (使用文档)

## 2.Pull Request 规范

- 1.fork 一份 NoahV 的完整代码到自己的 Github 上。
- 2.将 fork 的代码 clone 到本地,进行修改。
- 3.按照[commit信息填写规范](./COMMIT.md)填写 commit 信息。
- 4.提交 PR 前请 rebase。
- 5.PR 请提交到 dev 分支,直接提交到 master 分支的 PR 会被 drop。
- 6.请在 PR 中尽可能详细的描述提交代码所解决的问题。


## 3.Issue 规范

- 1.在提交 issue 前可以先搜索下是否已有相关的 issue。
- 2.如果是程序运行报错,请提供下使用的 NoahV 的版本以及当前系统的版本信息。
- 3.issue 标题要尽可能简短的描述遇到的问题,请不要创建无意义的 issue 标题。


3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ $ noahv create
| ---------- | ------------------------------------------------------------ |
| <img src="https://noahv.cdn.bcebos.com/github%2Ff414efb2572218cd6756ca483.jpg" width="120px"> | [issues](https://github.com/baidu/NoahV/issues) |

## 参与共建

欢迎大家一起参与NoahV的共建,详情请参考[贡献指南](./CONTRIBUTING.md).

## License

Expand Down
5 changes: 5 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ $ noahv create
# Choose page type According to the hint,support form,list,filterlist,chart at present
```

## Contribution

Please make sure to read the [Contributing Guide](./CONTRIBUTING.md) before making a pull request.


## Document

* [Quickstart](https://baidu.github.io/NoahV/#/guide/quickstart)
Expand Down

0 comments on commit 0ffd5b2

Please sign in to comment.