CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-conventional-changelog-writer

Write logs based on conventional commits and templates.

85

1.00x
Overview
Eval results
Files

task.mdevals/scenario-9/

Filtered Changelog Generator

Build a changelog filtering utility that generates clean changelog output by excluding unwanted commits based on configurable criteria.

Requirements

Create a tool that processes commit data and generates filtered changelog strings. The tool must support:

  1. Revert Filtering: Automatically exclude commits that have been reverted
  2. Custom Filtering: Apply a custom function to exclude commits based on any criteria
  3. Conditional Generation: Only generate output when specific conditions are met

Your module should export a generateFilteredChangelog function that:

  • Accepts an array of commit objects and a configuration object
  • Returns a promise resolving to the filtered changelog string
  • Applies the filtering rules from the configuration

Commit Object Structure

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
}

Configuration Object

{
  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
}

Test Cases

  • 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

API

/**
 * 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 };

Dependencies { .dependencies }

conventional-changelog-writer { .dependency }

Provides changelog generation and commit filtering capabilities.

Install with Tessl CLI

npx tessl i tessl/npm-conventional-changelog-writer

tile.json