npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

commit-msg-must-use-emoji

v1.1.3

Published

πŸ’Œ Easy-to-add Git hook that forces you to start every commit message with an emoji

Downloads

23

Readme

commit-msg-must-use-emoji

πŸ’Œ Easy-to-add Git hook that forces you to start every commit message with an emoji

What is this?

Once you install this, whenever you try to commit and your message doesn't start with an emoji, your commit will fail and you'll be prompted to amend it. You can bypass it by adding --no-verify to git commit.

Why is this?

Lots of people seem interested in using emoji in Git commit messages, for various reasons. You can do this in some consistent way to communicate stuff, or you can just do it to add fun to the world (or both).

Emoji bring a lot of light to my life. Do I really want them in every commit message? I don't know; let's find out.

No other tool did exactly what I wanted here, so I thought I'd play around in the wild mire of zero width joiners and fulfill them myself:

  • ✨ Emoji are unicode (no shortcodes!)
  • πŸ„πŸ½β€β™€οΈ Set it and forget it (Git hooks are simple. package.json scripts are simple.)

Installation

If your project has a package.json

The chillest way to install this tool is to use Husky. 🐢

Run npm install -D husky && npm install -D commit-msg-must-use-emoji.

(yarn add -D husky && yarn add -D commit-msg-must-use-emoji probably works too.)

Then add a commitmsg script so your package.json looks like:

{
  "...
  "scripts": {
    ...
    "commitmsg": "commit-msg-must-use-emoji",
    ...
  },
  ...
}

πŸŽ‰

If you already have a commitmsg Node script

You can require this package and test a commit message string or a commit message filename (Husky stores it in process.env.GIT_PARAMS while a general Git hook node script will provide it as process.argv[2]):

const startsWithEmoji = require('commit-msg-must-use-emoji');

// e.g.
const messageString = 'Update code';
const messageFilename = '/Users/me/project/.git/COMMIT_EDITMSG';

if (!startsWithEmoji.testString(messageString)) {
  console.error('😑')
}

// or
if (!startsWithEmoji.testString(messageFilename) {
  console.error('😿');
}

πŸŽ‰

If your project doesn't have a package.json (but Node is installed on your machine)

You can install this package globally (npm install -g commit-msg-must-use-emoji or yarn global add commit-msg-must-use-emoji) and then, as long as you're on a Unix machine and don't already have a commit-msg Git hook, go to your project and try

echo '#!/usr/bin/env sh
commit-msg-must-use-emoji $1' > ./.git/hooks/commit-msg && \
chmod +x ./.git/hooks/commit-msg

πŸŽ‰

If you want to add this to an existing commit-msg shell script, adding commit-msg-must-use-emoji $1 somewhere in there will probably work. If you're on Windows, I'm not sure.

🌻 Thx

Thanks to all the emoji lovers, but interacting with the work of @notwaldorf, emojineer extraordinaire, has probably done the most to get me excited about emoji recently.