Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change the commit convention so that changelog gets generated? #964

Open
aatifhsn opened this issue Apr 18, 2024 · 1 comment
Open
Labels

Comments

@aatifhsn
Copy link

I have a commit convention like '[JIRA Ticket ID] fix|chore|feat: commit message'. Using commitlint I have made the commit convention. How can I use standard version so that CHANGELOG.md will be generated using this convention?

@aatifhsn
Copy link
Author

aatifhsn commented Apr 18, 2024

@stevemao

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
    },
  };

this is my commitlint.config.js file

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

No branches or pull requests

1 participant