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

Commit

Permalink
feat: display emoji in selection list
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed May 23, 2018
1 parent bb1967d commit 3e2e57b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"app-root-path": "^2.0.1",
"inquirer": "^3.1.1",
"shelljs": "^0.7.8",
"word-wrap": "^1.2.3"
"word-wrap": "^1.2.3",
"pad-right": "^0.2.2"
},
"optionalDependencies": {
"lerna": "^2.0.0-rc.5"
Expand Down
24 changes: 15 additions & 9 deletions src/prompt/questions.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
const pad = require('pad-right');
const types = require('../types').types;

const MAX_SUBJECT_LENGTH = 64;
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,
value
});

const questions = [
{
choices: [
types.test,
types.feat,
types.fix,
types.chore,
types.docs,
types.refactor,
types.style,
types.ci,
types.perf
typeToListItem(types.test),
typeToListItem(types.feat),
typeToListItem(types.fix),
typeToListItem(types.chore),
typeToListItem(types.docs),
typeToListItem(types.refactor),
typeToListItem(types.style),
typeToListItem(types.ci),
typeToListItem(types.perf)
],
message: 'Select the type of change that you\'re committing:',
name: 'type',
Expand Down
18 changes: 9 additions & 9 deletions src/types.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
exports.types = {
chore: {
name: 'Build process or auxiliary tool changes',
description: 'Build process or auxiliary tool changes',
value: 'chore'
},
ci: {
name: 'CI related changes',
description: 'CI related changes',
value: 'ci'
},
docs: {
name: 'Documentation only changes',
description: 'Documentation only changes',
value: 'docs'
},
feat: {
name: 'A new feature',
description: 'A new feature',
value: 'feat'
},
fix: {
name: 'A bug fix',
description: 'A bug fix',
value: 'fix'
},
perf: {
name: 'A code change that improves performance',
description: 'A code change that improves performance',
value: 'perf'
},
refactor: {
name: 'A code change that neither fixes a bug or adds a feature',
description: 'A code change that neither fixes a bug or adds a feature',
value: 'refactor'
},
style: {
description: 'Markup-only changes (white-space, formatting, missing semi-colons, etc)',
emoji: '💄',
name: 'Markup-only changes (white-space, formatting, missing semi-colons, etc)',
value: 'style'
},
test: {
name: 'Adding missing tests',
description: 'Adding missing tests',
value: 'test'
}
};

0 comments on commit 3e2e57b

Please sign in to comment.