Skip to content

Commit 453acbc

Browse files
authored
Merge pull request #897 from vansh-codes/feat/git-commit-system
ci: 🎡 Add git cz and commitizen library for consistent commits
2 parents c6985e8 + 1f1a142 commit 453acbc

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

.husky/prepare-commit-msg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec < /dev/tty && node_modules/.bin/cz --hook || true

changelog.config.mjs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
const config = {
2+
disableEmoji: false,
3+
format: '{type}{scope}: {emoji}{subject}',
4+
list: ['test', 'feat', 'fix', 'chore', 'docs', 'refactor', 'style', 'ci', 'perf'],
5+
maxMessageLength: 64,
6+
minMessageLength: 3,
7+
questions: ['type', 'scope', 'subject', 'body', 'breaking', 'issues', 'lerna'],
8+
scopes: [],
9+
types: {
10+
chore: {
11+
description: 'Build process or auxiliary tool changes',
12+
emoji: '🤖',
13+
value: 'chore'
14+
},
15+
ci: {
16+
description: 'CI related changes',
17+
emoji: '🎡',
18+
value: 'ci'
19+
},
20+
docs: {
21+
description: 'Documentation only changes',
22+
emoji: '✏️',
23+
value: 'docs'
24+
},
25+
feat: {
26+
description: 'A new feature',
27+
emoji: '🎸',
28+
value: 'feat'
29+
},
30+
fix: {
31+
description: 'A bug fix',
32+
emoji: '🐛',
33+
value: 'fix'
34+
},
35+
perf: {
36+
description: 'A code change that improves performance',
37+
emoji: '⚡️',
38+
value: 'perf'
39+
},
40+
refactor: {
41+
description: 'A code change that neither fixes a bug or adds a feature',
42+
emoji: '💡',
43+
value: 'refactor'
44+
},
45+
release: {
46+
description: 'Create a release commit',
47+
emoji: '🏹',
48+
value: 'release'
49+
},
50+
style: {
51+
description: 'Markup, white-space, formatting, missing semi-colons...',
52+
emoji: '💄',
53+
value: 'style'
54+
},
55+
test: {
56+
description: 'Adding missing tests',
57+
emoji: '💍',
58+
value: 'test'
59+
},
60+
messages: {
61+
type: 'Select the type of change that you\'re committing:',
62+
customScope: 'Select the scope this component affects:',
63+
subject: 'Write a short, imperative mood description of the change:\n',
64+
body: 'Provide a longer description of the change:\n ',
65+
breaking: 'List any breaking changes:\n',
66+
footer: 'Issues this commit closes, e.g #123:',
67+
confirmCommit: 'The packages that this commit has affected\n',
68+
},
69+
}
70+
};
71+
72+
export default config;

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@
7979
"@typescript-eslint/eslint-plugin": "^8.45.0",
8080
"@typescript-eslint/parser": "^8.45.0",
8181
"autoprefixer": "^10.4.21",
82+
"commitizen": "^4.3.1",
8283
"eslint": "^8.57.1",
8384
"eslint-config-prettier": "^10.1.8",
8485
"eslint-plugin-prettier": "^5.5.4",
8586
"eslint-plugin-react": "^7.37.5",
87+
"git-cz": "^4.9.0",
8688
"husky": "^9.1.7",
8789
"lint-staged": "^16.2.3",
8890
"postcss": "^8.5.3",
@@ -104,5 +106,10 @@
104106
},
105107
"engines": {
106108
"node": ">=18.0"
109+
},
110+
"config": {
111+
"commitizen": {
112+
"path": "git-cz"
113+
}
107114
}
108115
}

0 commit comments

Comments
 (0)