• Stars
    star
    286
  • Rank 139,721 (Top 3 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 15 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ€– πŸš€ ✨ Emojify your conventional commits with Devmoji

✨ Devmoji

Node CI npm GitHub GitHub top language Renovate

Using Conventional Commits ⭐ as a standard for your commit messages, makes Semantic Versioning πŸ”– as easy as can be, with tools like Conventional Changelog πŸ“„, Standard Version πŸ”– and Semantic Release πŸ“¦πŸš€

Devmoji is a command line tool that adds color 🌈 to conventional commits, using emojis inspired by Gitmoji 😜

Some of the things Devmoji can do:

  • emojify: convert input between diferent emoji formats unicode, shortcode and devmoji. devmoji are easy to remember aliases like: :test:, :refactor:, :docs:, :security instead of hard to remember emoji codes
  • git commit: install a prepare-commit-msg commit hook to ✨ automagically emojify and lints your commit message
  • git log: emojify and colorify the output of git log even for projects not using emojis

What does it look like?

πŸ“¦ Installation

Install with npm or yarn

globally

npm install -g devmoji
yarn global add devmoji

locally inside your project. use with npx devmoji

npm install --dev devmoji
yarn add --dev devmoji

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

πŸ’₯ Usage

devmoji --help

$ devmoji --help
Usage: 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 to stdin. Input can be a combination using any valid format. Output formats:

Format Description
shortcode outputs Github Markdown short codes like :sparkles: :rocket:
unicode outputs the emoji unicode symbols like ✨ πŸš€
devmoji outputs the devmoji shortcodes like :feat: :chore-release:
strip removes all emoji from the input

The default format is unicode, since this can be used pretty much everywhere and has the shortest text length (relevant for commit messages)

$ echo "This is a :test: of the first :release: :boom: ✨" | devmoji --format shortcode
This is a :rotating_light: of the first :rocket: :boom: :sparkles:

$ echo "This is a :test: of the first :release: :boom: :sparkles:" | devmoji --format unicode
This is a 🚨 of the first πŸš€ πŸ’₯ ✨

$ echo "πŸš€ :boom: :sparkles:" | devmoji --format devmoji
:chore-release: :breaking: :feat:

$ echo "test πŸš€ :boom: :sparkles: :security:" | devmoji --format strip
test

devmoji --commit

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

if (exists(":type-scope:")) return emoji(":type-scope:")

if (exists(":type:") && exists(":scope:"))
  return emoji(":type:") + emoji(":scope:")

if (exists(":type:")) return emoji(":type:")

example ouput:

$ echo "feat: added a new feature :smile:" | devmoji --commit
feat: ✨ added a new feature πŸ˜„

$ echo "chore(release): 1.1.1" | devmoji --commit
chore(release): πŸš€ 1.1.1

$ echo "fix(security): upgraded lodash" | devmoji --commit
fix(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 is only really useful as a prepare-commit-msg or commit-msg hook.

When to use what hook?

  • prepare-commit-msg: use this if you do not use Devmnojis --lint option and want to use it with something like commitlint instead.
  • commit-msg: use this hook if you also want to use Devmoji for linting

Configuration using Husky

# 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 using Yorkie

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

If you installed Devmoji locally in your project as a dev dependency, then use something like npx --no-install devmoji -e instead of the commands above.

Alternatively, if you don't want to use Husky or Yorkie, you can manually create the git hooks.

devmoji --log

Works similar to --commit, but formats type(scope): something useful anywhere in the input instead of the beginning of the first line.

This is useful to format the output of git log. Any git 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 alias git l, instead of the above, for clarity. The devmoji --format strip is only for demonstration purposes, since all devmoji commits already have emoji devmoji --list

using devmoji --log > devmoji --list

devmoji --list

To get a list of all available Devmoji, run with --list. (see also Default Devmoji)

devmoji --list

βš™οΈ Configuration

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

  • current directory
  • parent directory that contains a package.json file
  • parent directory that is a git repository
  • home directory

Example Config File

module.exports = {
  // extra types used in commit messages
  types: ["lint"],
  // custom devmoji
  devmoji: [
    // 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

Emoji Devmoji Code Description
✨ :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

More Repositories

1

lazy.nvim

πŸ’€ A modern plugin manager for Neovim
Lua
11,777
star
2

tokyonight.nvim

πŸ™ A clean, dark Neovim theme written in Lua, with support for lsp, treesitter and lots of plugins. Includes additional themes for Kitty, Alacritty, iTerm and Fish.
Lua
5,173
star
3

trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Lua
4,726
star
4

which-key.nvim

πŸ’₯ Create key bindings that stick. WhichKey is a lua plugin for Neovim 0.5 that displays a popup with possible keybindings of the command you started typing.
Lua
4,441
star
5

noice.nvim

πŸ’₯ Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Lua
3,677
star
6

todo-comments.nvim

βœ… Highlight, list and search todo comments in your projects
Lua
2,711
star
7

flash.nvim

Navigate your code with search labels, enhanced character motions and Treesitter integration
Lua
1,965
star
8

neodev.nvim

πŸ’» Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API.
Lua
1,935
star
9

zen-mode.nvim

🧘 Distraction-free coding for Neovim
Lua
1,442
star
10

ultra-runner

πŸƒβ›° Ultra fast monorepo script runner and build tool
TypeScript
1,188
star
11

twilight.nvim

πŸŒ… Twilight is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing using TreeSitter.
Lua
1,130
star
12

esbuild-runner

⚑️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild
TypeScript
701
star
13

dot

β˜•οΈ My Dot Files
Lua
670
star
14

edgy.nvim

Easily create and manage predefined window layouts, bringing a new edge to your workflow
Lua
665
star
15

neoconf.nvim

πŸ’Ό Neovim plugin to manage global and project-local settings
Lua
605
star
16

persistence.nvim

πŸ’Ύ Simple session management for Neovim
Lua
533
star
17

lsp-colors.nvim

🌈 Plugin that creates missing LSP diagnostics highlight groups for color schemes that don't yet support the Neovim 0.5 builtin LSP client.
Lua
434
star
18

styler.nvim

Simple Neovim plugin to set a different colorscheme per filetype.
Lua
247
star
19

drop.nvim

🍁 Fun little plugin that can be used as a screensaver and on your dashboard
Lua
190
star
20

polydock

✨ A shiny and hackable application dock
TypeScript
179
star
21

paint.nvim

Easily add additional highlights to your buffers
Lua
152
star
22

vscode-monorepo-workspace

πŸ“¦βœ¨Manage monorepos with multi-root workspaces. Supports Lerna, Yarn, Pnpm, Rushjs and recursive package directories.
TypeScript
138
star
23

splashcii

Simple cli tool that shows a random ascii art from https://www.asciiur.com/
TypeScript
35
star
24

semantic-release-commit-filter

πŸ“¦πŸ•΅οΈβ€β™€οΈ Semantic-release plugin that filters git commits based on the current working directory
JavaScript
25
star
25

zmk-config

Folke's ZMK config
C++
21
star
26

lovelace-styler

Custom styling for lovelace cards
TypeScript
18
star
27

folke

7
star
28

phpintel

Accurate autocompletion / code checking / .... framework for PHP
PHP
3
star
29

adventofcode

πŸŽ… πŸŽ„ β›„ ✨ Solutions for Advent of Code 2020 in TypeScript
TypeScript
2
star
30

chess

C#
2
star
31

adventofcode2019

Advent of Code 2019 in TypeScript
TypeScript
2
star