ngryman / cz-emoji

Commitizen adapter formatting commit messages using emojis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature request]: Making cz-emoji commits semantic compliant

Clumsy-Coder opened this issue · comments

It'd be nice to have the git commit messages to be semantic compliant.

What I mean is that it follows the conventional commits rules
Compatible with semantic pull requests
And works with semantic-release (for creating changelogs)

Of course adding the emoji is also nice, as mentioned in #32
But the owner of the pull request hasn't responded for a while. And I've been waiting for the pull request to be merged.

@Clumsy-Coder Could you give me an example to illustrate what a semantic compliant message could look like with cz-emoji?

something like

dep-add(npm): :heavy_plus_sign: add cz-emoji npm package

dep-add(npm): ➕ add cz-emoji npm package

kinda like issue #31

@Clumsy-Coder Gotcha thanks.

It makes sense to me and doesn't involve so many changes.
I've added a new conventional option to the configuration. If set to true, it will format the message as you suggested.

Could you install the bleeding edge cz-emoji on master?

-  "cz-emoji": "^1.2.2"
+  "cz-emoji": "ngryman/cz-emoji"

Let me know if it works for you. If so I'll release a new version.

Just need to add docs to README on how to use conventional commits. Other than that, it looks good to me.

NOTE: it needs a BREAKING CHANGE section. I already have it implemented. I'll create a pull request for it.

Just need to add docs to README on how to use conventional commits. Other than that, it looks good to me.

NOTE: it needs a BREAKING CHANGE section. I already have it implemented. I'll create a pull request for it.

Pull request created. #44

Following-up in #44.

I had some trouble getting this working in conjunction with commitlint, but adding this to my commitlint.config.js seemed to do the trick:

const commitTypes = require('cz-emoji/lib/types.json')

module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [2, 'always', commitTypes.map((type) => type.name)],
  },
}

Just want to make sure I'm not doing something stupid here? If it is stupid - please let me know

If it's not stupid I'd be happy to add this to the docs for cz-emoji

Edit Hit a snag on this with @commitlint/config-conventional due to the parsing regex in conventional-changelog-conventionalcommits and made a comment there regarding a solution.