cz-jira-smart-commit-validated
v1.1.0
Published
A commitzen adapter for Jira smart commit with validations
Downloads
15
Maintainers
Readme
cz-jira-smart-commit-validated
About
Standardize your team's commits using this adapter for commitzen.
This adapter makes it possible to specify and validate the commit of a project that uses Jira as a tool of management. Using this tool you can benefit from using Jira's smart commit commands more easily without having to worry about remembering which commands are available and which syntax must be respected. Besides, it is a perfect adapter to be used together with semantic versioning.
This adapter was based on cz-jira-smart-commit and cz-conventional-changelog.
Highlights
- Standardizes the squad commit;
- Can be used together with semantic-release;
- Prevents typing errors, preventing an erroneous flow in relation to smart commit commands;
- Prevents an invalid team from being informed to Jira, forcing the default(1w 1d 1h 1m);
- Prevents an Issue ID from being informed with a key different from the one specified as default;
- Validates the commit title size respecting the defined limitation.
Example
Flow sample:
Sample of the result of mounting the commit using this adapter:
Installation
If using yarn:
yarn add cz-jira-smart-commit-validated
If using npm:
npm i cz-jira-smart-commit-validated
Usage
Reference cz-jira-smart-commit-validated path in commitzen path property:
{
...
"config": {
"commitizen": {
"path": "./node_modules/cz-jira-smart-commit-validated",
"disableScopeLowerCase": false,
"disableSubjectLowerCase": false,
"maxHeaderWidth": 100,
"maxLineWidth": 100,
"defaultType": "",
"defaultScope": "",
"defaultSubject": "",
"defaultBody": "",
"defaultIssuesPrefix": "EVOLOG",
"enableMultiIssuesIdByCommit": false
}
}
}
Example of what would look like package.json of a project using cz-jira-smart-commit-validated.
To use adapter after integration with commitzen, just run:
git cz
or if you prefer, you can use husky to trigger the hook prepare-commmit-msg. Inside this hook this line should be executed:
exec < /dev/tty && node_modules/.bin/cz --hook || true
Example of how the hook would look:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
exec < /dev/tty && node_modules/.bin/cz --hook || true
So whenever the command is executed:
git commit
The commitzen will be triggered via the husky using cz-jira-smart-commit-validated.
Documentation
cz-jira-smart-commit-validated
| Property Name | Environment Variable Name | Description | Default | | --------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | | types | N/A | Defines the types of changes that can be used. | conventional-commit-types | | workflowOptions | N/A | Defines the workflow options to be triggered in Jira. | workflowOptions | | defaultType | CZ_TYPE | Defines the default commit type. | "" | | defaultScope | CZ_SCOPE | Defines the default scope of the commit. | "" | | defaultSubject | CZ_SUBJECT | Defines the default commit subject. | "" | | defaultBody | CZ_BODY | Defines the default body of the commit. | "" | | defaultIssuesPrefix | CZ_ISSUES_PREFIX | Defines the default prefix for Issues, if the defaultIssuesPrefix is set to EVOLOG, then whenever the Issue ID related to the commit is requested, the Issue ID must be specified in the format EVOLOG-1234. The defaultIssuesPrefix also impacts the default Issue ID value requested by the adapter, still considering the defaultIssuesPrefix set to EVOLOG, if the branch name starts with the same name as the defaultIssuesPrefix, then the default Issue ID will be the name of the branch. | "" | | enableMultiIssuesIdByCommit | CZ_ENABLE_MULTI_ISSUES_ID_BY_COMMIT | Defines whether or not it is possible to report more than one Issue ID per commit. | false | | disableScopeLowerCase | DISABLE_SCOPE_LOWERCASE | Disables the passing of characters from scope to lowercase. | false | | disableSubjectLowerCase | DISABLE_SUBJECT_LOWERCASE | Disables the passing of characters from the commit title to lowercase. | false | | maxHeaderWidth | CZ_MAX_HEADER_WIDTH | Defines how many characters the commit title can be. | 100 | | maxHeaderWidth | CZ_MAX_LINE_WIDTH | Defines the maximum number of characters per line. | 100 |
Contributing
Pull requests are always welcome! Feel free to open a new GitHub issue for any changes that can be made.
Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
Author
Kalebe Samuel