@qiangzaifan/commitlint-config-encode 0.0.0-stage → 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 (4) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +40 -2
  3. package/index.js +17 -0
  4. package/package.json +25 -3
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 印客学院
4
+ Copyright (c) 2023 强仔 (modifications)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,41 @@
1
- # Temporary Holding Version
1
+ # `@qiangzaifan/commitlint-config-encode`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > 强仔 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 @qiangzaifan/commitlint-config-encode @commitlint/cli --save-dev
13
+ ```
14
+
15
+ ## 使用
16
+
17
+ 在 `commitlint.config.js` 中集成本包:
18
+
19
+ ```javascript
20
+ module.exports = {
21
+ extends: ['@qiangzaifan/commitlint-config-encode'],
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 CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
2
  "name": "@qiangzaifan/commitlint-config-encode",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "description": "强仔 Git规范",
6
+ "keywords": [
7
+ "encode",
8
+ "commit",
9
+ "lint"
10
+ ],
11
+ "author": "chenghuai",
12
+ "homepage": "https://github.com/qiangzaiFan/fe-spec-project#readme",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/qiangzaiFan/fe-spec-project.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/qiangzaiFan/fe-spec-project/issues"
20
+ },
21
+ "dependencies": {
22
+ "conventional-changelog-conventionalcommits": "^4.5.0"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org/"
27
+ }
6
28
  }