absolute-version / commit-and-tag-version

Fork of the excellent standard-version. Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org :trophy:
ISC License
402 stars 39 forks source link

How can I generate a CHANGELOG.md based on a different commit convention? #140

Open aatifhsn opened 5 months ago

aatifhsn commented 5 months ago

I have my commit convention defined as '[JIRA ID]? [type] subject', I have described this commit convention using commitlint. How can I generate the CHANGELOG.md using this convention using commit-and-tag? Below is the the code for me commitlint.config.js

module.exports = {
    parserPreset: {
      parserOpts: {
        headerPattern: /^\[(\w+-\d+)\] (\w+): (.+)/,
        headerCorrespondence: ["scope", "type", "subject"],
      },
    },
    plugins: [
      {
        rules: {
          "header-match-team-pattern": (parsed) => {
            const { type, scope, subject } = parsed;
            console.log(parsed);
            if (type === null && scope === null && subject === null) {
              return [
                false,
                "header must be in format '[JIRA ID]? [type] subject'",
              ];
            }
            return [true, ""];
          },
          "scope-type-enum": (parsed, _when, expectedValue) => {
            const { type} = parsed;
            if (type && !expectedValue.includes(type)) {
              return [
                false,
                `type must be one of ${expectedValue}`,
              ];
            }
            return [true, ""];
          },
        },
      },
    ],
    rules: {
      "header-match-team-pattern": [2, "always"],
      "scope-type-enum": [2, "always", ["fix", "feat","chore"]], // custom rule defined in plugins
    },
  };
aatifhsn commented 5 months ago

@TimothyJones

TimothyJones commented 5 months ago

I'm not sure. This project is a wrapper around conventional-changelog, so if you can get that to do it, it should be straightforward.

I would start by looking at the parser options, which this project exposes.

aatifhsn commented 5 months ago

There doesn't seem to be a way to configure these packages for any other commit messages apart from conventional commit messages