Skip to content

Commit f2bf64a

Browse files
authored
[WIP] Perfect readme (#11)
1 parent 3f08a8a commit f2bf64a

File tree

3 files changed

+115
-7
lines changed

3 files changed

+115
-7
lines changed

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,44 @@
11
# commitlint-wizardoc
2+
3+
English | [中文文档](doc/README-zh.md)
4+
25
commitlint-wizardoc is a configuration package for [commitlint](https://github.com/conventional-changelog/commitlint) that contain some rules and plugins to check that your commit message conform to the `Wizardoc` convention.
36

47
## Usage
8+
59
If you have never used commitlint before, you can visit [commitlint document](https://commitlint.js.org/) for more detail.
610

711
### Install
12+
813
You can install `commitlint-wizardoc` using NPM and YARN as well.
914

1015
```shell
1116
# NPM
12-
npm i commitlint-wizardoc -D
17+
npm i commitlint-config-wizardoc -D
1318

1419
# YARN
15-
yarn add commitlint-wizardoc -D
20+
yarn add commitlint-config-wizardoc -D
1621
```
1722

1823
### Configuration
24+
1925
Create a [commitlint](https://github.com/conventional-changelog/commitlint) config in the root path of your project, and you can extends the `wizardoc` config to do all configuration work.
2026

2127
For instance, create `.commitlintrc.js` that looks like:
2228

2329
```js
2430
module.exports = {
2531
// This line config will read the NPM package named "commitlint-config-wizardoc", so please make sure you have installed it before config this line.
26-
extends: 'wizardoc'
27-
}
32+
extends: "wizardoc",
33+
};
2834
```
2935

3036
Now, that's all you need to do.
3137

3238
## Convention
39+
3340
The commit message should consists of four parts:
41+
3442
```
3543
![Feat::scope] some sentence
3644
^ ^ ^ ^
@@ -54,17 +62,19 @@ The commit message should consists of four parts:
5462
- Update
5563
- Refactor
5664
- Move
57-
- New
65+
- Perf
66+
- Doc
5867
- Add
5968
- Patch
6069
- Fix
6170
- Test
6271
- Stub
6372
- Chore
6473
- `Scope`: scope of modification
65-
- `Subject`: description of the commit
74+
- `Subject`: description of the commit
6675

6776
## Override configs
77+
6878
You can also override `Wizardoc` config to create your own configuration as well.
6979

7080
```js
@@ -78,4 +88,5 @@ module.exports = {
7888
```
7989

8090
## LICENSE
91+
8192
MIT.

doc/README-zh.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# commitlint-wizardoc
2+
3+
[English](/README.md) | 中文文档
4+
5+
commitlint-wizardoc 是 [commitlint](https://github.com/conventional-changelog/commitlint) 的配置包,其中包含某些规则和插件,以检查您的提交`commit-message`是否符合 `Wizardoc` 约定。
6+
7+
## 用法
8+
9+
如果你之前没有使用过 commitlint,你可以前往[commitlint document](https://commitlint.js.org/)来查看更多详情。
10+
11+
### 安装
12+
13+
你可以使用`npm``yarn`来安装`commitlint-wizardoc`
14+
15+
```shell
16+
# NPM
17+
npm i commitlint-config-wizardoc -D
18+
19+
# YARN
20+
yarn add commitlint-config-wizardoc -D
21+
```
22+
23+
### 配置
24+
25+
在你项目的根目录下创建一个[commitlint](https://github.com/conventional-changelog/commitlint)的配置文件,你能通过`extends` `wizardoc``config`文件来完成配置。
26+
27+
例如,将以下代码加入到`.commitlintrc.js`文件。
28+
29+
```js
30+
module.exports = {
31+
// This line config will read the NPM package named "commitlint-config-wizardoc", so please make sure you have installed it before config this line.
32+
extends: "wizardoc",
33+
};
34+
```
35+
36+
只需要做这些,你就可以使用`commitlint-wizardow``commit-message`的校验了。
37+
38+
## 规则
39+
40+
git 的`commit-message`由以下四部分组成:
41+
42+
```
43+
![Feat::scope] some sentence
44+
^ ^ ^ ^
45+
| | | |
46+
| | | |
47+
| | | |- Subject(required)
48+
| | |
49+
| | |- Scope(optional)
50+
| |
51+
| |- Type(required)
52+
|
53+
|- Break change symbol(optional)
54+
```
55+
56+
- `Break change symbol`:在提交破坏性更改的时候,需要使用时候用`Break change symbol`
57+
- `Type``commit-message``Type`必须是以下类型之一。
58+
59+
| 规范名 | 描述 |
60+
| -------- | -------------------------------- |
61+
| Feat | 新增新功能 |
62+
| Init | 新建项目时,对项目的初始化 |
63+
| Remove | 代码的改动(删除),粒度较小 |
64+
| Delete | 文件的改动(删除),粒度较大 |
65+
| Update | 代码块的修改 |
66+
| Refactor | 代码重构 |
67+
| Move | 移动文件位置 |
68+
| Perf | 优化相关,比如提升性能、体验 |
69+
| Doc | 文档相关的修改 |
70+
| Add | 规模较小的新增 |
71+
| Patch | 增加逻辑块为了修复某一个逻辑错误 |
72+
| Fix | 修复 bug |
73+
| Test | 覆盖测试用例 |
74+
| Stub | 桩代码用于临时测试 |
75+
| Chore | 小修改,修复,一些琐碎的小事情 |
76+
77+
- `Scope`: 修改的模块。
78+
- `Subject`: 提交的具体描述信息。
79+
80+
## 覆盖配置
81+
82+
你可以覆盖 `Wizardoc` 的配置,来创建自己的配置
83+
84+
```js
85+
module.exports = {
86+
extends: 'wizardoc',
87+
rules: [
88+
// Set the $ as the third parameter if you wanna change break symbol to $
89+
"break-change-prefix": [2, "always", '$'],
90+
]
91+
}
92+
```
93+
94+
## LICENSE
95+
96+
MIT.

packages/commitlint-config-wizardoc/src/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ export enum CommitType {
1414
UPDATE = "Update",
1515
REFACTOR = "Refactor",
1616
MOVE = "Move",
17-
NEW = "New",
1817
ADD = "Add",
1918
PATCH = "Patch",
2019
FIX = "Fix",
2120
TEST = "Test",
2221
STUB = "Stub",
2322
CHORE = "Chore",
23+
PERF = "Perf",
24+
DOC = "Doc",
2425
}
2526

2627
export const CONVERSION_MATCH_REGEX = /^(.?)\[(\w+?)(?:\:\:(\w*))?\]\s(.*)$/;

0 commit comments

Comments
 (0)