Skip to content

Using local preset via config arg in v13 #328

Description

@mihkeleidast

Describe the bug

We have a custom conventional changelog preset (distributed as an npm package internally) that essentially extends conventional-changelog-conventionalcommits.

In the custom preset repository, we want to use the custom preset itself to generate the changelog, i.e. via commit-and-tag-version --config src/index.js. Elsewhere we can use the --preset option directly, so it's an issue only when working in the preset repo.

This worked well in v12 with the older conventional-changelog packages, as the preset factory function returned an object with writerOpts, parserOpts etc keys, which commit-and-tag-version then forwarded to conventional-changelog-conventionalcommits.

In v13, however, since the preset format changed - it now returns writer and parser keys - but commit-and-tag-version did not update its config options, things don't work magically out of the box anymore.

The workaround is to create a separate config file for the preset repo:

import createPreset from './index.js';

const preset = createPreset();

export default {
  ...preset,
  writerOpts: preset.writer,
  parserOpts: preset.parser,
};

However, I don't think that's ideal and feel like commit-and-tag-version config options should be updated to match the new preset structure.

Environment

  • commit-and-tag-version version: 11.0.0

Possible Solution

Deprecate the current writerOpts, parserOpts etc config options and add new ones that match the new preset structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions