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
# Install the package
npm install cclog-parser
# Create a simple example
echo "
import { parseChangelog } from 'cclog-parser';
const changelog = \`
<a name=\"1.0.0\"></a>
# 1.0.0 (2023-01-01)
### Bug Fixes
* fix something important
### Features
* add amazing new feature
\`;
const result = parseChangelog(changelog);
console.log(result);
" > example.js
# Run it
node example.js
import { parseChangelog } from 'cclog-parser';
const changelog = `
<a name="0.1.0"></a>
# 0.1.0 (2023-01-01)
### Bug Fixes
* fix issue A ([17c2c43](https://example.com/commit/abc))
* fix issue B ([17c2c43](https://example.com/commit/def))
### Features
* add feature X ([17c2c43](https://example.com/commit/ghi))
* add feature Y ([17c2c43](https://example.com/commit/jkl))
`;
const result = parseChangelog(changelog);
console.log(result);
const { parseChangelog } = require('cclog-parser');
const result = parseChangelog(changelog);
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:
interface ParseResult {
/** Array of version strings */
versions: string[];
/** Changes grouped by version */
changes: Record<string, ChangeObject>;
}
interface ChangeObject {
/** Bug fixes */
fixes: string[];
/** New features */
features: string[];
/** Breaking changes */
breakingChanges: string[];
}
{
versions: ['0.1.0', '0.0.1'],
changes: {
'0.1.0': {
fixes: [
'fix issue A ([17c2c43](https://example.com/commit/abc))',
'fix issue B ([17c2c43](https://example.com/commit/def))'
],
features: [
'add feature X ([17c2c43](https://example.com/commit/ghi))',
'add feature Y ([17c2c43](https://example.com/commit/jkl))'
],
breakingChanges: []
}
}
}
The parser supports multiple changelog formats:
<a name="1.0.0"></a>
# 1.0.0 (2023-01-01)
### Bug Fixes
- fix something
### Features
- add something
### BREAKING CHANGES
- breaking change
# [1.0.0](https://github.com/user/repo/compare/v0.9.0...v1.0.0) (2023-01-01)
### Bug Fixes
- fix something
### Features
- 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)
// 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);
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run linting
npm run lint
# Run type checking
npm run type-check
# Format code
npm run format
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
MIT © jserme