Skip to content

Commit fc1b0b2

Browse files
Copilot8enSmith
andcommitted
docs: enhance commit message format documentation and add validation
- Expanded README with detailed conventional commit format explanation - Added @commitlint/cli and @commitlint/config-conventional for validation - Created commitlint.config.cjs with strict conventional commit rules - Added commit-msg hook to automatically validate commit messages - Added commitlint script to package.json for manual validation - Documented importance of commit format for semantic versioning Co-authored-by: 8enSmith <798183+8enSmith@users.noreply.github.com>
1 parent 55c1269 commit fc1b0b2

File tree

5 files changed

+842
-4
lines changed

5 files changed

+842
-4
lines changed

.husky/commit-msg

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

README.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,51 @@ For the automated release workflow to function, the following secrets must be co
275275

276276
#### Commit Message Format
277277

278-
- `feat:` - new features (triggers minor version bump)
279-
- `fix:` - bug fixes (triggers patch version bump)
280-
- `feat!:` or `fix!:` - breaking changes (triggers major version bump)
281-
- `docs:`, `style:`, `refactor:`, `test:`, `chore:` - no version bump
278+
**⚠️ Important:** This project uses automated semantic versioning. The commit message format directly determines version bumps and changelog generation.
279+
280+
The project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification. Each commit message must be structured as:
281+
282+
```
283+
<type>[optional scope]: <description>
284+
285+
[optional body]
286+
287+
[optional footer(s)]
288+
```
289+
290+
**Supported commit types:**
291+
- `feat:` - new features (triggers **minor** version bump: 1.0.0 → 1.1.0)
292+
- `fix:` - bug fixes (triggers **patch** version bump: 1.0.0 → 1.0.1)
293+
- `feat!:` or `fix!:` - breaking changes (triggers **major** version bump: 1.0.0 → 2.0.0)
294+
- `docs:`, `style:`, `refactor:`, `test:`, `chore:` - maintenance (no version bump)
295+
296+
**Examples:**
297+
```
298+
feat: add new search functionality
299+
fix: resolve timeout issue in API calls
300+
feat!: remove deprecated getBook method
301+
docs: update API documentation
302+
```
303+
304+
**Why this matters:**
305+
- ✅ Proper format → Automatic version bump and release
306+
- ❌ Wrong format → No release, manual intervention required
307+
- 📝 Commit messages become the public changelog
308+
309+
The project validates commit messages automatically to ensure releases work correctly.
310+
311+
#### Development Workflow
312+
313+
The project includes automatic validation to ensure proper commit message format:
314+
315+
- **Pre-commit hooks** validate code quality with linting and tests
316+
- **Commit message validation** ensures conventional commit format using [commitlint](https://commitlint.js.org/)
317+
- **Invalid commit messages** are rejected before they reach the repository
318+
319+
To manually validate a commit message:
320+
```bash
321+
npm run commitlint
322+
```
282323

283324
## Contributing
284325

commitlint.config.cjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'type-enum': [
5+
2,
6+
'always',
7+
[
8+
'feat',
9+
'fix',
10+
'docs',
11+
'style',
12+
'refactor',
13+
'test',
14+
'chore',
15+
'revert'
16+
]
17+
],
18+
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']],
19+
'subject-empty': [2, 'never'],
20+
'subject-full-stop': [2, 'never', '.'],
21+
'header-max-length': [2, 'always', 72]
22+
}
23+
};

0 commit comments

Comments
 (0)