A commitizen adapter with emoji that follows conventional-changelog.
English | 简体中文
Select the type of change that you're committing: (Use arrow keys)
❯ ✨ feat: Introduce new features
🐛 fix: Fix a bug
🚑 hotfix: Critical bug fix
📝 docs: Add or update documentation
💄 style: Add or update the UI and style files
♻️ refactor: Refactor code
⚡ perf: Improve performance
✅ test: Add, update, or pass tests
🏗️ build: Make architectural changes
👷 ci: Add or update CI build system
✏️ chore: Fix typos
⏪ revert: Revert changes
(Move up and down to reveal more choices)
- 🎨 70+ Gitmoji Types - Comprehensive emoji support for all commit scenarios
- 🔧 Flexible Configuration - Global, project-level, or environment variable configuration
- 📦 Standard-Version Compatible - Works seamlessly with automated versioning tools
- 💪 TypeScript Support - Complete type definitions included
- ✅ Well Tested - 174 tests with 95.8% core engine coverage
- 🎯 Commitizen Friendly - Fully compatible with commitizen ecosystem
Get started in 60 seconds:
# 1. Install
npm install --save-dev cz-conventional-emoji
# 2. Configure (add to package.json)
npm pkg set config.commitizen.path="./node_modules/cz-conventional-emoji"
# 3. Use it!
git cz
That's it! Now you can create beautiful commits with emojis. 🎉
This project is based on cz-conventional-changelog with the following enhancements:
- Enhanced Gitmoji Support: Improved gitmoji integration with better alignment, spacing, and terminal display
- Fixed Emoji Rendering: Added proper spacing to resolve Variation Selector-16 terminal display issues
- Better Type Sorting: Reordered commit types to match conventional-commit-types standards
- Extended Gitmoji Types: Support for 70+ gitmoji types with comprehensive coverage
- standard-version Compatible: Commit message format adjusted to
type(scope): emoji subject
to ensure full compatibility with standard-version
All original features are preserved while adding these improvements for a better user experience.
To ensure compatibility with tools like standard-version, the commit message format has been adjusted to:
type(scope): emoji subject
Format Explanation:
type
: Commit type (feat, fix, docs, etc.)scope
: Optional scopeemoji
: Corresponding gitmoji emojisubject
: Short description
This format ensures:
- Standard Compatibility: Type at the beginning of the message, conforming to conventional commit specifications
- Tool Support: Can be correctly recognized by tools like standard-version, commitlint, etc.
- Visual Appeal: Still retains the visual cue function of emoji
We assume you have already installed Commitizen.
# Using npm
npm install --global cz-conventional-emoji
# Using yarn
yarn global add cz-conventional-emoji
# Using pnpm
pnpm add --global cz-conventional-emoji
# Set global default adapter
echo '{ "path": "cz-conventional-emoji" }' > ~/.czrc
# Install as dev dependency
npm install --save-dev cz-conventional-emoji
Then add to your package.json
:
{
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-emoji"
}
}
}
Or use the quick command:
npm pkg set config.commitizen.path="./node_modules/cz-conventional-emoji"
When you need to commit, simply use git cz
instead of git commit
:
git add .
git cz
See the Commitizen official documentation for more information.
Add configuration to your package.json
:
{
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-emoji",
"useGitmoji": true,
"maxHeaderWidth": 100,
"maxLineWidth": 100
}
}
}
Create a .czrc
file in your project root or home directory:
{
"path": "cz-conventional-emoji",
"useGitmoji": true,
"maxHeaderWidth": 100,
"maxLineWidth": 100
}
You can also configure via environment variables:
# Disable gitmoji mode
CZ_USE_GITMOJI=false git cz
# Set custom max widths
CZ_MAX_HEADER_WIDTH=80 git cz
CZ_MAX_LINE_WIDTH=120 git cz
# Set defaults
CZ_TYPE=feat CZ_SCOPE=api git cz
Option | Type | Default | Description |
---|---|---|---|
useGitmoji |
boolean | true |
Enable/disable gitmoji mode |
maxHeaderWidth |
number | 100 |
Maximum header length |
maxLineWidth |
number | 100 |
Maximum line width for body/footer |
defaultType |
string | - | Default commit type |
defaultScope |
string | - | Default scope |
defaultSubject |
string | - | Default subject |
defaultBody |
string | - | Default body |
defaultIssues |
string | - | Default issues |
disableScopeLowerCase |
boolean | false |
Disable scope lowercase |
disableSubjectLowerCase |
boolean | false |
Disable subject lowercase |
If you prefer traditional commits without emoji:
Global Configuration:
echo '{ "path": "cz-conventional-emoji", "useGitmoji": false }' > ~/.czrc
Project Configuration:
{
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-emoji",
"useGitmoji": false
}
}
}
Environment Variable:
CZ_USE_GITMOJI=false git cz
Emoji | Type Name | Description |
---|---|---|
✨ | feat |
Introduce new features |
🐛 | fix |
Fix a bug |
🚑 | hotfix |
Critical bug fix |
📝 | docs |
Add or update documentation |
💄 | style |
Add or update UI and style files |
♻️ | refactor |
Refactor code |
⚡ | perf |
Improve performance |
✅ | test |
Add, update, or pass tests |
🏗️ | build |
Add or update build system |
👷 | ci |
Add or update CI configuration |
✏️ | chore |
Fix typos or text corrections |
⏪ | revert |
Revert changes |
feat(api): ✨ add user authentication endpoint
Add OAuth2 authentication support for Google and GitHub providers.
Includes user profile management and token refresh functionality.
Closes #123
feat(api): add user authentication endpoint
Add OAuth2 authentication support for Google and GitHub providers.
Includes user profile management and token refresh functionality.
Closes #123
With the provided .versionrc.js
configuration:
# Minor version bump (1.1.2 → 1.2.0)
feat(auth): ✨ add OAuth2 support
# Patch version bump (1.1.2 → 1.1.3)
fix(api): 🐛 resolve authentication bug
# Major version bump (1.1.2 → 2.0.0)
feat(api): 💥 redesign authentication system
BREAKING CHANGE: The authentication API has been completely redesigned.
Note: The
.versionrc.js
configuration file is specifically forstandard-version
. If you're usingsemantic-release
, you'll need a different configuration format (.releaserc
orrelease.config.js
).
-
Install standard-version:
npm install --save-dev standard-version
-
Add scripts to package.json:
{ "scripts": { "release": "standard-version" } }
-
Generate changelog and bump version:
npm run release
Click to expand full .versionrc.js configuration
To enable all gitmoji types in changelog generation and version bumping, create a .versionrc.js
file in your project root:
module.exports = {
"types": [
// Standard types
{ "type": "feat", "section": "Features", "bump": "minor" },
{ "type": "fix", "section": "Bug Fixes", "bump": "patch" },
{ "type": "perf", "section": "Performance Improvements", "bump": "patch" },
// Extended types - Minor version (new features)
{ "type": "hotfix", "section": "Hotfixes", "bump": "minor" },
{ "type": "init", "section": "Features", "bump": "minor" },
{ "type": "seed", "section": "Features", "bump": "minor" },
{ "type": "easter-egg", "section": "Features", "bump": "minor" },
{ "type": "feature-flags", "section": "Features", "bump": "minor" },
{ "type": "animation", "section": "Features", "bump": "minor" },
{ "type": "auth", "section": "Features", "bump": "minor" },
{ "type": "business-logic", "section": "Features", "bump": "minor" },
{ "type": "dx", "section": "Features", "bump": "minor" },
{ "type": "sponsors", "section": "Features", "bump": "minor" },
{ "type": "concurrency", "section": "Features", "bump": "minor" },
{ "type": "validation", "section": "Features", "bump": "minor" },
{ "type": "offline", "section": "Features", "bump": "minor" },
// Extended types - Patch version (fixes & improvements)
{ "type": "security", "section": "Bug Fixes", "bump": "patch" },
{ "type": "ci-fix", "section": "Bug Fixes", "bump": "patch" },
{ "type": "warn", "section": "Bug Fixes", "bump": "patch" },
{ "type": "quick-fix", "section": "Bug Fixes", "bump": "patch" },
{ "type": "error-handling", "section": "Bug Fixes", "bump": "patch" },
{ "type": "dead-code", "section": "Bug Fixes", "bump": "patch" },
{ "type": "failing-test", "section": "Bug Fixes", "bump": "patch" },
{ "type": "health-check", "section": "Bug Fixes", "bump": "patch" },
{ "type": "style", "section": "Performance Improvements", "bump": "patch" },
{ "type": "refactor", "section": "Performance Improvements", "bump": "patch" },
{ "type": "accessibility", "section": "Performance Improvements", "bump": "patch" },
{ "type": "ux", "section": "Performance Improvements", "bump": "patch" },
{ "type": "responsive", "section": "Performance Improvements", "bump": "patch" },
{ "type": "seo", "section": "Performance Improvements", "bump": "patch" },
{ "type": "types", "section": "Performance Improvements", "bump": "patch" },
{ "type": "text", "section": "Performance Improvements", "bump": "patch" },
{ "type": "database", "section": "Performance Improvements", "bump": "patch" },
{ "type": "experiment", "section": "Performance Improvements", "bump": "patch" },
{ "type": "deprecate", "section": "Performance Improvements", "bump": "patch" },
// Hidden types (not shown in changelog)
{ "type": "docs", "section": "Documentation", "hidden": true, "bump": "patch" },
{ "type": "test", "section": "Tests", "hidden": true, "bump": "patch" },
{ "type": "build", "section": "Build System", "hidden": true, "bump": "patch" },
{ "type": "ci", "section": "CI", "hidden": true, "bump": "patch" },
{ "type": "chore", "section": "Chores", "hidden": true, "bump": "patch" },
{ "type": "revert", "section": "Reverts", "hidden": true, "bump": "patch" },
{ "type": "wip", "section": "Work in Progress", "hidden": true, "bump": "patch" },
{ "type": "release", "section": "Releases", "hidden": true, "bump": "patch" },
{ "type": "breaking", "section": "Breaking Changes", "bump": "major" },
{ "type": "remove", "section": "Removals", "hidden": true, "bump": "patch" },
{ "type": "secrets", "section": "Secrets", "hidden": true, "bump": "patch" },
{ "type": "version", "section": "Versions", "hidden": true, "bump": "patch" },
{ "type": "downgrade", "section": "Downgrades", "hidden": true, "bump": "patch" },
{ "type": "upgrade", "section": "Upgrades", "hidden": true, "bump": "patch" },
{ "type": "pin", "section": "Pins", "hidden": true, "bump": "patch" },
{ "type": "analytics", "section": "Analytics", "hidden": true, "bump": "patch" },
{ "type": "deps-add", "section": "Dependencies", "hidden": true, "bump": "patch" },
{ "type": "deps-remove", "section": "Dependencies", "hidden": true, "bump": "patch" },
{ "type": "i18n", "section": "Internationalization", "hidden": true, "bump": "patch" },
{ "type": "bad-code", "section": "Code Quality", "hidden": true, "bump": "patch" },
{ "type": "merge", "section": "Merges", "hidden": true, "bump": "patch" },
{ "type": "package", "section": "Packages", "hidden": true, "bump": "patch" },
{ "type": "external-api", "section": "External APIs", "hidden": true, "bump": "patch" },
{ "type": "move", "section": "Moves", "hidden": true, "bump": "patch" },
{ "type": "license", "section": "Licenses", "hidden": true, "bump": "patch" },
{ "type": "assets", "section": "Assets", "hidden": true, "bump": "patch" },
{ "type": "comments", "section": "Comments", "hidden": true, "bump": "patch" },
{ "type": "drunk-code", "section": "Code Quality", "hidden": true, "bump": "patch" },
{ "type": "logs", "section": "Logs", "hidden": true, "bump": "patch" },
{ "type": "remove-logs", "section": "Logs", "hidden": true, "bump": "patch" },
{ "type": "contributors", "section": "Contributors", "hidden": true, "bump": "patch" },
{ "type": "mock", "section": "Mocks", "hidden": true, "bump": "patch" },
{ "type": "gitignore", "section": "Git", "hidden": true, "bump": "patch" },
{ "type": "snapshots", "section": "Snapshots", "hidden": true, "bump": "patch" },
{ "type": "infrastructure", "section": "Infrastructure", "hidden": true, "bump": "patch" }
]
}
- Major version (1.0.0 → 2.0.0):
breaking
(when using BREAKING CHANGE footer) - Minor version (1.0.0 → 1.1.0):
feat
,hotfix
,init
,seed
,easter-egg
,feature-flags
,animation
,auth
,business-logic
,dx
,sponsors
,concurrency
,validation
,offline
- Patch version (1.0.0 → 1.0.1):
fix
,perf
,security
,ci-fix
,warn
,quick-fix
,error-handling
,dead-code
,failing-test
,health-check
,style
,refactor
,accessibility
,ux
,responsive
,seo
,types
,text
,database
,experiment
,deprecate
,docs
,test
,build
,ci
,chore
,revert
,wip
,release
,remove
,secrets
,version
,downgrade
,upgrade
,pin
,analytics
,deps-add
,deps-remove
,i18n
,bad-code
,merge
,package
,external-api
,move
,license
,assets
,comments
,drunk-code
,logs
,remove-logs
,contributors
,mock
,gitignore
,snapshots
,infrastructure
-
Install standard-version:
npm install --save-dev standard-version
-
Add scripts to package.json:
{ "scripts": { "release": "standard-version" } }
-
Generate changelog and bump version:
npm run release
This configuration will:
- Include all gitmoji types in version bumping with proper
bump
attributes - Generate comprehensive changelogs with proper categorization
- Hide non-essential types from changelog while still processing them
- Automatically bump version numbers based on commit types
If you prefer semantic-release
over standard-version
, create a .releaserc
file instead:
{
"branches": ["main"],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{ "type": "feat", "release": "minor" },
{ "type": "fix", "release": "patch" },
{ "type": "hotfix", "release": "minor" },
{ "type": "perf", "release": "patch" },
{ "type": "breaking", "release": "major" }
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github"
]
}
Key Differences:
standard-version
: Uses.versionrc.js
withbump
attributessemantic-release
: Uses.releaserc
withreleaseRules
and plugin system- Both tools analyze conventional commits but use different configuration formats
For other popular semantic versioning tools in the Node.js ecosystem, please refer to their respective documentation:
- conventional-changelog: Uses different configuration format
- release-it: Has its own configuration system
- lerna: Uses
lerna.json
for configuration
Each tool has its own way of handling conventional commits and version bumping. The .versionrc.js
format shown above is specific to standard-version
only.
No, this is a commitizen adapter that requires commitizen to be installed. Install it with npm install -g commitizen
.
Yes! You can integrate it with Husky pre-commit hooks. Add to your .husky/prepare-commit-msg
:
exec < /dev/tty && node_modules/.bin/cz --hook || true
Use the environment variable: CZ_USE_GITMOJI=false git cz
Currently, the gitmoji types are predefined based on the gitmojis specification. For custom types, you can configure conventional types in your .czrc
file.
Make sure to use the correct value format:
- ✅
CZ_USE_GITMOJI=true
orCZ_USE_GITMOJI=false
- ❌ Not just
CZ_USE_GITMOJI
(this won't work)
This adapter automatically reads commitlint configuration. Just install @commitlint/load
and configure your .commitlintrc.js
.
Yes! You can set different scopes for different packages in your monorepo. The scope field is fully customizable.
Contributions are welcome! We'd love your help to make this project even better.
- 🐛 Found a bug? Open an issue
- 💡 Have a feature idea? Start a discussion
- 📖 Improve documentation - Fix typos, add examples, clarify instructions
- 🔀 Submit a Pull Request - Bug fixes, features, or improvements
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/cz-conventional-emoji.git
- Install dependencies:
pnpm install
- Make your changes
- Run tests:
pnpm test
- Run linter:
pnpm lint
- Submit a PR
For detailed guidelines, please read our Contributing Guide (中文版).
gaoancun [email protected]
- commitizen - commitizen CLI
- cz-conventional-changelog - Original conventional changelog adapter
- conventional-changelog - Generate changelogs from git metadata
- conventional-commit-types - List of conventional commit types
- gitmoji - An emoji guide for your commit messages