Write logs based on conventional commits and templates.
85
Build a changelog filtering utility that generates clean changelog output by excluding unwanted commits based on configurable criteria.
Create a tool that processes commit data and generates filtered changelog strings. The tool must support:
Your module should export a generateFilteredChangelog function that:
Each commit object has the following structure:
{
hash: string, // Full commit hash
header: string, // Commit message first line
type: string, // Commit type (feat, fix, chore, etc.)
scope: string | null, // Optional scope
subject: string, // Commit subject
body: string | null, // Optional commit body
footer: string | null, // Optional footer
notes: Array, // Array of note objects
references: Array, // Array of reference objects
revert: object | null // If this is a revert commit, contains info about reverted commit
}{
ignoreReverted: boolean, // Whether to filter out reverted commits
customFilter: function | null, // Custom filter function (commit) => boolean, return false to exclude
generateOnlyWithVersion: boolean // Only generate output if commits contain version info
}When given commits including a commit and its revert, with ignoreReverted: true, the reverted commit is excluded from the output @test
When given a custom filter that excludes commits with scope "internal", those commits do not appear in the output @test
When generateOnlyWithVersion: true and no commits contain version information, returns an empty string @test
@generates
/**
* Generates a filtered changelog from an array of commits
* @param {Array} commits - Array of commit objects
* @param {Object} config - Configuration object
* @param {boolean} config.ignoreReverted - Filter out reverted commits
* @param {Function|null} config.customFilter - Custom filter function (commit) => boolean
* @param {boolean} config.generateOnlyWithVersion - Only generate if version present
* @returns {Promise<string>} Filtered changelog string
*/
async function generateFilteredChangelog(commits, config) {
// Implementation here
}
module.exports = { generateFilteredChangelog };Provides changelog generation and commit filtering capabilities.
Install 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