semantic-versioningchangelogsemantic-release

Setup @semantic-release for considering 'refactor' commits in the CHANGELOG


Using @semantic-release I'd like to consider refactor changes for both, triggering a new release and write down in the CHANGELOG.md file.

So far, I've included refactor commits at "@semantic-release/commit-analyzer" so they are triggering a patch release:

[
  "@semantic-release/commit-analyzer",
  {
    "preset": "angular",
    "releaseRules": [
      {
        "type": "refactor",
        "release": "patch"
      }
    ]
  }
],      

But those commit msgs aren't included in the CHANGELOG file, how can I setup "@semantic-release/release-notes-generator" plugin for including refactor commits? I find related doc confusing and lack of examples


  1. generated CHANGELOG example
## [0.6.4](.../compare/v0.6.3...v0.6.4) (date)

## [0.6.3](.../compare/v0.6.2...v0.6.3) (date)
  1. desired CHANGELOG
## [0.6.4](.../compare/v0.6.3...v0.6.4) (date)

[[>>INCLUDE HERE COMMIT MSG + LINK<<]]

## [0.6.3](.../compare/v0.6.2...v0.6.3) (date)

Solution

  • If anyone finds this useful: we need to config "@semantic-release/release-notes-generator" for considering other keywords besides feat and fix including these dicts:

    {
       "type": "refactor",
       "section": "title to be used in changelog.md",
       "hidden": false
    }
    

    For copy-pasting, this setup is gathering both refactor, chore and perf into ## Internal section (note i needed to write explicitly default values, I guess this is because it's overriding the config)

    [
      "@semantic-release/release-notes-generator",
      {
        "preset": "conventionalCommits",
        "parserOpts": {
          "noteKeywords": [
            "BREAKING CHANGE",
            "BREAKING CHANGES",
            "BREAKING"
          ]
        },
        "presetConfig": {
          "types": [
            {
              "type": "feat",
              "section": "Features"
            },
            {
              "type": "fix",
              "section": "Bug Fixes"
            },
            {
              "type": "chore",
              "section": "Internal",
              "hidden": false
            },
            {
              "type": "refactor",
              "section": "Internal",
              "hidden": false
            },
            {
              "type": "perf",
              "section": "Internal",
              "hidden": false
            }
          ]
        }
      }
    ]