包详细信息

devmoji

folke94.1kMIT2.3.0

Enhance your conventional commits with gitmoji

cli, command-line, commit, commitlint

自述文件

:sparkles: Devmoji

Node CI npm GitHub GitHub top language Renovate

Using Conventional Commits :star: as a standard for your commit messages, makes Semantic Versioning :bookmark: as easy as can be, with tools like Conventional Changelog :page_facing_up:, Standard Version :bookmark: and Semantic Release :package::rocket:

Devmoji is a command line tool that adds color :rainbow: to conventional commits, using emojis inspired by Gitmoji :stuck_out_tongue_winking_eye:

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 :sparkles: 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?

:package: 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.

:boom: 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 :sparkles: :rocket:
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 :sparkles: 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 Devmiji, run with --list. (see also Default Devmoji)

devmoji --list

:gear: 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
:sparkles: :feat: feat: a new feature
:bug: :fix: fix: a bug fix
:books: :docs: docs: documentation only changes
:art: :style: style: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
:recycle: :refactor: refactor: a code change that neither fixes a bug nor adds a feature
:zap: :perf: perf: a code change that improves performance
:rotating_light: :test: test: adding missing or correcting existing tests
:wrench: :chore: chore: changes to the build process or auxiliary tools and libraries such as documentation generation
:rocket: :chore-release: chore(release): code deployment or publishing to external repositories
:link: :chore-deps: chore(deps): add or delete dependencies
:package: :build: build: changes related to build processes
:construction_worker: :ci: ci: updates to the continuous integration system
:rocket: :release: code deployment or publishing to external repositories
:lock: :security: Fixing security issues.
:globe_with_meridians: :i18n: Internationalization and localization.
:boom: :breaking: Introducing breaking changes.
:gear: :config: Changing configuration files.
:heavy_plus_sign: :add: add something
:heavy_minus_sign: :remove: remove something

更新日志

2.3.0 (2021-06-18)

Features

Bug Fixes

  • test: 🐛 🚨 fixup for syntax error (404dce4)

Other

  • 🚨 fixed linting errors (b357026)
  • deps: update dependency @types/node to v14.14.45 (d748c98)
  • update: 🔧 updated deps (fc8b67c)

2.2.1 (2021-05-10)

Bug Fixes

  • deps: update dependency ts-interface-checker to v0.2.1 (2262197)

