conventional-changelog / standard-version

:trophy: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org
ISC License
7.68k stars 792 forks source link

Configuration type option regex support #361

Open mrastiak opened 5 years ago

mrastiak commented 5 years ago

I think it would be helpful to add regex support to type option in configuration, Example:

"types": [
            {
                "type": "feat",
                "section": "Features"
            },
            {
                "type": "fix",
                "section": "Bug Fixes"
            },
            {
                "type": "regexPattern",
                "section": "Custom Section"
            }
        ]
farzadso commented 5 years ago

I would really like this feature to be implemented too if applicable.

bcoe commented 5 years ago

@mrastiak @farzadso what use-cases would you like this for?

farzadso commented 5 years ago

@bcoe For instance we want commits starting with chore: .... to be in our changelog, but not commits that have this structure : chore: merge branch 'x' into 'y'

bcoe commented 5 years ago

@farzadso seems like a reasonable use-case :+1:

farzadso commented 5 years ago

@bcoe Do you think we could have the implementation any time soon?

bcoe commented 5 years ago

@farzadso would happily accept a patch for the feature, is there any prior art we could use for the syntax? I don't love just running new RegExp() on the string ... maybe we should instead think in terms of globs?

Any other popular libraries we can think of that do this?

farzadso commented 5 years ago

@mrastiak Armin, would you please follow up on the questions Benjamin just asked?

mrastiak commented 5 years ago

@bcoe Hello Benjamin, I don't think glob can help us in this case because we need to use the negative lookahead feature of regex.

bcoe commented 5 years ago

@mrastiak 👍 if you could find some prior art, for a configuration spec that accepts regexes? I guess mocha probably supports regexes in their config?

mrastiak commented 5 years ago

@bcoe You are right mocha does support regex: https://mochajs.org/#-grep-regexp-g-regexp,

Cause Mocha to only run tests matching the given regexp, which is internally compiled to a RegExp.