conventional-changelog / conventional-changelog-config-spec

a spec describing the config options supported by conventional-config for upstream tooling
109 stars 32 forks source link

Add scope in types #53

Open felipecrs opened 3 years ago

felipecrs commented 3 years ago

I would like to define a custom scope in types, such as:

"types": [
  { "type": "build", "scope": "deps", "section": "Dependencies Upgrade" } 
]

So I could select which commits would be part of the changelog (I don't want to include all the build type commits, only the ones matching the scope deps).

So I could use with @semantic-release/commit-analyzer:

    [
      "@semantic-release/commit-analyzer",
      {
        releaseRules: [
          {
            type: "build",
            scope: "deps",
            release: "patch",
          },
        ],
      },
    ],
felipecrs commented 3 years ago

This feature was released in the conventionalcommits preset through https://github.com/conventional-changelog/conventional-changelog/pull/669, despite not included in the schema yet.

ext commented 3 years ago

Author of the conventionalcommits preset PR here, I wasn't aware there was a specification. I can create a PR to add it to the schema and specification if you want?

felipecrs commented 3 years ago

Actually, I'm not a maintainer of this repository. But I believe it would be good since semantic-release points this specification as the reference for configuration.

https://github.com/semantic-release/release-notes-generator#options image

This is how people know how to use it, I guess.

CaitlinWeb commented 1 year ago

Specifying a scope with a type seems to be working now, though it should be noted somewhere that the order of types[] matters. I had to put the scope-specific types first, for example:

types: [
  {
    type: 'feat',
    scope: 'specific-scope',
    section: 'Specific Features'
  },
  {
    type: 'feat',
    section: 'Features'
  }
]

However, with type being required I can't hide a commit based on just scope. For example, I wanted to set up a "no-release" scope to be excluded completely from the release notes and changelog, not just excluded from triggering a release.

I had followed the example here but like this:

  "plugins": [
    ["@semantic-release/commit-analyzer", {
      "preset": "conventionalcommits",
      "presetConfig": {
        types: [...]
      },
      "releaseRules": [
        {"scope": "no-release", "release": false}
      ]
    }],
   [ '@semantic-release/release-notes-generator',  {
      "preset": "conventionalcommits",
      "presetConfig": {
        types: [...]
      }
    }]
  ]

So what I have to do currently is loop through all the types and specify scope: 'no-release' and hidden: true first, then the set all the types section etc without the scope. Ideally I'd like to do this:

types: [
  {
    scope: 'no-release',
    hidden: true
  },
  {
    type: 'feat',
    section: 'Features'
  },
  ...
]

Is there a way to support that? And let me know if I should open a new issue.

Pho3njx commented 7 months ago

Seems to be an old issue. But I would like to remind this feature request. 😁

So that it would be possible

types: [
  {
    "type": "*",
    "scope": "no-release",
    "hidden": true
  }
]
types: [
  {
    "scope": "no-release",
    "hidden": true
  }
]

Thank you so much!