Skip to content

Commit

Permalink
feat(emoji): add support to emojis on commit head
Browse files Browse the repository at this point in the history
- Add support to use emojis on commit head before subject
  • Loading branch information
amaury-tobias committed Dec 20, 2019
1 parent 5b095c4 commit 76a9246
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
"defaultSubject": "",
"defaultBody": "",
"defaultIssues": "",
"emojis": false,
"types": {
...
"feat": {
"description": "A new feature",
"title": "Features"
"emoji": "🚀"
},
...
}
Expand Down
3 changes: 2 additions & 1 deletion engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ module.exports = function(options) {

// parentheses are only needed when a scope is present
var scope = answers.scope ? '(' + answers.scope + ')' : '';
var emoji = options.emojis ? options.types[answers.type].emoji : '';

// Hard limit this line in the validate
var head = answers.type + scope + ': ' + answers.subject;
var head = answers.type + scope + ': '+ emoji + ' ' + answers.subject;

// Wrap these lines at options.maxLineWidth characters
var body = answers.body ? wrap(answers.body, wrapOptions) : false;
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var configLoader = require('commitizen').configLoader;

var config = configLoader.load();
var options = {
emojis: config.emojis || false,
types: config.types || conventionalCommitTypes.types,
defaultType: process.env.CZ_TYPE || config.defaultType,
defaultScope: process.env.CZ_SCOPE || config.defaultScope,
Expand Down

0 comments on commit 76a9246

Please sign in to comment.