Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add skipType option #75

Merged
merged 4 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Like commitizen, you can specify the configuration of cz-conventional-changelog-
| CZ_MIN_HEADER_WIDTH | minHeaderWidth | 2 | This limits how short a commit message can be. |
| CZ_MAX_LINE_WIDTH | maxLineWidth | 100 | Commit message bodies are automatically wrapped. This decides how long the lines will be. |
| CZ_SKIP_SCOPE | skipScope | true | If scope should be used in commit messages. |
| CZ_SKIP_TYPE | skipType | false | If type should be used in commit messages. |
| CZ_SKIP_DESCRIPTION | skipDescription | false | If description should be used in commit messages. |
| CZ_SKIP_BREAKING | skipBreaking | false | If breaking changes should be used in commit messages. |
| | scopes | undefined | A list (JS Array) of scopes that will be available for selection. Note that adding this will change the scope field from Inquirer 'input' to 'list'. |
Expand Down
1 change: 1 addition & 0 deletions defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
types: conventionalCommitTypes,
jiraMode: true,
skipScope: true,
skipType: false,
skipDescription: false,
skipBreaking: false,
customScope: false,
Expand Down
17 changes: 11 additions & 6 deletions engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,25 @@ module.exports = function(options) {
return options[key] || defaults[key];
};
var getJiraIssueLocation = function(location, type, scope, jiraWithDecorators, subject) {
let headerPrefix = '';
if (type || scope) {
headerPrefix = `${type}${scope}: `;
s-hoff marked this conversation as resolved.
Show resolved Hide resolved
}
switch(location) {
case 'pre-type':
return jiraWithDecorators + type + scope + ': ' + subject;
return jiraWithDecorators + headerPrefix + subject;
break;
case 'pre-description':
return type + scope + ': ' + jiraWithDecorators + subject;
return headerPrefix + jiraWithDecorators + subject;
break;
case 'post-description':
return type + scope + ': ' + subject + ' ' + jiraWithDecorators;
return headerPrefix + subject + ' ' + jiraWithDecorators;
break;
case 'post-body':
return type + scope + ': ' + subject;
return headerPrefix + subject;
break;
default:
return type + scope + ': ' + jiraWithDecorators + subject;
return headerPrefix + jiraWithDecorators + subject;
}
};

Expand Down Expand Up @@ -112,9 +116,10 @@ module.exports = function(options) {
{
type: 'list',
name: 'type',
when: !options.skipType,
message: "Select the type of change that you're committing:",
choices: choices,
default: options.defaultType
default: options.skipType ? '' : options.defaultType
},
{
type: 'input',
Expand Down
Loading