Skip to content

earlyster/cz-customizable-ghooks

 
 

Repository files navigation

cz-customizable-ghooks

Integrate cz-customizable config with ghooks or husky to use a single configuration for commit message generation AND commit message validation.

Build Status

NPM Version semantic-release Coverage Status Dependencies status Dev-dependencies status Commitizen friendly

Purpose

This package validates that a git commit message matches the rules defined in your cz-customizable config file (see cz-customizable). Example commit message rules.

Prerequisites

Make sure you have a git repository (git init) BEFORE installing ghooks, otherwise you have to take extra steps if you install ghooks before running git init.

Installation

This package is designed to be used in conjunction with commitizen, cz-customizable and either ghooks or husky.

  1. Install pre-requisites (if not already installed):
npm i commitizen -g
npm i cz-customizable cz-customizable-ghooks
  1. Configure cz-customizable in package.json:
"config": {
  "cz-customizable": {
    "config": "path/to/your/cz-customizable-rules.js"
  }
}
  1. Install ONE of these git hook packages:
ghooks
  1. Install ghooks:
npm i ghooks
  1. Configure package.json:
"config": {
  ...
  "ghooks": {
    "commit-msg": "cz-customizable-ghooks $2"
  }
}
husky
  1. Install husky:
npm i husky
  1. Configure package.json:
  "scripts": {
    "commitmsg": "cz-customizable-ghooks"
  }

Usage

Commit your changes to git as normal. If the commit message entered is invalid, the commit will be rejected with an error message (according to the rules specified in your cz-customizable config). Works with git command-line and visual Git tools (such as SourceTree).

About

Integrate cz-customizable config with ghooks or husky

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%