Skip to content

Commit

Permalink
feat: Allow to skip scope question (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanbruegge authored Jun 28, 2022
1 parent 9be7cd0 commit c02c734
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Here are the options you can set in your `.cz-config.js`:
* **allowCustomScopes**: {boolean, default false}: adds the option `custom` to scope selection so you can still type a scope if you need.
* **allowBreakingChanges**: {Array of Strings: default none}. List of commit types you would like to the question `breaking change` prompted. Eg.: ['feat', 'fix'].
* **skipQuestions**: {Array of Strings: default none}. List of questions you want to skip. Eg.: ['body', 'footer'].
* **skipEmptyScopes**: {boolean, default false}: If a chosen type has no scopes declared, skip the scope question
* **appendBranchNameToCommitMessage**: If you use `cz-customizable` with `cz-customizable-ghooks`, you can get the branch name automatically appended to the commit message. This is done by a commit hook on `cz-customizable-ghooks`. This option has been added on `cz-customizable-ghooks`, v1.3.0. Default value is `true`.
* **ticketNumberPrefix**: {string, default 'ISSUES CLOSED:'}: Set custom prefix for footer ticker number.
* **breakingPrefix**: {string, default 'BREAKING CHANGE:'}: Set a custom prefix for the breaking change block in commit messages.
Expand Down
3 changes: 2 additions & 1 deletion questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = {
const scopeOverrides = config.scopeOverrides || {};
const messages = config.messages || {};
const skipQuestions = config.skipQuestions || [];
const skipEmptyScopes = config.skipEmptyScopes || false;

messages.type = messages.type || "Select the type of change that you're committing:";
messages.scope = messages.scope || '\nDenote the SCOPE of this change (optional):';
Expand Down Expand Up @@ -104,7 +105,7 @@ module.exports = {
if (!hasScope) {
// TODO: Fix when possible
// eslint-disable-next-line no-param-reassign
answers.scope = 'custom';
answers.scope = skipEmptyScopes ? '' : 'custom';
return false;
}
return isNotWip(answers);
Expand Down

0 comments on commit c02c734

Please sign in to comment.