Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🤖 🚀 ✨ Emojify your conventional commits with Devmoji

License

NotificationsYou must be signed in to change notification settings

folke/devmoji

Repository files navigation

Node CInpmGitHubGitHub top languageRenovate

UsingConventional Commits ⭐ as astandard for your commit messages, makesSemantic Versioning 🔖 as easy as can be, withtools likeConventional Changelog 📄,Standard Version 🔖andSemantic Release 📦🚀

Devmoji is a command line tool that adds color 🌈 to conventionalcommits, using emojis inspired byGitmoji 😜

Some of the thingsDevmoji can do:

  • emojify: convert input between diferent emojiformatsunicode,shortcode anddevmoji.devmoji are easy to rememberaliases like::test:,:refactor:,:docs:,:security instead of hard toremember emoji codes
  • git commit: install aprepare-commit-msg commithook to ✨ automagically emojify and lints your commit message
  • git log: emojify and colorify the output ofgit logeven for projects not using emojis

What does it look like?

📦 Installation

Install withnpm oryarn

globally

npm install -g devmojiyarn global add devmoji

locally inside your project. use withnpx devmoji

npm install --dev devmojiyarn add --dev devmoji

See--edit for information on how to setup a git commithook.

💥 Usage

devmoji --help

$devmoji --helpUsage: devmoji [options]Options:  -c|--config <file>    location of the devmoji.config.js file  -l|--list             list all known devmojis  -t|--text <text>      text to format. reads from stdin when omitted  --lint                lint the conventional commit. disabled for --log  -f|--format <format>  format should be one of: unicode, shortcode, devmoji (default: "unicode")  --commit              automatically add a devmoji to the conventional commit header (default: true)  --no-commit           do not process conventional commit headers  -e|--edit             read last commit message from .git/COMMIT_EDITMSG in the git root  --log                 format conventional commits in text similar to git log  --color               use colors for formatting. Colors are enabled by default, unless output is piped to another command (default: true)  --no-color            don't use colors  --version             output the version number  -h, --help            output usage information

devmoji emojify

Emojify text using--text or piping it tostdin. Input can be a combinationusing any valid format. Output formats:

FormatDescription
shortcodeoutputs Github Markdown short codes like:sparkles::rocket:
unicodeoutputs the emoji unicode symbols like ✨ 🚀
devmojioutputs the devmoji shortcodes like:feat::chore-release:
stripremoves all emoji from the input

The default format isunicode, since this can be used pretty much everywhereand has the shortest text length (relevant for commit messages)

$echo"This is a :test: of the first :release: :boom: ✨"| devmoji --format shortcodeThis is a :rotating_light: of the first :rocket: :boom: :sparkles:$echo"This is a :test: of the first :release: :boom: :sparkles:"| devmoji --format unicodeThis is a 🚨 of the first 🚀 💥 ✨$echo"🚀 :boom: :sparkles:"| devmoji --format devmoji:chore-release: :breaking: :feat:$echo"test 🚀 :boom: :sparkles: :security:"| devmoji --format striptest

devmoji --commit

Automagically ✨ emojifies a conventional commit message of the formattype(scope): something useful, using the following pseudo code:

if(exists(":type-scope:"))returnemoji(":type-scope:")if(exists(":type:")&&exists(":scope:"))returnemoji(":type:")+emoji(":scope:")if(exists(":type:"))returnemoji(":type:")

example ouput:

$echo"feat: added a new feature :smile:"| devmoji --commitfeat: ✨ added a new feature 😄$echo"chore(release): 1.1.1"| devmoji --commitchore(release): 🚀 1.1.1$echo"fix(security): upgraded lodash"| devmoji --commitfix(security): 🐛 🔒 upgraded lodash

devmoji --lint

Lints your commit message to see if they are valid conventional commits

devmoji --edit

Formats and saves your current commit message.git/COMMIT_EDITMSG. This isonly really useful as aprepare-commit-msg orcommit-msg hook.

When to use what hook?

  • prepare-commit-msg: use this if you do not useDevmnojis--lint option and want to use it with something likecommitlint instead.
  • commit-msg: use this hook if you also want to useDevmoji for linting

Configuration usingHusky

# make sure husky hooks are installed$ npx husky install# add a hook for devmoji$ npx husky add .husky/prepare-commit-msg"npx devmoji -e --lint"

Configuration usingYorkie

// package.json{"gitHooks":{"prepare-commit-msg":"devmoji -e --lint"}}

If you installedDevmoji locally in your project as a dev dependency, thenuse something likenpx --no-install devmoji -e instead of the commandsabove.

Alternatively, if you don't want to useHusky orYorkie, you canmanually create the git hooks.

devmoji --log

Works similar to--commit, but formatstype(scope): something usefulanywhere in the input instead of the beginning of the first line.

This is useful to format the output ofgit log. Anygit log option works,but my favorite alias is:

$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --decorate --date=short

I'll use my aliasgit l, instead of the above, for clarity. Thedevmoji --format strip is only for demonstration purposes, since all devmojicommits already have emojidevmoji --list

usingdevmoji --log >devmoji --list

devmoji --list

To get a list of all availableDevmoji, run with--list. (see alsoDefault Devmoji)

devmoji --list

⚙️ Configuration

devmoji uses the config file as specified with the--config option, or looksfordevmoji.config.js in the following paths:

  • current directory
  • parent directory that contains apackage.json file
  • parent directory that is agit repository
  • home directory

Example Config File

module.exports={// extra types used in commit messagestypes:["lint"],// custom devmojidevmoji:[// use :boom: instead of :sparkles: for the type 'feat'{code:"feat",emoji:"boom"},// add a custom devmoji{code:"fail",emoji:"poop",description:"something bad happened",},// add a new devmoji based on an existing gitmoji. description will be taken from the gitmoji{code:"css",gitmoji:"art",},// the emoji from the gitmoji can be overriden as well{code:"config",gitmoji:"wrench",emoji:"gear",},],}

Default Devmoji Reference

EmojiDevmoji CodeDescription
:feat:feat: a new feature
🐛:fix:fix: a bug fix
📚:docs:docs: documentation only changes
🎨:style:style: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
♻️:refactor:refactor: a code change that neither fixes a bug nor adds a feature
:perf:perf: a code change that improves performance
🚨:test:test: adding missing or correcting existing tests
🔧:chore:chore: changes to the build process or auxiliary tools and libraries such as documentation generation
🚀:chore-release:chore(release): code deployment or publishing to external repositories
🔗:chore-deps:chore(deps): add or delete dependencies
📦:build:build: changes related to build processes
👷:ci:ci: updates to the continuous integration system
🚀:release:code deployment or publishing to external repositories
🔒:security:Fixing security issues.
🌐:i18n:Internationalization and localization.
💥:breaking:Introducing breaking changes.
⚙️:config:Changing configuration files.
:add:add something
:remove:remove something

[8]ページ先頭

©2009-2025 Movatter.jp