@satyajit_me/changelog-generator
v1.0.1
Published
Parse conventional commits and generate markdown changelogs
Maintainers
Readme
Changelog Generator
Parse conventional commits and generate markdown changelogs.
Installation
npm install changelog-generatorUsage
import { generate, parseCommit, bumpVersion } from 'changelog-generator';API
Generate Changelog
// Generate from git history
const changelog = generate({
from: 'v1.0.0', // Starting tag (optional)
to: 'HEAD', // Ending ref
version: '1.1.0', // Version for header
repoUrl: 'https://github.com/user/repo'
});Parse Commits
parseCommit('feat(api): add endpoint')
// { type: 'feat', scope: 'api', breaking: false, description: 'add endpoint' }
parseCommit('feat!: breaking change')
// { type: 'feat', scope: null, breaking: true, description: 'breaking change' }Validate Commits
validateCommit('feat: valid message')
// { valid: true, parsed: { ... } }
validateCommit('invalid')
// { valid: false, error: 'Commit does not follow conventional commit format' }Version Bumping
const commits = [
{ subject: 'feat!: breaking' } // -> major
{ subject: 'feat: feature' } // -> minor
{ subject: 'fix: bug' } // -> patch
];
bumpVersion('1.2.3', commits) // Returns new versionCommit Types
| Type | Description |
|------|-------------|
| feat | New feature |
| fix | Bug fix |
| perf | Performance improvement |
| refactor | Code refactoring |
| docs | Documentation |
| style | Formatting changes |
| test | Tests |
| build | Build system |
| ci | CI/CD |
| chore | Maintenance |
| revert | Revert commit |
Output Format
## [1.1.0] - 2024-01-15
### ⚠️ BREAKING CHANGES
- Major API change
### ✨ Features
- **api:** Add new endpoint
- Add user authentication
### 🐛 Bug Fixes
- **core:** Fix memory leakLicense
MIT
