gitemojify
v1.0.1
Published
Add emoji prefix to conventional commit messages
Maintainers
Readme
gitemojify
Add emoji prefix to conventional commit messages automatically.
Installation
npm install -D gitemojify
# or
pnpm add -D gitemojify
# or
yarn add -D gitemojify
# or
bun add -D gitemojifyUsage
With Husky
Add to your .husky/commit-msg hook:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit $1
npx --no -- gitemojify $1Or with bun:
bunx --no -- commitlint --edit $1
bunx --no -- gitemojify $1How it works
The tool reads your commit message from the git commit message file, parses the conventional commit type, and adds the corresponding emoji prefix:
| Type | Emoji | |------|-------| | feat | ✨ | | fix | 🐛 | | docs | 📝 | | style | 🎨 | | refactor | ♻️ | | perf | ⚡️ | | test | ✅ | | build | 🏗️ | | ci | 👷 | | chore | 🔧 |
Examples
| Before | After |
|--------|-------|
| feat: add new feature | ✨ feat: add new feature |
| fix(auth): resolve login issue | 🐛 fix(auth): resolve login issue |
| docs: update readme | 📝 docs: update readme |
Programmatic API
import { emojify, emojiMap } from 'gitemojify'
// Emojify a commit message file
emojify('.git/COMMIT_EDITMSG')
// With custom emoji map
emojify('.git/COMMIT_EDITMSG', {
emojiMap: {
...emojiMap,
release: '🚀',
},
})Inspired by
- @janna/lint - emojify feature
- gitmoji
- devmoji
License
MIT
