commit-message-validator
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -8,3 +8,3 @@ 'use strict' | ||
const DEFAULT_PATTERN = '.+' | ||
const DEFAULT_ERROR_MESSAGE = 'Commit message does not match pattern' | ||
const MERGE_REGEX = /^Merge\s+.+/i | ||
@@ -18,3 +18,2 @@ const getOptions = () => { | ||
options.pattern = options.pattern || DEFAULT_PATTERN | ||
options.errorMessage = options.errorMessage || DEFAULT_ERROR_MESSAGE | ||
return options | ||
@@ -27,2 +26,6 @@ } catch (error) { | ||
try { | ||
if (MERGE_REGEX.test(message)) { | ||
process.exit(0) | ||
} | ||
const options = getOptions() | ||
@@ -29,0 +32,0 @@ const regex = new RegExp(options.pattern) |
{ | ||
"name": "commit-message-validator", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Git commit-msg hook validator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# commit-message-validator | ||
Git commit-msg hook validator | ||
This package provides you a binary that you can use as a git hook to validate the commit message. | ||
If you are using githook package such as [husky](https://www.npmjs.com/package/husky), add `"commitmsg": "commit-message-validator"` to your npm scripts in package.json. | ||
# Installation | ||
This module is distributed via npm which is bundled with node and should be installed as one of your project's devDependencies: | ||
npm install commit-message-validator | ||
# Usage | ||
1. Install this package as one of your project's devDependencies | ||
2. Install githook [husky](https://www.npmjs.com/package/husky) | ||
3. Custom commit-message regex pattern in package.json | ||
{ | ||
"config": { | ||
"commit-message-validator": { | ||
/* your config here */ | ||
"pattern": "your regex pattern here" | ||
} | ||
} | ||
} | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5943
73
28