commit-prompt
v2.2.3
Published
Trucknet's official commit tool, based on Conventional Commits ideology. Prompts for a commit type, scope; gets JIRA id automatically from branch name (or asks for it), asks for any BREAKING CHANGES and gets full commit body.
Downloads
168
Keywords
Readme
commit-prompt
A fork of
git-cz
.
- Allows scope as free text
- Adds JIRA task ID question. It tries to get the ticket id from git branch first (if you use git flow, your branch should be feature/#id), if not found, asks user to input, and wrap it in
[#id]
format, as required by JIRA Gitlab integration.
Base principles refrences:
Without installation
npx commit-prompt
Install globally standalone
npm install -g commit-prompt
commit-prompt
Install locally with Commitizen
npm install -g commitizen
npm install --save-dev commit-prompt
package.json
:
{
"config": {
"commitizen": {
"path": "commit-prompt"
}
},
}
run:
git cz
Install globally with Commitizen
npm install -g commitizen commit-prompt
commitizen init commit-prompt --save-dev --save-exact
run:
git cz
Custom config
You can provide custom configuration in commit-prompt.congfig.js
(or .commitpromptrc
, .commit-prompt.js
, .commit-prompt.json
) file
in your repo. Below is default config:
module.exports = {
"list": [
"test",
"feat",
"fix",
"chore",
"docs",
"refactor",
"style",
"ci",
"perf"
],
"maxMessageLength": 64,
"minMessageLength": 3,
"questions": [
"type",
"scope",
"trackerId",
"subject",
"breaking",
"body"
],
"types": {
"chore": {
"description": "Build process or auxiliary tool changes",
"emoji": "🤖",
"value": "chore"
},
"ci": {
"description": "CI related changes",
"emoji": "🎡",
"value": "ci"
},
"docs": {
"description": "Documentation only changes",
"emoji": "✏️",
"value": "docs"
},
"feat": {
"description": "A new feature",
"emoji": "🎸",
"value": "feat"
},
"fix": {
"description": "A bug fix",
"emoji": "🐛",
"value": "fix"
},
"perf": {
"description": "A code change that improves performance",
"emoji": "⚡️",
"value": "perf"
},
"refactor": {
"description": "A code change that neither fixes a bug or adds a feature",
"emoji": "💡",
"value": "refactor"
},
"release": {
"description": "Create a release commit",
"emoji": "🏹",
"value": "release"
},
"style": {
"description": "Markup, white-space, formatting, missing semi-colons...",
"emoji": "💄",
"value": "style"
},
"test": {
"description": "Adding missing tests",
"emoji": "💍",
"value": "test"
}
}
};
Commit Message Format
- A commit message consists of a header, body and footer.
- The header has a type and a subject:
<type>[(<scope>)]: <emoji> <trackerId> <subject>
[BLANK LINE]
[body]
[BLANK LINE]
[breaking changes]
[BLANK LINE]
[footer]
The header is the only mandatory part of the commit message.
The first line (type + trackerId + subject) is limited to 50 characters [enforced]
Any other line should be limited to 72 character [automatic wrapping]
This allows the message to be easier to read on GitHub as well as in various git tools.
Type
Must be one of the following:
test
— Adding missing testsfeat
— A new featurefix
— A bug fixchore
— Build process or auxiliary tool changesdocs
— Documentation only changesrefactor
— A code change that neither fixes a bug or adds a featurestyle
— Markup, white-space, formatting, missing semi-colons...ci
— CI related changesperf
— A code change that improves performance
Subject
The subject contains succinct description of the change:
- Use the imperative, present tense: "change" not "changed" nor "changes"
- No dot (.) at the end.
Body
Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.
Affects [only on lerna environments]
Select the packages the commit affected.
Breaking Changes
Breaking Changes must start with the words BREAKING CHANGE:
.
Footer
The footer is the place to reference any tasks related to this commit.
Why this Fork?
npm i -g commit-prompt
added 1 package in 0.612s
Installs in 0.6s vs 31.1s.
npm i -g mol-conventional-changelog
added 345 packages in 31.076s