Skip to content

Commit 6ffb216

Browse files
authored
feat: commitlint (#17)
* feat(package): switch from `simple-git-hooks` to `husky` * feat: commitlint
1 parent f2ee0d7 commit 6ffb216

File tree

6 files changed

+355
-39
lines changed

6 files changed

+355
-39
lines changed

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm dlx commitlint --edit $1

changelog.preset.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import createPreset, { DEFAULT_COMMIT_TYPES } from 'conventional-changelog-conventionalcommits';
2+
3+
const types = DEFAULT_COMMIT_TYPES.map((it) => {
4+
if (['docs', 'refactor'].includes(it.type)) {
5+
return { ...it, hidden: false };
6+
}
7+
return { ...it };
8+
});
9+
10+
export { types };
11+
export default createPreset({ types });

commitlint.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { RuleConfigSeverity } from '@commitlint/types';
2+
import { types } from './changelog.preset.js';
3+
4+
export default {
5+
extends: ['@commitlint/config-conventional'],
6+
rules: {
7+
'type-enum': [RuleConfigSeverity.Error, 'always', types.map((it) => it.type)],
8+
},
9+
};

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"npmClient": "pnpm",
55
"version": "0.2.0-rc.0",
66
"conventionalCommits": true,
7-
"changelogPreset": "conventionalcommits",
7+
"changelogPreset": "./changelog.preset.js",
88
"preid": "rc",
99
"preDistTag": "next",
1010
"createRelease": "github"

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"prepare": "husky"
2323
},
2424
"devDependencies": {
25+
"@commitlint/cli": "^19.5.0",
26+
"@commitlint/config-conventional": "^19.5.0",
27+
"@commitlint/types": "^19.5.0",
2528
"@eslint/js": "^9.10.0",
2629
"@lerna-lite/cli": "^3.10.0",
2730
"@lerna-lite/publish": "^3.10.0",

0 commit comments

Comments
 (0)