Skip to content

Incorrect version bump with custom parserOpts #122

@De-Santa

Description

@De-Santa

Hello! I have next config:

import type { Config } from "release-it";

export default {
  ...
  plugins: {
    "@release-it/conventional-changelog": {
      infile: "CHANGELOG.md",
      header: "# Changelog\n\n",
      parserOpts: {
        headerPattern: /^(\w+-\w+)\s+\((\w+)\)\s*:?\s*(.*)$/,
        headerCorrespondence: ["task", "type", "message"], // Corresponding fields
      },
      preset: {
        name: "conventionalcommits",
        types: [
          { type: "build", section: "🧱 Dependency" },
          { type: "chore", section: "🏭 Chores" },
          { type: "ci", section: "🚦 CI/CD" },
          { type: "docs", section: "📝 Documentation" },
          { type: "feat", section: "⭐ New Feature" },
          { type: "feature", section: "⭐ New Feature" },
          { type: "fix", section: "🐛 Bug Fix" },
          { type: "bugfix", section: "🐛 Bug Fix" },
          { type: "refactor", section: "♻️ Code Refactoring" },
          { type: "style", section: "🎨 Styling and Formatting" },
          { type: "test", section: "🧪 Code Testing" },
        ],
      },
    },
  }
} satisfies Config;

I'm testing this config with commit: GG-TASK (feature): some features added
This commit should trigger minor release

"@release-it/conventional-changelog": "8.0.2" WORKS OK - triggers minor release
"@release-it/conventional-changelog": "10.0.1" NOT WORKING - triggers patch release

As far as I tested I see difference in commits param output at whatBump options:

whatBump: (commits) => {
  console.log(commits);
  ...
},

Output in @release-it/conventional-changelog 8.0.2

[
  {
    task: 'GG-TASK',
    type: 'feature',
    message: 'some features added',
    merge: null,
    header: 'GG-TASK (feature): some features added',
    body: null,
    footer: null,
    notes: [],
    references: [],
    mentions: [],
    revert: null,
  }
]

Output in @release-it/conventional-changelog 10.0.1

 [
  {
    merge: null,
    revert: null,
    header: 'GG-TASK (feature): some features added',
    body: '',
    footer: null,
    notes: [],
    mentions: [],
    references: [],
  }
]

As far as i see whatBump ignores parserOpts.
This does not helps

{
  "overrides": {
    "conventional-changelog-conventionalcommits": "8.0.0"
  }
}

Can it be somehow fixed? For now I'm staying at "@release-it/conventional-changelog": "8.0.2" and feeling sad

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions