0.0.17 • Published 4 months ago

@humankode/git-commit-emojify v0.0.17

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

git-commit-emojify Build status @humankode/git-commit-emojify on npm

A prepare-commit-msg git hook script to automatically add emojis to git commit messages

For example, git commit -m "hotfix to fix caching"

//=> 🚑 hotfix to fix caching

or

in branch feature-implement-caching

git commit -m "implemented caching" (uses branch name to determine which emoji to use if not enough context in the commit message)

//=> ✨ implemented caching

Usage

Install and configure Husky

.husky/prepare-commit-msg

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --yes @humankode/git-commit-emojify@latest

Zero config by default

Zero configuration by default.

If no configuration specified, it will

  • map a commit message to an emoji using emojiKeywordMap.ts
  • if unable to map a message to an emoji, it will attempt to map the branch name to an emoji using branchTypes.ts

Configuration

To override the default configuration, place a file called gitEmojify.json in your root directory.

Refer to the Configuration interface for all options.

Example configurations

1. Override branch type configuration

gitEmojify.json

{
  "branchTypes": {
    "build": {
      "emoji": "👷"
    },
    "bugfix": {
      "emoji": "🐛"
    }
  }
}

For example

branch: build-updates

git commit message: git commit -m "ci updates"

//=> 👷 ci updates

2. Suffix the emoji

gitEmojify.json

{
  "prefixEmoji": false
}

This will place the emoji at the end of the commit message.

For example

branch: build-updates

git commit message: git commit -m "ci updates"

//=> ci updates 👷

3. Override emoji keywords

gitEmojify.json

{
  "emojiKeywords": [
    {
      "keywords": ['bug'],
      "emoji": "🪲",
    },
    {
      keywords: ["revert"],
      emoji: "⏪️",
    }
  ]
}

For example

branch: build-updates

git commit message: git commit -m "bugfix"

//=> 🪲 bugfix

4. Complete configuration example

gitEmojify.json

{
  "prefixEmoji": true,
  "branchTypes": {
    "build": {
      "emoji": "👷"
    },
    "bugfix": {
      "emoji": "🐛"
    }
  },
  "emojiKeywords": [
    {
      "keywords": ['bug'],
      "emoji": "🪲",
    },
    {
      keywords: ["revert"],
      emoji: "⏪️",
    }
  ]
}

This will override the configuration for emojiKeywords and will match the keywords bug and revert to commit messages.

Maintainers

0.0.16

4 months ago

0.0.17

4 months ago

0.0.15

4 months ago

0.0.11

4 months ago

0.0.12

4 months ago

0.0.13

4 months ago

0.0.14

4 months ago

0.0.9

4 months ago

0.0.8

4 months ago

0.0.7

4 months ago

0.0.6

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.3

4 months ago

0.0.2

4 months ago

0.0.1

4 months ago