This is simple git commit message validator.
You can force git commit message format with this.
There are two modes.
-
Types Mode
Using types mode, commit message format of your project is forced like [{TYPE}] {TITLE} : {DESCRIPTION}.
You can insert your own types into package.json using CLI. -
Regular Expression Mode
Using regular expression mode, commit messages of your project are tested by regular expression you insert.
First, you add package info, meta data into your package.json.
$npx git-commit-msg-validator
Select mode what you will use.
And enter types what you want to use.
That's it.
Entered types are inserted into package.json.
And scripts, devDependencies, symbolic link of git hooks are created automatically.
{
"name": "test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"postinstall": "git-commit-msg-validator"
},
"devDependencies": {
"git-commit-msg-validator": "^1.0.2"
},
"git-commit-msg-validator": "[\"new-feature\", \"fix-bug\", \"update\", \"modify\"]"
}
After, git hooks registered. Test your commit messages.
$git add .
$git commit -m "commit test" // You will see error.
$git commit -m "[fix-bug] fix bugs in text input : fix no response bugs in input component."
// The fix has been committed.
Copyright (c) 2022 이형준
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.