Other

  • deps: bump marked from 1.2.0 to 2.0.0 (#99) (f6c382b)
  • deps: bump node-notifier from 8.0.0 to 8.0.1 (#94) (cf87590)
  • deps: bump ssri from 6.0.1 to 6.0.2 (#104) (27d1d3f)
  • deps: update actions/setup-node action to v2 (#93) (7cf6c17)
  • deps: update dependency @rollup/plugin-node-resolve to v11.2.1 (03defe1)
  • deps: update dependency @rollup/plugin-typescript to v8.2.1 (3639584)
  • deps: update dependency @types/node to v14.14.44 (ea2306f)
  • deps: update dependency @types/node-fetch to v2.5.10 (8015efd)
  • deps: update dependency rollup-plugin-sizes to v1.0.4 (235dac2)
  • deps: update dependency typescript to v4.2.4 (33b64ce)
  • deps: update jest (1fe0cf2)

2.2.0 (2021-02-24)

Features

  • ✨ added support for fixup! & match! comments (155dee2)

Bug Fixes

  • 🐛 get --config value from Commander.opts() (a461c2b)

Other

  • deps: 🔗 update (979279e)
  • 📦️ updates for Husky 5 (bbc5f60)
  • deps: bump ini from 1.3.5 to 1.3.8 (#91) (79cb9cf)
  • deps: update all non-major dependencies (#90) (a779c80)

2.1.13 (2020-12-09)

Other

  • deps: update all non-major dependencies (#82) (f61c156)
  • deps: update dependency @rollup/plugin-commonjs to v17 (#83) (c82d733)
  • deps: update dependency @rollup/plugin-node-resolve to v11 (#84) (76f15ad)
  • deps: update dependency @rollup/plugin-typescript to v8 (#85) (5a10ee9)
  • deps: update dependency eslint-config-prettier to v7 (#88) (0e36770)

Documentation

  • 📚️ better docs about git commit hooks (8f7b36a)

2.1.12 (2020-11-30)

Bug Fixes

  • 🐛 use the color option for --log (fixes #81) (c7370de)

Other

  • 🎨 fixed linting errors for all src and tests source files (2a93269)
  • deps: update all non-major dependencies (#77) (fe86d3c)
  • deps: update all non-major dependencies (#80) (48596c4)

2.1.11 (2020-11-12)

Bug Fixes

  • lint: 🐛 detect BREAKING CHANGE in description. Fixes #76 (a3d5ab0)
  • lint: 🐛 scope and type can by any case. Fixes #75 (8138c84)

Other

  • deps: bump npm-user-validate from 1.0.0 to 1.0.1 (#69) (19ea27c)
  • deps: update actions/cache action to v2 (#71) (a91dbc4)
  • deps: update actions/checkout action to v2 (#72) (717ad15)
  • deps: update all non-major dependencies (#70) (7b8b05a)
  • deps: update dependency @rollup/plugin-commonjs to v16 (#73) (d5be625)
  • deps: update dependency @rollup/plugin-node-resolve to v10 (#74) (5202cc6)
  • maintenance: 🔧 updated deps and fixed some linting errors (169198f)

2.1.10 (2020-10-01)

Documentation

  • replace yarn install w/ yarn add (#65) (f9acf3e)

2.1.9 (2020-04-09)

Bug Fixes

  • 🐛 --lint shouldn't fail on merge commit message (fixes #50) (8ba3987)

Other

2.1.8 (2020-04-09)

Bug Fixes

  • deps: update dependency chalk to v4 (#49) (aefa669)

Other

  • deps: update all non-major dependencies (#48) (42431e0)

2.1.7 (2020-03-24)

Bug Fixes

  • 🐛 🔒️ upgrade minimist which had a security vulnerability (fc12464)

Other

  • deps: update all non-major dependencies (#45) (777695a)
  • deps: update all non-major dependencies (#47) (1eb8c52)
  • deps: update all non-major dependencies to v2.24.0 (#43) (205fbc3)
  • deps: update dependency prettier to v2 (#46) (975c593)
  • deps: update dependency rollup to v2.1.0 (#44) (7928c85)

2.1.6 (2020-03-15)

Bug Fixes

  • 🐛 new rollup version and commanderjs (41ae638)

Other

  • deps: update all non-major dependencies (#34) (f3fe5ab)
  • deps: update all non-major dependencies (#37) (acc0753)

2.1.5 (2020-03-10)

Other

  • deps: update all non-major dependencies (#15) (3df8504)
  • deps: update all non-major dependencies (#22) (e2b9050)
  • deps: update all non-major dependencies (#24) (32bebd2)
  • deps: update all non-major dependencies (#27) (570ef92)
  • deps: update all non-major dependencies (#29) (02fd806)
  • deps: update all non-major dependencies (#30) (b5491a5)
  • deps: update all non-major dependencies (#33) (1ae0e03)
  • deps: update dependency @rollup/plugin-typescript to v3 (#18) (c9a7a16)
  • deps: update dependency @types/jest to v25 (#16) (555f6fe)
  • deps: update dependency @types/jest to v25.1.2 (#28) (818cfbb)
  • deps: update dependency @types/node to v13.7.0 (#26) (7e6f547)
  • deps: update dependency eslint-config-prettier to v6.10.0 (#21) (364a982)
  • deps: update dependency rimraf to v3.0.1 (#20) (7e208a9)
  • deps: update dependency rollup to v1.31.1 (#31) (21fc914)
  • deps: update dependency rollup to v2 (#35) (7ab9605)
  • deps: update dependency semantic-release to v17 (#17) (7b497af)
  • deps: update dependency semantic-release to v17.0.2 (#25) (4b0b17a)
  • deps: update dependency ts-jest to v25.1.0 (#23) (8c3214b)
  • deps: update semantic-release monorepo (#19) (18c2f33)

Documentation

2.1.4 (2020-01-27)

Bug Fixes

  • 🐛 fixed endless loop on win32 (a3026e1)

Other

  • deps: update all non-major dependencies (#14) (e2e724b)

2.1.3 (2020-01-25)

Other

  • github: 👷 run semantic-release only on master (8fb91ca)
  • github: 👷 run semantic-release only on master (57b0611)
  • github: 👷 run semantic-release only on master (fa7d061)

Documentation

  • 📚️ testing gihub releases (3c74ce8)

2.1.2 (2020-01-25)

Documentation

Other

  • deps: 👷 automerge minor, patch, pin and digest (578258b)
  • deps: 👷 group all non-major updates (abe0982)
  • deps: update all non-major dependencies (#12) (2f7236f)
  • deps: update dependency rollup to v1.29.1 (#6) (49285e3)
  • deps: update jest (#13) (51ac0a8)
  • github: 👷 added semantic-release (486e1a6)
  • github: 👷 use node 12.x LTS version (22b627f)
  • renovate: 👷 group eslint and jest deps (248a8db)
  • renovate: 👷 rules order (1c1dc10)
  • 👷 added support for [skip ci] (7b6d374)
  • 👷 added support for [skip ci] (5f428db)
  • 🔧 updated release.config.js (7e365ce)

2.1.1 (2020-01-25)

Bug Fixes

  • 🐛 fixed callstack error for Windows (9f411d2)

2.1.0 (2020-01-25)

Features

  • ✨ added commit linting! (2d52f2c)

2.0.3 (2020-01-22)

Bug Fixes

  • 🐛 show correct --version (959d216)

2.0.2 (2020-01-22)

Bug Fixes

  • 🐛 colors are now properly disabled when not on a TTY (36406c5)

2.0.1 (2020-01-16)

Bug Fixes

  • docs: 🐛 📚️ updated docs (667db23)

2.0.0 (2020-01-16)

Bug Fixes

  • config: 🐛 ⚙️ added correct search paths for config file (63d2488)
  • emoji: 🐛 added support for colorful emoji variations (dff0ede)
  • emoji: 🐛 fixed emoji variations (2d60115)
  • emoji: 🐛 use unicode emoji variations when available (c0ff022)
  • feat(commit)!: 💥 ✨ added support for ! in a breaking change header (23ec3c9)

BREAKING CHANGES

  • added breaking change support 😄

1.2.2 (2020-01-15)

1.2.1 (2020-01-15)

Bug Fixes

  • docs: 🐛 📚 updated README.md (6366bd3)

1.2.0 (2020-01-15)

Bug Fixes

  • cli: 🐛 all output now honors --no-color (a44e628)

Features

  • config: ✨ ⚙ ➕ devmojis for config, add, remove (faa3aac)

1.1.1 (2020-01-15)

Bug Fixes

  • security: 🐛 🔒 upgraded lodash & underscore from security advisory (d2d39be)

1.1.0 (2020-01-15)

Features

  • ✨ added semantic-release (a597cd1)

0.0.0 (2020-01-14)

Features

  • ✨ added support for git hooks (799f156)
  • ✨ refactored config files and added runtime validation (cc94e2c)
  • ✨ we now support scope based devmojis and --color for --log (a3df981)
  • cli: ✨ added cli for working with devmoji 🚀 (8f16492)
  • config: ✨ added devmoji configs (4379667)
  • emoji: :sparkles: added script to fetch github and gitmoji (aecf9df)
  • ✨ devmoji package (e7e2b61)

Performance Improvements

  • ⚡ configured vscode debugging support (1e0876a)

BREAKING CHANGES

  • devmoji can now be used as a prepare-commit-msg hook to automagically add emojis to commit messages