Skip to content

Commit

Permalink
feat(emoji): add emoji support in commit
Browse files Browse the repository at this point in the history
emoji support in commit, optimize cz promtp

emoji
  • Loading branch information
vivaxy committed Nov 23, 2016
1 parent e9e646d commit b6f6233
Show file tree
Hide file tree
Showing 7 changed files with 358 additions and 41 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ publish `npm run release`
- [gcmt](https://github.com/vivaxy/gcmt)
- [commitizen](https://github.com/commitizen/cz-cli)
- [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog)
- [gitmoji-cli](https://github.com/carloscuesta/gitmoji-cli)

[npm-version-image]: http://img.shields.io/npm/v/gacp.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/gacp
Expand Down
26 changes: 0 additions & 26 deletions commands/cz.js

This file was deleted.

16 changes: 2 additions & 14 deletions commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
* @author vivaxy
*/

import inquirer from 'inquirer';

import isAGitRepository from '../lib/isAGitRepository';
import * as console from '../lib/console';
import acp from '../lib/acp';
import richPromopt from '../lib/richPrompt';

export default async(...restArgs) => {
if (!isAGitRepository()) {
Expand All @@ -16,18 +15,7 @@ export default async(...restArgs) => {
}
let commitMessage = null;
if (restArgs.length === 0) {
const answers = await inquirer.prompt([{
type: `input`,
name: `commitMessage`,
message: `please enter commit message:`,
validate: (msg) => {
if (!msg.length) {
return `commit message is required`;
}
return true;
},
}]);
commitMessage = answers.commitMessage;
commitMessage = await richPromopt();
} else {
commitMessage = restArgs.join(` `);
}
Expand Down
220 changes: 220 additions & 0 deletions configs/gitmojis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
{
"gitmojis": [
{
"emoji": "🎨",
"entity": "🎨",
"code": ":art:",
"description": "Improving structure / format of the code.",
"name": "art"
},
{
"emoji": "⚡️",
"entity": "⚡",
"code": ":zap:",
"description": "Improving performance.",
"name": "zap"
},
{
"emoji": "🔥",
"entity": "🔥",
"code": ":fire:",
"description": "Removing code or files.",
"name": "fire"
},
{
"emoji": "🐛",
"entity": "🐛",
"code": ":bug:",
"description": "Fixing a bug.",
"name": "bug"
},
{
"emoji": "🚑",
"entity": "🚑",
"code": ":ambulance:",
"description": "Critical hotfix.",
"name": "ambulance"
},
{
"emoji": "",
"entity": "✨",
"code": ":sparkles:",
"description": "Introducing new features.",
"name": "sparkles"
},
{
"emoji": "📝",
"entity": "📝",
"code": ":memo:",
"description": "Writing docs.",
"name": "memo"
},
{
"emoji": "🚀",
"entity": "🚀",
"code": ":rocket:",
"description": "Deploying stuff.",
"name": "rocket"
},
{
"emoji": "💄",
"entity": "&#ff99cc;",
"code": ":lipstick:",
"description": "Updating the UI and style files.",
"name": "lipstick"
},
{
"emoji": "🎉",
"entity": "🎉",
"code": ":tada:",
"description": "Initial commit.",
"name": "tada"
},
{
"emoji": "",
"entity": "✅",
"code": ":white_check_mark:",
"description": "Adding tests.",
"name": "white-check-mark"
},
{
"emoji": "🔒",
"entity": "🔒",
"code": ":lock:",
"description": "Fixing security issues.",
"name": "lock"
},
{
"emoji": "🍎",
"entity": "🍎",
"code": ":apple:",
"description": "Fixing something on macOS.",
"name": "apple"
},
{
"emoji": "🐧",
"entity": "🐧",
"code": ":penguin:",
"description": "Fixing something on Linux.",
"name": "penguin"
},
{
"emoji": "🏁",
"entity": "🏁",
"code": ":checkered_flag:",
"description": "Fixing something on Windows.",
"name": "checkered-flag"
},
{
"emoji": "🔖",
"entity": "🔖",
"code": ":bookmark:",
"description": "Releasing / Version tags.",
"name": "bookmark"
},
{
"emoji": "🚨",
"entity": "🚨",
"code": ":rotating_light:",
"description": "Removing linter warnings.",
"name": "rotating-light"
},
{
"emoji": "🚧",
"entity": "🚧",
"code": ":construction:",
"description": "Work in progress.",
"name": "construction"
},
{
"emoji": "💚",
"entity": "💚",
"code": ":green_heart:",
"description": "Fixing CI Build.",
"name": "green-heart"
},
{
"emoji": "⬇️",
"entity": "⬇️",
"code": ":arrow_down:",
"description": "Downgrading dependencies.",
"name": "arrow-down"
},
{
"emoji": "⬆️",
"entity": "⬆️",
"code": ":arrow_up:",
"description": "Upgrading dependencies.",
"name": "arrow-up"
},
{
"emoji": "👷",
"entity": "👷",
"code": ":construction_worker:",
"description": "Adding CI build system.",
"name": "construction-worker"
},
{
"emoji": "📈",
"code": ":chart_with_upwards_trend:",
"description": "Adding analytics or tracking code.",
"name": "chart-with-upwards-trend"
},
{
"emoji": "🔨",
"entity": "🛠",
"code": ":hammer:",
"description": "Heavy refactoring.",
"name": "hammer"
},
{
"emoji": "",
"entity": "➖",
"code": ":heavy_minus_sign:",
"description": "Removing a dependency.",
"name": "heavy-minus-sign"
},
{
"emoji": "🐳",
"entity": "🐳",
"code": ":whale:",
"description": "Work about Docker.",
"name": "whale"
},
{
"emoji": "",
"entity": "➕",
"code": ":heavy_plus_sign:",
"description": "Adding a dependency.",
"name": "heavy-plus-sign"
},
{
"emoji": "🔧",
"entity": "🔧",
"code": ":wrench:",
"description": "Changing configuration files.",
"name": "wrench"
},
{
"emoji": "🌐",
"entity": "🌐",
"code": ":globe_with_meridians:",
"description": "Internationalization and localization.",
"name": "globe-with-meridians"
},
{
"emoji": "✏️",
"entity": "",
"code": ":pencil2:",
"description": "Fixing typos.",
"name": "pencil"
},
{
"emoji": "💩",
"entity": "",
"code": ":hankey:",
"description": "Writing bad code that needs to be improved.",
"name": "hankey"
}
]
}
24 changes: 24 additions & 0 deletions lib/basicPrompt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @since 2016-11-23 10:08
* @author vivaxy
*/

import inquirer from 'inquirer';

export default async() => {
const questions = [
{
type: `input`,
name: `commitMessage`,
message: `please enter commit message:\n`,
validate: (msg) => {
if (!msg.length) {
return `commit message is required`;
}
return true;
},
},
];
const answers = await inquirer.prompt(questions);
return answers.commitMessage;
}
Loading

0 comments on commit b6f6233

Please sign in to comment.