Write logs based on conventional commits and templates.
85
Build a changelog generator that filters commits before generating formatted changelog entries. The system should accept a collection of commit objects, apply filtering rules to remove unwanted commits, and then generate a properly formatted changelog string.
Create a system that filters out commits based on specific criteria before changelog generation. The filtering should:
After filtering, generate a complete changelog string from the filtered commits:
The complete workflow should:
Commit objects should follow this structure:
{
hash: string,
header: string,
type: string,
scope: string | null,
subject: string,
body: string | null,
footer: string | null,
notes: Array,
references: Array
}Provides changelog generation capabilities from structured commit data.
Provides commit filtering functionality to clean up commit data before changelog generation.
Input:
const commits = [
{
hash: 'abc123',
header: 'feat: add new feature',
type: 'feat',
scope: null,
subject: 'add new feature',
body: null,
footer: null,
notes: [],
references: []
},
{
hash: 'def456',
header: 'fix: fix bug',
type: 'fix',
scope: null,
subject: 'fix bug',
body: null,
footer: null,
notes: [],
references: []
},
{
hash: 'ghi789',
header: 'revert: feat: add new feature',
type: 'revert',
scope: null,
subject: 'feat: add new feature',
body: 'This reverts commit abc123',
footer: null,
notes: [],
references: [],
revert: { hash: 'abc123' }
}
];Expected Behavior:
Input:
const commits = [
{
hash: 'aaa111',
header: 'feat(parser): add parser support',
type: 'feat',
scope: 'parser',
subject: 'add parser support',
body: null,
footer: null,
notes: [],
references: []
},
{
hash: 'bbb222',
header: 'docs: update readme',
type: 'docs',
scope: null,
subject: 'update readme',
body: null,
footer: null,
notes: [],
references: []
}
];Expected Behavior:
src/changelog-generator.js or src/changelog-generator.ts: Main implementation with filtering and generation logicsrc/changelog-generator.test.js or src/changelog-generator.test.ts: Test file containing the test casesInstall with Tessl CLI
npx tessl i tessl/npm-conventional-changelog-writerevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10