About
Happy Conventional Commit contains CLI scripts for working with Conventional Commits.
Installation
npm install --save-dev happy-conventional-commit
Tools
Usage
Current Version
happy-current-version
Next Version
happy-next-version
Release Notes
Basic Usage
happy-release-notes
Pipe to file
happy-release-notes > release-notes.md
Arguments
Argument | Description | Default |
---|
--from={version} | The version to generate release notes from. | Latest version |
--to={version} | The version to generate release notes to. | |
--versionHeader | Set to show version header. Useful when generating release notes for multiple releases. | |
--author={githubUsername | nameAndEmail} | Set to show author for each entry. | |
Validate Commit Message
Basic Usage
happy-validate-commit-message --commitFile={commitFile}
With Husky
- Install Husky
- Create the file ".husky/commit-msg"
- Add the following to the file ".husky/commit-msg":
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
node ./node_modules/.bin/happy-validate-commit-message --commitFile=$1
Arguments
Argument | Description | Default |
---|
--commitFile={commitFile} | The file containing the commit message. | |
Lint Changed Files
Basic Usage
happy-lint-changed-files
With Husky
- Install Husky
- Create the file ".husky/pre-commit"
- Add the following to the file ".husky/pre-commit":
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
node ./node_modules/.bin/happy-lint-changed
Configuration
Configurations are defined in package.json
.
Rules
{
"happyLintChanged": {
"rules": [
{
"command": "eslint --ignore-path .lintignore --max-warnings 0 --fix",
"regex": "^[a-zA-Z0-9_].*\\.(cjs|mjs|js|jsx|ts|tsx|json)$"
}
]
}
}
The rules defaults to the same as in the example above.