commit-prettier v1.1.0
commit-prettier
commit-prettier
is a light-weight CLI that enhances your commit messages by appending an emoji related to the type of commit you make. It seamlessly integrates with commitlint
, supporting all standard commit types including:
| Type | Emoji |
| ------------- | ------------- |
| build | ๐๏ธ |
| chore | ๐งน |
| ci | ๐ท |
| docs | ๐ |
| feat | โจ |
| fix | ๐ |
| perf | โก๏ธ |
| refactor | โป๏ธ |
| revert | โช๏ธ |
| style | ๐ |
| test | ๐งช |
Features
- Emoji Prefixes: Automatically adds an emoji as a prefix to your commit messages after they pass commitlint checks, making your commit history more expressive and easier to navigate.
- Branch Name Prefixes: Automatically adds branch name into commit scope if there is no scope provided (default is off).
- Commitlint Compatibility: Fully compatible with all commitlint types, ensuring your commit messages are both fun and professional.
- Easy Integration: Works with existing git hooks and can be integrated smoothly into your workflow.
Getting Started
Installation
Using npm:
npm install --save-dev commit-prettier
or if you prefer using Yarn:
yarn add --dev commit-prettier
Setup
To integrate commit-prettier
with Husky (version >= 8.0.0), follow these steps:
- First, ensure you have Husky installed. If not, please follow the instructions.
- Create a
commit-msg
file in the.husky
directory with the following content:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run commit-prettier $1
NOTE: Make sure to make the script executable by running:
chmod +x .husky/commit-msg
Usage
Once everything is set up, you can start committing with:
git commit -m "feat(homepage): achieve UI revamp 2.0"
// Output: โจ feat(homepage): achieve UI revamp 2.0
If you need to work with a ticket system and have enough of typing this number, you can enable the --branch
option in your package.json
file:
{
"scripts": {
"commit-prettier": "commit-prettier --branch",
}
}
Then commit-prettier
will do this for you! ๐
git commit -m "style: add confetti animation on the login page"
// Output: ๐ style(JA-1234): add confetti animation on the login page