Modern conventional-changelog parser with ES modules and TypeScript support
npm install cclog-parser[![npm][npm-img]][npm-url] [![build][build-img]][build-url] [![coverage][coverage-img]][coverage-url] [![downloads][downloads-img]][npm-url]
Modern conventional-changelog parser with TypeScript support and ES modules.
Parse changelog files in the format used by tools like conventional-changelog, similar to the Karma project changelog.
This package is currently maintained by AI.
- 🎯 TypeScript support - Full type definitions included
- 📦 ES Modules - Modern module system with CommonJS compatibility
- 🔧 Flexible parsing - Support for multiple changelog formats
- 🚀 Modern tooling - Built with latest Node.js best practices
- ✅ Well tested - Comprehensive test coverage
``bashInstall the package
npm install cclog-parser
;const result = parseChangelog(changelog);
console.log(result);
" > example.js
Run it
node example.js
`Usage
$3
`typescript
import { parseChangelog } from 'cclog-parser';const changelog =
* fix issue A (17c2c43)
* fix issue B (17c2c43)
* add feature X (17c2c43)
* add feature Y (17c2c43);
const result = parseChangelog(changelog);
console.log(result);
`
`javascript
const { parseChangelog } = require('cclog-parser');
const result = parseChangelog(changelog);
`
`typescript
interface ParseOptions {
/**
* Whether to include detailed commit information
* @default true
*/
includeDetails?: boolean;
}
const result = parseChangelog(changelog, {
includeDetails: false,
});
`
The parser returns an object with the following structure:
`typescript
interface ParseResult {
/* Array of version strings /
versions: string[];
/* Changes grouped by version /
changes: Record
}
interface ChangeObject {
/* Bug fixes /
fixes: string[];
/* New features /
features: string[];
/* Breaking changes /
breakingChanges: string[];
}
`
`javascript`
{
versions: ['0.1.0', '0.0.1'],
changes: {
'0.1.0': {
fixes:
'fix issue A ([17c2c43)',
'fix issue B (17c2c43)'
],
features:
'add feature X ([17c2c43)',
'add feature Y (17c2c43)'
],
breakingChanges: []
}
}
}
The parser supports multiple changelog formats:
- fix something
- add something
- breaking change
`
`markdown1.0.0 (2023-01-01)
- fix something
- add something
`
- Node.js >= 16.0.0
Version 2.0 introduces breaking changes:
- ES Modules: Package now uses ES modules by default
- Node.js: Minimum version requirement is now 16.0.0
- TypeScript: Full TypeScript rewrite with type definitions
- API: Import syntax has changed (see usage examples above)
`javascript
// Old (v1.x)
const parser = require('cclog-parser');
const result = parser(changelog);
// New (v2.x) - ES Modules
import { parseChangelog } from 'cclog-parser';
const result = parseChangelog(changelog);
// New (v2.x) - CommonJS
const { parseChangelog } = require('cclog-parser');
const result = parseChangelog(changelog);
`
`bashInstall dependencies
npm install
Contributing
1. Fork the repository
2. Create your feature branch (
git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'feat: add amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)MIT © jserme
[npm-img]: https://badgen.net/npm/v/cclog-parser
[npm-url]: https://npmjs.com/package/cclog-parser
[build-img]: https://github.com/jserme/cclog-parser/workflows/CI/badge.svg
[build-url]: https://github.com/jserme/cclog-parser/actions
[coverage-img]: https://codecov.io/gh/jserme/cclog-parser/branch/master/graph/badge.svg
[coverage-url]: https://codecov.io/gh/jserme/cclog-parser
[downloads-img]: https://img.shields.io/npm/dm/cclog-parser.svg