@gitlode/plugin-conventional-commits 0.2.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.
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tomo-waka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @gitlode/plugin-conventional-commits
|
|
2
|
+
|
|
3
|
+
Parse commit messages with [conventional-commits-parser](https://www.npmjs.com/package/conventional-commits-parser) and write the parsed result under
|
|
4
|
+
`extensions["conventional-commits"]` in every gitlode output record.
|
|
5
|
+
|
|
6
|
+
The plugin uses the commit message from the source commit for both commit facts and file-change
|
|
7
|
+
facts, so the same parsed payload is available on both record types.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @gitlode/plugin-conventional-commits
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Configure gitlode with `--config`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"version": 1,
|
|
22
|
+
"extensions": {
|
|
23
|
+
"conventional-commits": {
|
|
24
|
+
"entrypoint": "@gitlode/plugin-conventional-commits"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Run gitlode:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
gitlode -r main --config ./gitlode.config.json ./my-repo
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Each emitted record will include:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"extensions": {
|
|
41
|
+
"conventional-commits": {
|
|
42
|
+
"merge": null,
|
|
43
|
+
"revert": null,
|
|
44
|
+
"header": "feat(parser): add plugin docs",
|
|
45
|
+
"body": "Expand README and CHANGELOG.",
|
|
46
|
+
"footer": "Refs: #123",
|
|
47
|
+
"notes": [],
|
|
48
|
+
"mentions": [],
|
|
49
|
+
"references": [
|
|
50
|
+
{
|
|
51
|
+
"raw": "Refs: #123",
|
|
52
|
+
"action": null,
|
|
53
|
+
"owner": null,
|
|
54
|
+
"repository": null,
|
|
55
|
+
"prefix": "#",
|
|
56
|
+
"issue": "123"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"type": "feat",
|
|
60
|
+
"scope": "parser",
|
|
61
|
+
"subject": "add plugin docs"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The exact payload shape follows the upstream `conventional-commits-parser` result. Common fields
|
|
68
|
+
include `type`, `scope`, `subject`, `body`, `footer`, `notes`, `mentions`, and `references`.
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
This plugin does not define any plugin-specific configuration.
|
|
73
|
+
|
|
74
|
+
You can omit `config` entirely:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"version": 1,
|
|
79
|
+
"extensions": {
|
|
80
|
+
"conventional-commits": {
|
|
81
|
+
"entrypoint": "@gitlode/plugin-conventional-commits"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Compatibility
|
|
88
|
+
|
|
89
|
+
This package declares:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
"peerDependencies": {
|
|
93
|
+
"gitlode": "^0.7.0"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If the running gitlode version does not satisfy this range, gitlode emits a warning and continues.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
[MIT](LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AAE3E,QAAA,MAAM,OAAO,EAAE,aAed,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommitParser } from "conventional-commits-parser";
|
|
2
|
+
const factory = async () => {
|
|
3
|
+
let parser;
|
|
4
|
+
return {
|
|
5
|
+
async init() {
|
|
6
|
+
parser = new CommitParser();
|
|
7
|
+
return { type: "ready" };
|
|
8
|
+
},
|
|
9
|
+
async project(context) {
|
|
10
|
+
const { fact } = context;
|
|
11
|
+
const commit = fact.type === "commit" ? fact : fact.commit;
|
|
12
|
+
const parsedCommit = parser.parse(commit.message);
|
|
13
|
+
return { type: "success", data: parsedCommit };
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default factory;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,MAAM,OAAO,GAAkB,KAAK,IAAI,EAAE;IACxC,IAAI,MAAgC,CAAC;IACrC,OAAO;QACL,KAAK,CAAC,IAAI;YACR,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;YAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,OAA0B;YACtC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;YACzB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;YAC3D,MAAM,YAAY,GAAG,MAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAEnD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gitlode/plugin-conventional-commits",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Official gitlode plugin for parsing conventional commits",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"gitlode",
|
|
7
|
+
"gitlode-plugin",
|
|
8
|
+
"plugin"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/gitlode/gitlode#readme",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/gitlode/gitlode.git"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"build:watch": "tsc --watch",
|
|
26
|
+
"format:check": "oxfmt --check",
|
|
27
|
+
"format:write": "oxfmt",
|
|
28
|
+
"lint": "oxlint",
|
|
29
|
+
"lint:fix": "oxlint --fix",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:watch": "vitest",
|
|
32
|
+
"test:coverage": "vitest run --coverage"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"conventional-commits-parser": "^6.4.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"gitlode": "^0.7.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"gitlode": "^0.7.0"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|