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

@harshitkishor/git-commit

v1.0.1

Published

A Git commit message validator and formatter package by Harshit Kishor.

Downloads

4

Readme

In the world of collaborative software development, effective communication through Git commit messages is key. However, maintaining consistency and clarity can be challenging, especially in large projects. That's where @harshitkishor/git-commit comes in -> a JavaScript package designed to streamline the process of creating meaningful and standardized Git commit messages.

Why Git Commit Messages Matter

Clear and well-structured commit messages are essential for understanding code changes, tracking project history, and facilitating collaboration among team members. Inconsistent or vague commit messages can lead to confusion and hinder the overall development process.

How It Works:

1. Installation:

To install @harshitkishor/git-commit as a development dependency, run the following command:

yarn add -D @harshitkishor/git-commit

or

npm i -D @harshitkishor/git-commit

This will create a script in package.json file and a configuration file harshit.config.json in the root of your project to customize the behavior of the @harshitkishor/git-commit package.

Creating Configuration File and Script Manually

**Note: ** If the installation process doesn't automatically create the configuration file and script, you can do it manually:

  1. Create a script in package.json:
"scripts": {
  "git:lint": "harshit"
  // Add other scripts as needed
}
  1. Create the configuration file (harshit.config.json):
yarn git:lint init

This command initializes the configuration file, allowing you to customize the behavior of @harshitkishor/git-commit.

If the configuration file (harshit.config.json) is not automatically created during the initialization process, you can create it manually and include the provided settings. Here's the configuration based on the information you provided:

{
  "typePrefix": "[",
  "typeSuffix": "]",
  "typeSeparator": ":",
  "titleLimit": 100,
  "titleFirstLetterCapital": true,
  "spaceBeforeTitle": true,
  "allowTicketID": true,
  "isTicketIDRequired": false,
  "ticketIDPrefix": "TICKET-",
  "ticketIDRegExp": "^\\d{1,5}$",
  "ticketOpenPrefix": "[",
  "ticketCloseSuffix": "]",
  "ticketSeparator": ":",
  "ticketIDBeforeType": true,
  "isEmojiEnable": true,
  "emojiAtEndOfCommit": true
}

2. Usage:

Once you have created the harshit.config.json file, you can modify its contents based on your specific needs. Here's a guide on how to do that:

Modifying harshit.config.json

Open the harshit.config.json file and make adjustments according to your preferences. Here's a breakdown of the configuration parameters:

typePrefix, typeSuffix, typeSeparator: Define how the commit type is wrapped and separated. For example, with the provided configuration, a commit type like "FEAT" will be formatted as "[FEAT]:".

titleLimit: Set the maximum character limit for the commit title.

titleFirstLetterCapital: Specify whether the first letter of the commit title should be capitalized.

spaceBeforeTitle: Determine whether there should be a space before the commit title.

allowTicketID, isTicketIDRequired: Control the inclusion and requirement of a ticket ID in the commit message.

ticketIDPrefix, ticketIDRegExp: Define the prefix and regular expression for the ticket ID.

ticketOpenPrefix, ticketCloseSuffix, ticketSeparator: Specify how the ticket ID is wrapped and separated in the commit message.

**ticketIDBeforeType: ** Decide whether the ticket ID should appear before the commit type or after the commit type.

isEmojiEnable, emojiAtEndOfCommit: Enable or disable emojis in commit messages and specify whether they should be placed at the end or beginning.

Feel free to modify these parameters based on your team's conventions and your personal preferences. Once you've made the changes, save the file.

Available Commands

1. Initialize or Reset Configuration File:
yarn git:lint init

Use this command to initialize or reset the configuration file (harshit.config.json) for customizing the behavior of the linting tool.

2. Add Files to Staging:
yarn git:lint add

This command is analogous to git add. It stages files for the upcoming commit.

3. Help Command:
yarn git:lint -h

or

yarn git:lint --help

These commands provide help information, displaying all available commands and their usage.

4. Commit Prompt:
yarn git:lint commit

This command prompts users with questions to generate commit messages according to the configured rules.

These commands collectively provide a comprehensive set of features for managing and standardizing Git commit messages in your project. Users can leverage these commands to streamline their workflow and maintain consistency in their version control practices.

Author - Harshit Kishor Article - Medium