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

jira-committer

v1.2.2-presentation-test.0

Published

A Husky plugin that prepends commit messages with a Jira Issue found in your project's git branch name.

Downloads

2

Readme

jira-committer

Conventional Commits Commitizen friendly

A Husky plugin that prepends commit messages with a Jira Issue found in your project's git branch name.

Table of Contents

Installation

:warning: Remove jira-precommit-hook

Because the old jira-precommit-hook doesn't uninstall it's raw-hook, it needs to be removed manually before Husky can be completely installed (Husky won't overwrite existing hooks). This can be done a few ways...

  • Delete the raw git hook(s) directory, ./.git/hooks/
  • Or, recloning the repo

(You may also need to delete /node_modules/ if you already attempted to install Husky before doing the above^. This allows Husky to attempt to reinstall it's hooks again.)

Once the above is done, you may then... npm install.

Install Husky

npm install --save-dev [email protected]

... then this package

npm install --save-dev git://github.mktp.io/extend-health/jira-committer#v1.2.1

or

npm install --save-dev https://github.mktp.io/extend-health/jira-committer/tarball/v1.2.1

Lastly, configure Husky

package.json

{
  "husky": {
    "hooks": {
      "commit-msg": "jira-committer || exit 0"
    }
  }
}

Configuration

jira-committer uses cosmiconfig for configuration file support. This means you can configure jira-committer via:

  • A .jira-committerrc file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json.
  • A .jira-committerrc.toml file, written in TOML (the .toml extension is required).
  • A jira-committer.config.js or .jira-committerrc.js file that exports an object.
  • A "jira-committer" key in your package.json file.

The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.

Options

interface IConfiguration {
  JIRA_ISSUE_PATTERN: RegExp;
}

Committing Code

Must each of your commit messages be prepended with a Jira issue (AB-1234)?

Is this currently a manual process?

To aid with this common task, this repository installs a git hook that automatically prepends messages with the Jira Issue found in the current branch name (AB-1234-add-feature).

For example...

> git checkout -b AB-1234-add-new-feature
> touch newfeature.txt
> git add .
> git commit -m "Add new feature"

... results in the following commit message...

AB-1234 Add new feature

Note: These issues are not validated with the server.

Examples

No Issue Found

$ git commit -m "formatting correction"
husky > commit-msg (node v11.12.0)
Checking branch name and commit message for Jira issue...
Jira issue NOT found in commit message nor branch name. Commit message remains unmodified.
[NOTE: These issues are not validated with the server.]
[branch-issue-precommit-helper 87cfaed] formatting correction
 1 file changed, 1 insertion(+), 1 deletion(-)

Issue in Commit, not Branch

$ git commit --amend
husky > commit-msg (node v11.12.0)
Checking branch name and commit message for Jira issue...
Commit message already specifies issue, CRMP-129.
Commit message remains unmodified. Consider using just the branch name next time.
[NOTE: These issues are not validated with the server.]
[branch-issue-precommit-helper e7523e6] CRMP-129 formatting correction
 Date: Fri Apr 5 19:04:46 2019 -0700
 1 file changed, 1 insertion(+), 1 deletion(-)

Issue in Branch, not Commit

$ git commit --amend
husky > commit-msg (node v11.12.0)
Checking branch name and commit message for Jira issue...
Prepending branch issue, CRMP-129, to commit message.
[NOTE: These issues are not validated with the server.]
[CRMP-129-test-branch 49d1d15] CRMP-129 <- is the ticket here?
 Date: Fri Apr 5 19:04:46 2019 -0700
 1 file changed, 1 insertion(+), 1 deletion(-)

Issue in Branch and Commit

$ git commit --amend
husky > commit-msg (node v11.12.0)
Checking branch name and commit message for Jira issue...
Commit message already specifies issue, CRMP-129.
Commit message remains unmodified. Consider using just the branch name next time.
[NOTE: These issues are not validated with the server.]
[CRMP-129-testttt d557660] CRMP-129 corrected 1+ regex search bugs Updated Husky script to always allow the commit to continue
 Date: Fri Apr 12 12:30:57 2019 -0700
 2 files changed, 6 insertions(+), 3 deletions(-)

Development

git clone https://github.mktp.io/extend-health/jira-committer.git
cd jira-committer
yarn install
npm run build
npm run watch
npm run tasks

Gulp

All NPM build scripts defer to Gulp underneath. If you have Gulp installed globally, feel free to use Gulp normally instead.

Otherwise, run any Gulp command via... npm run gulp -- <gulp args>.

Committing Changes

Commits are expected to follow the Conventional Commit format.

Use either of these to assist in writing correctly formatted commits...

  • git cz
  • npm run cm