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

Question: How to configure "angular" preset to print docs, style, etc. #77

Closed
MaiKaY opened this issue Apr 20, 2018 · 4 comments
Closed
Labels

Comments

@MaiKaY
Copy link

MaiKaY commented Apr 20, 2018

Hi guys,
i made a lot of research and even sniffed the repositories to find a proper solution but it doesn't work out for me. Therefore i decided to ask here for help.

My goal is to generateNotes even for commits prefixed with docs:, style:, ci:, etc.
Right now only fix:, feat: and breacking change are printed to CHANGELOG.md and GitHub releases.

My configuration looks like this:

{
    "release": {
        "verifyConditions": [
            "@semantic-release/changelog",
            "@semantic-release/github"
        ],
        "analyzeCommits": {
            "preset": "angular",
            "releaseRules": [
                {
                    "type": "docs",
                    "release": "patch"
                },
                {
                    "type": "refactor",
                    "release": "patch"
                },
                {
                    "type": "style",
                    "release": "patch"
                }
            ]
        },
        "generateNotes": {
            "preset": "angular"
        },
        "prepare": [
            "@semantic-release/changelog",
            "@semantic-release/git"
        ],
        "publish": [
            "@semantic-release/github"
        ]
    }
}

I know that angular is the default preset for generateNotes but i added it to be explicit for everyone.

I appreciate every single hint, link or solution snippet.

Thanks in advance.

@pvdlg
Copy link
Member

pvdlg commented Apr 20, 2018

The changelog is generated by conventional-changelog-angular by default and it's over there that the type of commit to include in the change log are determined.

See https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/writer-opts.js#L45

If you want to include other type of commit in the changelog you can create your own preset (based on conventional-changelog-angular) that would include all the commits type.

semantic-release passes all the commit to conventional-changelog so there is nothing we can do in semantic-release.

@pvdlg pvdlg added the support label Apr 20, 2018
@MaiKaY
Copy link
Author

MaiKaY commented Apr 20, 2018

Hi @pvdlg,
thanks for clarification! I really appreciate it.

cheers

@cisasteelersfan
Copy link

I had the same exact question about including all Angular commit types in release notes. I solved it by providing a custom transform function.

See my POC here: release.config.js

@SimonGolms
Copy link

SimonGolms commented Mar 12, 2022

To anyone who also ends up here, the trick is to use conventionalcommits as a preset and then implement it as follows with presetConfig:

// release.config.js
module.exports = {
  plugins: [
    [
      '@semantic-release/commit-analyzer',
      {
        parserOpts: {
          noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
        },
        preset: 'angular',
        releaseRules: [
          { type: 'chore', release: 'patch' },
          { type: 'refactor', release: 'patch' },
          { type: 'style', release: 'patch' },
        ],
      },
    ],
    [
      '@semantic-release/release-notes-generator',
      {
        parserOpts: {
          noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
        },
        preset: 'conventionalcommits',
        presetConfig: {
          types: [
            { type: 'build', section: 'Build System', hidden: false },
            { type: 'chore', section: 'Build System', hidden: false },
            { type: 'ci', section: 'Continuous Integration', hidden: false },
            { type: 'docs', section: 'Documentation', hidden: false },
            { type: 'feat', section: 'Features', hidden: false },
            { type: 'fix', section: 'Bug Fixes', hidden: false },
            { type: 'perf', section: 'Performance Improvements', hidden: false },
            { type: 'refactor', section: 'Code Refactoring', hidden: false },
            { type: 'style', section: 'Styles', hidden: false },
            { type: 'test', section: 'Tests', hidden: false },
          ],
        },
        writerOpts: {
          commitsSort: ['subject', 'scope'],
        },
      },
    ],
  ],
};

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

No branches or pull requests

4 participants