cz-conventional-changelog icon indicating copy to clipboard operation
cz-conventional-changelog copied to clipboard

Add scope selector

Open bertho-zero opened this issue 4 years ago • 15 comments

bertho-zero avatar Apr 02 '20 16:04 bertho-zero

any idea when this will be available? i'd like to configure custom scopes

michaelwarren1106 avatar Apr 08 '20 16:04 michaelwarren1106

me too !! it would be great !

mayrop avatar May 06 '20 23:05 mayrop

Hi, when this will be available? We're waiting for this too.

reme3d2y avatar May 26 '20 09:05 reme3d2y

Hi @jimthedev, can we have a review for this ?

bertho-zero avatar Jul 08 '20 13:07 bertho-zero

@bertho-zero oh, neat, you've been working on this as well; I didn't know about scope-enum rule though. Here's my progress so far, it's trying to change as little code as possible and be fairly backwards compatible (i.e., you have to opt into this feature): https://github.com/ThisIsMissEm/cz-conventional-changelog/pull/1

ThisIsMissEm avatar Jul 24 '20 20:07 ThisIsMissEm

@bertho-zero just pushed my own version of this in #126, which tries to achieve the same goal in a cleaner manner (I didn't realise you already had this PR when I started writing my version), also means there's no double-prompt run.

it's fairly similar but allows users to also specify their own scope, so is less strict than your implementation. I think we could add a "don't allow free scope" option too if you wanna be really strict about scopes choices. Perhaps CZ_SCOPES_STRICT or something?

ThisIsMissEm avatar Jul 29 '20 02:07 ThisIsMissEm

Yes, this option can be useful if the commitlint config uses the scope-enum rule.

https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/rules/src/scope-enum.ts

bertho-zero avatar Jul 29 '20 09:07 bertho-zero

@bertho-zero Okay, so, I think if scope-enum is set, given that behaviour, then CZ_SCOPES_STRICT is implied — I could probably update my branch to implement that behaviour. I'm not sure if you've had a chance to take a look at my implementation, but I've effectively separated configuration from the running of the engine, such that we can test the parsing of configuration in isolation

Still need to write tests for the flow of inputs through that though!

ThisIsMissEm avatar Jul 29 '20 12:07 ThisIsMissEm

Any news?

btd1337 avatar Jan 25 '21 04:01 btd1337

who's in charge of this repo? how can we get this merged?

nweajoseph avatar Sep 16 '22 17:09 nweajoseph

@btd1337 @nweajoseph I haven't had a chance to ever look at this branch again, due to a lack of time. Maybe you could contribute unit tests to the code over at https://github.com/commitizen/cz-conventional-changelog/pull/126 and rebase it? More than happy to let someone else see it to completion.

ThisIsMissEm avatar Sep 16 '22 23:09 ThisIsMissEm

I am really looking forward to this feature

bekkazy-k avatar Sep 23 '22 03:09 bekkazy-k

Is it possible to get this simple feature merged ? If you are a project maintainer you should be able to allow only a limited scope to ensure consistency accros commit messages.

floross avatar Jan 26 '23 11:01 floross

I tried to test the feature but did not get prompted with the scopes. what am I missing? @bertho-zero my package.json references this branch (and I ran npm install, I can see in node_modules the allowedScopes property)

 "cz-conventional-changelog": "bertho-zero/cz-conventional-changelog#scope-enum",

I configured in package.json

  "config": {
    "commitizen": {
      "path": "cz-conventional-changelog",
      "allowedScopes": [
        "my-project1",
        "my-project2",
        "my-project3"
      ]
    }
  },

fredericrous avatar Mar 05 '24 23:03 fredericrous

I found a nice alternative to cz-conventional-changelog that can even autodetect the scopes if you work in a monorepo: https://github.com/Zhengqbbb/cz-git

fredericrous avatar Mar 06 '24 00:03 fredericrous