Skip to content

Allow to overwrite whatBump function from presets #741

Description

@jaklan

Hi, currently we are able to overwrite parserOpts and writerOpts:

return {
parserOpts: { ...loadedConfig.parser, ...parserOpts },
writerOpts: { ...loadedConfig.writer, ...writerOpts },
};
};

but we miss a capability to overwrite whatBump() function used by presets, e.g. conventional-changelog-conventionalcommits:

export default async function createPreset (config) {
  return {
    commits: {
      ignore: config?.ignoreCommits,
      merges: false
    },
    parser: createParserOpts(config),
    writer: await createWriterOpts(config),
    whatBump: createWhatBump(config)
  }
}

In case of this specific preset, whatBump() impacts the generated release notes because of a) commit object modification (which is a preset issue itself) b) hardcoded breakingHeaderPattern here:

export const breakingHeaderPattern = /^(\w*)(?:\((.*)\))?!: (.*)$/

which ignores the breakingHeaderPattern value passed to parserOpts (which, I guess, makes sense as whatBump() is a separate function). If we could overwrite a function - we would be able to align parser and whatBump() logic on our end.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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