Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
feat: add emojis to commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed May 23, 2018
1 parent 3e2e57b commit 2c36297
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('fs');
const inquirer = require('inquirer');
const wrap = require('word-wrap');
const appRoot = require('app-root-path');
const types = require('./types').types;
const {
makePackagesQuestion,
questions
Expand All @@ -28,10 +29,6 @@ const makeAffectsLine = function (answers) {
return '';
};

const emojis = {
style: 'πŸ’„'
};

module.exports = {
prompter (cz, commit) {
let promptQuestions = questions;
Expand All @@ -51,7 +48,8 @@ module.exports = {
width: MAX_LINE_WIDTH
};

const emojiPrefix = emojis[answers.type] ? emojis[answers.type] + ' ' : '';
const emoji = types[answers.type].ejomi;
const emojiPrefix = emoji ? emoji + ' ' : '';
const head = answers.type + ': ' + emojiPrefix + answers.subject;
const affectsLine = makeAffectsLine(answers);

Expand Down
2 changes: 1 addition & 1 deletion src/prompt/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const MIN_SUBJECT_LENGTH = 3;
const MIN_SUBJECT_LENGTH_ERROR_MESSAGE = `The subject must have at least ${MIN_SUBJECT_LENGTH} characters`;

const typeToListItem = ({description, emoji, value}) => ({
name: (emoji || '❔') + ' ' + pad(value + ':', 12, ' ') + description,
name: (emoji || '❔') + ' ' + pad(value + ':', 12, ' ') + description,
value
});

Expand Down
8 changes: 8 additions & 0 deletions src/types.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
exports.types = {
chore: {
description: 'Build process or auxiliary tool changes',
emoji: 'πŸ‘»',
value: 'chore'
},
ci: {
description: 'CI related changes',
emoji: 'πŸ€–',
value: 'ci'
},
docs: {
description: 'Documentation only changes',
emoji: '✍️',
value: 'docs'
},
feat: {
description: 'A new feature',
emoji: '🎸',
value: 'feat'
},
fix: {
description: 'A bug fix',
emoji: 'πŸ›',
value: 'fix'
},
perf: {
description: 'A code change that improves performance',
emoji: 'πŸ”₯',
value: 'perf'
},
refactor: {
description: 'A code change that neither fixes a bug or adds a feature',
emoji: 'πŸ‘Œ',
value: 'refactor'
},
style: {
Expand All @@ -34,6 +41,7 @@ exports.types = {
},
test: {
description: 'Adding missing tests',
emoji: 'πŸ’',
value: 'test'
}
};

0 comments on commit 2c36297

Please sign in to comment.