From f2bf64a4a472e6ab40dc9a6e3944ea828202041a Mon Sep 17 00:00:00 2001 From: blues <37956833+z825316969@users.noreply.github.com> Date: Mon, 31 May 2021 19:49:22 +0800 Subject: [PATCH 1/4] [WIP] Perfect readme (#11) --- README.md | 23 +++-- doc/README-zh.md | 96 +++++++++++++++++++ .../src/constants.ts | 3 +- 3 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 doc/README-zh.md diff --git a/README.md b/README.md index 065e77c..d892fb6 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,27 @@ # commitlint-wizardoc + +English | [中文文档](doc/README-zh.md) + 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. ## Usage + If you have never used commitlint before, you can visit [commitlint document](https://commitlint.js.org/) for more detail. ### Install + You can install `commitlint-wizardoc` using NPM and YARN as well. ```shell # NPM -npm i commitlint-wizardoc -D +npm i commitlint-config-wizardoc -D # YARN -yarn add commitlint-wizardoc -D +yarn add commitlint-config-wizardoc -D ``` ### Configuration + 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. For instance, create `.commitlintrc.js` that looks like: @@ -23,14 +29,16 @@ For instance, create `.commitlintrc.js` that looks like: ```js module.exports = { // This line config will read the NPM package named "commitlint-config-wizardoc", so please make sure you have installed it before config this line. - extends: 'wizardoc' -} + extends: "wizardoc", +}; ``` Now, that's all you need to do. ## Convention + The commit message should consists of four parts: + ``` ![Feat::scope] some sentence ^ ^ ^ ^ @@ -54,7 +62,8 @@ The commit message should consists of four parts: - Update - Refactor - Move - - New + - Perf + - Doc - Add - Patch - Fix @@ -62,9 +71,10 @@ The commit message should consists of four parts: - Stub - Chore - `Scope`: scope of modification -- `Subject`: description of the commit +- `Subject`: description of the commit ## Override configs + You can also override `Wizardoc` config to create your own configuration as well. ```js @@ -78,4 +88,5 @@ module.exports = { ``` ## LICENSE + MIT. diff --git a/doc/README-zh.md b/doc/README-zh.md new file mode 100644 index 0000000..1da0f15 --- /dev/null +++ b/doc/README-zh.md @@ -0,0 +1,96 @@ +# commitlint-wizardoc + +[English](/README.md) | 中文文档 + +commitlint-wizardoc 是 [commitlint](https://github.com/conventional-changelog/commitlint) 的配置包,其中包含某些规则和插件,以检查您的提交`commit-message`是否符合 `Wizardoc` 约定。 + +## 用法 + +如果你之前没有使用过 commitlint,你可以前往[commitlint document](https://commitlint.js.org/)来查看更多详情。 + +### 安装 + +你可以使用`npm`和`yarn`来安装`commitlint-wizardoc`。 + +```shell +# NPM +npm i commitlint-config-wizardoc -D + +# YARN +yarn add commitlint-config-wizardoc -D +``` + +### 配置 + +在你项目的根目录下创建一个[commitlint](https://github.com/conventional-changelog/commitlint)的配置文件,你能通过`extends` `wizardoc`的`config`文件来完成配置。 + +例如,将以下代码加入到`.commitlintrc.js`文件。 + +```js +module.exports = { + // This line config will read the NPM package named "commitlint-config-wizardoc", so please make sure you have installed it before config this line. + extends: "wizardoc", +}; +``` + +只需要做这些,你就可以使用`commitlint-wizardow`的`commit-message`的校验了。 + +## 规则 + +git 的`commit-message`由以下四部分组成: + +``` +![Feat::scope] some sentence +^ ^ ^ ^ +| | | | +| | | | +| | | |- Subject(required) +| | | +| | |- Scope(optional) +| | +| |- Type(required) +| +|- Break change symbol(optional) +``` + +- `Break change symbol`:在提交破坏性更改的时候,需要使用时候用`Break change symbol`。 +- `Type`:`commit-message`的`Type`必须是以下类型之一。 + + | 规范名 | 描述 | + | -------- | -------------------------------- | + | Feat | 新增新功能 | + | Init | 新建项目时,对项目的初始化 | + | Remove | 代码的改动(删除),粒度较小 | + | Delete | 文件的改动(删除),粒度较大 | + | Update | 代码块的修改 | + | Refactor | 代码重构 | + | Move | 移动文件位置 | + | Perf | 优化相关,比如提升性能、体验 | + | Doc | 文档相关的修改 | + | Add | 规模较小的新增 | + | Patch | 增加逻辑块为了修复某一个逻辑错误 | + | Fix | 修复 bug | + | Test | 覆盖测试用例 | + | Stub | 桩代码用于临时测试 | + | Chore | 小修改,修复,一些琐碎的小事情 | + +- `Scope`: 修改的模块。 +- `Subject`: 提交的具体描述信息。 + +## 覆盖配置 + +你可以覆盖 `Wizardoc` 的配置,来创建自己的配置 + +```js +module.exports = { + extends: 'wizardoc', + rules: [ + // Set the $ as the third parameter if you wanna change break symbol to $ + "break-change-prefix": [2, "always", '$'], + ] +} +``` + +## LICENSE + +MIT. diff --git a/packages/commitlint-config-wizardoc/src/constants.ts b/packages/commitlint-config-wizardoc/src/constants.ts index 9be4791..7190071 100644 --- a/packages/commitlint-config-wizardoc/src/constants.ts +++ b/packages/commitlint-config-wizardoc/src/constants.ts @@ -14,13 +14,14 @@ export enum CommitType { UPDATE = "Update", REFACTOR = "Refactor", MOVE = "Move", - NEW = "New", ADD = "Add", PATCH = "Patch", FIX = "Fix", TEST = "Test", STUB = "Stub", CHORE = "Chore", + PERF = "Perf", + DOC = "Doc", } export const CONVERSION_MATCH_REGEX = /^(.?)\[(\w+?)(?:\:\:(\w*))?\]\s(.*)$/; From 97c8b29ff13d0d1e8f438de3fbc8a152ad73d533 Mon Sep 17 00:00:00 2001 From: blues <37956833+z825316969@users.noreply.github.com> Date: Mon, 31 May 2021 22:29:45 +0800 Subject: [PATCH 2/4] [Fix::readme] adjustment commitlint-wizardoc description (#12) --- doc/README-zh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README-zh.md b/doc/README-zh.md index 1da0f15..cc0d750 100644 --- a/doc/README-zh.md +++ b/doc/README-zh.md @@ -2,7 +2,7 @@ [English](/README.md) | 中文文档 -commitlint-wizardoc 是 [commitlint](https://github.com/conventional-changelog/commitlint) 的配置包,其中包含某些规则和插件,以检查您的提交`commit-message`是否符合 `Wizardoc` 约定。 +commitlint-wizardoc 是包含某些规则和插件[commitlint](https://github.com/conventional-changelog/commitlint) 的配置包,他可以检查你提交的`commit-message`是否符合 `Wizardoc` 约定。 ## 用法 From 4973e9d2b826448ee9bc4e416d5d23f960d87f4c Mon Sep 17 00:00:00 2001 From: Mist Date: Tue, 20 Feb 2024 15:17:25 +0800 Subject: [PATCH 3/4] v1.0.1 --- packages/commitlint-config-wizardoc/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/commitlint-config-wizardoc/package.json b/packages/commitlint-config-wizardoc/package.json index 2f68b56..2f040bf 100644 --- a/packages/commitlint-config-wizardoc/package.json +++ b/packages/commitlint-config-wizardoc/package.json @@ -1,6 +1,6 @@ { "name": "commitlint-config-wizardoc", - "version": "1.0.0", + "version": "1.0.1", "main": "dist/index.js", "license": "MIT", "scripts": { From 0edf4c895ca6f5a39e388fcaa9351d6ce74ba5a1 Mon Sep 17 00:00:00 2001 From: Mist Date: Tue, 20 Feb 2024 15:19:09 +0800 Subject: [PATCH 4/4] [Feat] add release type --- packages/commitlint-config-wizardoc/src/constants.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/commitlint-config-wizardoc/src/constants.ts b/packages/commitlint-config-wizardoc/src/constants.ts index 7190071..4a72857 100644 --- a/packages/commitlint-config-wizardoc/src/constants.ts +++ b/packages/commitlint-config-wizardoc/src/constants.ts @@ -22,6 +22,7 @@ export enum CommitType { CHORE = "Chore", PERF = "Perf", DOC = "Doc", + RELEASE = "Release", } export const CONVERSION_MATCH_REGEX = /^(.?)\[(\w+?)(?:\:\:(\w*))?\]\s(.*)$/;