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

@humankode/git-inject-jira-ticket

v0.0.10

Published

A script for the prepare-commit-msg git hook that automatically injects a Jira ticket based off the jira ticket in the branch name

Downloads

19

Readme

git-inject-jira-ticket Build status @humankode/git-inject-jira-ticket on npm

A git hook script to automatically inject the Jira ticket in a commit message

For example:

branch:

  • feature-JIRA-1234
  • or feature-JIRA-1234-implement-caching
  • or feature/JIRA-1234-implement-caching
  • or feature/JIRA-1234/implement-caching etc.

commit:

git commit -m "implement caching"

//=> JIRA-1234: implement caching

Usage

Install and configure Husky

.husky/prepare-commit-msg

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

npx --yes @humankode/git-inject-jira-ticket@latest

Zero config by default

Zero configuration by default.

If no configuration specified, it will use JIRA-1234 as the Jira ticket pattern.

Configuration

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

Refer to the Configuration interface for all options.

Example configurations

1. Override the Jira Project Key

gitInjectJiraTicket.json

{
  "jiraIssuePrefix": "FOO"
}

For example

It will expect Jira tickets to be in the format of FOO-1234

Valid branches would be feature-FOO-1234, feature-FOO-1234-some-message, feature/FOO-1234 etc.

2. Override the allowed branch prefixes

The default allowed branchTypes are feature, hotfix, revert, release, build, ci, docs, fix, performance, refactor and test

To override branchTypes:

To only allow feature and hotfix branch types:

gitInjectJiraTicket.json

{
  "branchConfiguration": {
    "branchTypes": [
      "feature",
      "hotfix"
    ]
  }
}

For example:

these branches would be valid:

  • feature-JIRA-1234
  • or hotfix-JIRA-1234-implement-caching
  • or feature/JIRA-1234-implement-caching
  • or hotfix/JIRA-1234/implement-caching etc.

3. Override the Jira Ticket Number's Number of Expected Digits

The default value for jiraTicketLength is 1, which means that the Jira ticket is expected to have 1 or more digits. For example, these would all be valid: JIRA-1, JIRA-12, JIRA-12324 etc.

To change this to only have 4 digits:

gitInjectJiraTicket.json

{
  "jiraTicketLength": "4"
}

Now only 4 digits would be valid, for example: JIRA-1234

4. Capitalize commit messages

The default value for capitalizeMessage is true.

This capitalizes the first letter of the commit message.

For example:

branch: feature-JIRA-1234

git commit -m "some message. with another sentence"

//=> JIRA-1234: Some message. with another sentence

To override capitalizeMessage:

gitInjectJiraTicket.json

{
  "messageConfiguration": {
    "capitalizeMessage": false
  }
}

Maintainers