Types aren't case sensitive

Author: alexandrebrgCreated Jul 29, 2021Updated May 27, 2022

:wave:

Context

After some struggling with semantic-release and its configs, I found out that conventionalcommits preset isn't parsing properly commits. I don't know for other commit parsers.

What I mean by parsing not properly commits is that it is not case-sensitive, while semantic-release/commit-analyzer is.

What is currently happening

Take as a base, the following commits and config:

{
"plugins": [
    ["@semantic-release/commit-analyzer", {
        "releaseRules": [
          { type: "Feat", scope: "*", release: "minor" },
          { type: "Refactor", scope: "*", release: "minor" },
          { type: "Enhancement", scope: "*", release: "patch" },
          { type: "Fix", scope: "*", release: "patch" },
          { type: "Perf", scope: "*", release: "patch" },
          { type: "Revert", scope: "*", release: "patch" },
          { type: "Docs", scope: "*", release: "patch" },
          { type: "Test", scope: "*", release: "patch" },
          { type: "Ci", scope: "*", release: "patch" },
          { type: "Chore", scope: "*", release: "minor" },
          { type: "Package", scope: "*", release: "patch" },
          { footer: "BREAKING CHANGES:*", release: "major"}
        ],
        "parserOpts": {
          "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
        }
      }
    ],
    ["@semantic-release/release-notes-generator", {
        "parserOpts": {
          "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
        },
        "writerOpts": {
          "commitsSort": ["subject", "scope"]
        },
        preset: "conventionalcommits",
        presetConfig: {
          "types": [
            { type: "*", hidden: false, section: "Misc" },
            { type: "feat", hidden: false, section: "Feature" },
            { type: "refactor", hidden: false, section: "Refactor" },
            { type: "enhancement", hidden: false, section: "Enhancement" },
            { type: "fix", hidden: false, section: "Bug fix" },
            { type: "perf", hidden: false, section: "Performance" },
            { type: "revert", hidden: false, section: "Code revert"},
            { type: "docs", hidden: false, section: "Documentation" },
            { type: "test", hidden: false, section: "Test" },
            { type: "ci", hidden: false, section: "Continuous Integration" },
            { type: "chore", hidden: false, section: "Chore" },
            { type: "package", hidden: false, section: "Package" }
          ]
        }
      }
    ],
...some other stuff
}

image

We will focus on commits beginning with Ci, ci and CI. Commit-analyzer won't create release for commits that aren't matching the pattern Ci (case-sensitive). However, in the changelog, we will see these three commits appearing :

### Continuous Integration

* update .releaserc (016f9dd)
* **semantic_release:** update .releaserc meta (c2e555a)
* **.releaserc:** update semantic-release (8d95c66)

To finish, if I update the presetConfig.types with { type: "Ci" ... } instead of { type: "ci" }, none of these commits will be shown in the release note. So I believe commits are transformed into lowercase.

What I expect to happened

We should only have the commits that are following the spec given in a case-sensitive way, so, for the config type below, we should get the following release note:

"types":  [
    ...some other types
    { type: "Ci", section: "Continuous integration" } 
]
### Continuous Integration

* **semantic_release:** update .releaserc meta (c2e555a)

I hope it is clear :)

Source: conventional-changelog/conventional-changelog