Skip to content

Commit 76a9246

Browse files
committed
feat(emoji): add support to emojis on commit head
- Add support to use emojis on commit head before subject
1 parent 5b095c4 commit 76a9246

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
2626
"defaultSubject": "",
2727
"defaultBody": "",
2828
"defaultIssues": "",
29+
"emojis": false,
2930
"types": {
3031
...
3132
"feat": {
3233
"description": "A new feature",
33-
"title": "Features"
34+
"emoji": "🚀"
3435
},
3536
...
3637
}

engine.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,10 @@ module.exports = function(options) {
197197

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

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

204205
// Wrap these lines at options.maxLineWidth characters
205206
var body = answers.body ? wrap(answers.body, wrapOptions) : false;

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var configLoader = require('commitizen').configLoader;
66

77
var config = configLoader.load();
88
var options = {
9+
emojis: config.emojis || false,
910
types: config.types || conventionalCommitTypes.types,
1011
defaultType: process.env.CZ_TYPE || config.defaultType,
1112
defaultScope: process.env.CZ_SCOPE || config.defaultScope,

0 commit comments

Comments
 (0)