versot-fe-commitlint-config 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +41 -0
  2. package/index.js +17 -0
  3. package/package.json +25 -0
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # `versot-fe-commitlint-config`
2
+
3
+ > Versot Git 规范
4
+
5
+ 支持配套的 [commitlint 配置](https://commitlint.js.org/#/concepts-shareable-config),用于对 `git commit message` 进行校验。
6
+
7
+ ## 安装
8
+
9
+ 使用时,需要安装 [@commitlint/cli](https://www.npmjs.com/package/@commitlint/cli):
10
+
11
+ ```bash
12
+ npm install versot-fe-commitlint-config @commitlint/cli --save-dev
13
+ ```
14
+
15
+ ## 使用
16
+
17
+ 在 `commitlint.config.js` 中集成本包:
18
+
19
+ ```javascript
20
+ module.exports = {
21
+ extends: ['versot-fe-commitlint-config'],
22
+ };
23
+ ```
24
+
25
+ ## 设置 git hook
26
+
27
+ 可通过 [husky](https://www.npmjs.com/package/husky) 设置在 `git commit` 时触发 `commitlint`。
28
+
29
+ 首先安装 husky:
30
+
31
+ ```bash
32
+ npm install husky --save-dev
33
+ ```
34
+
35
+ 然后执行添加`commit-msg`:
36
+
37
+ ```bash
38
+ npx husky add .husky/commit-msg 'npx commitlint --edit $1'
39
+ ```
40
+
41
+ 更多信息可参考 [commitlint 文档](https://commitlint.js.org/#/guides-local-setup?id=install-husky)。
package/index.js ADDED
@@ -0,0 +1,17 @@
1
+ module.exports = {
2
+ parserPreset: 'conventional-changelog-conventionalcommits',
3
+ rules: {
4
+ 'body-leading-blank': [1, 'always'],
5
+ 'body-max-line-length': [2, 'always', 100],
6
+ 'footer-leading-blank': [1, 'always'],
7
+ 'footer-max-line-length': [2, 'always', 100],
8
+ 'header-max-length': [2, 'always', 100],
9
+ 'scope-case': [2, 'always', 'lower-case'],
10
+ 'subject-case': [0],
11
+ 'subject-empty': [2, 'never'],
12
+ 'subject-full-stop': [2, 'never', '.'],
13
+ 'type-case': [2, 'always', 'lower-case'],
14
+ 'type-empty': [2, 'never'],
15
+ 'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'test', 'refactor', 'chore', 'revert']],
16
+ },
17
+ };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "versot-fe-commitlint-config",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "description": "Versot Git规范",
6
+ "keywords": [
7
+ "versot",
8
+ "commit",
9
+ "lint"
10
+ ],
11
+ "author": "versot",
12
+ "homepage": "https://github.com/versot/fe-spec#readme",
13
+ "license": "ISC",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/versot/fe-spec.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/versot/fe-spec/issues"
20
+ },
21
+ "dependencies": {
22
+ "conventional-changelog-conventionalcommits": "^4.5.0"
23
+ },
24
+ "gitHead": "dd3dfa6beb90d392a6b1775eed96f33e29d7cea2"
25
+ }