Skip to content

Commit

Permalink
fix(cz-git): remove markBreakingChangeMode restrictions on BREAKING…
Browse files Browse the repository at this point in the history
…CHANGE footer

link #38
  • Loading branch information
Zhengqbbb committed Jun 25, 2022
1 parent 1ca6108 commit a745bf2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs-zh/recipes/breakingchange.md
Expand Up @@ -18,7 +18,7 @@ BREAKING CHANGE: use JavaScript features not available in Node 6.
```

## 使用配置项: `markBreakingChangeMode`
> 改变 "BREAKINGCHANGE"的提问方式,询问是否需要添加 =="!"== 标识
> 额外添加 "BREAKINGCHANGE"的提问,询问是否需要添加 =="!"== 标识
```js{6}
// .commitlintrc.js
Expand All @@ -32,7 +32,7 @@ module.exports = {
```

示例:
![demo](https://user-images.githubusercontent.com/40693636/174950214-b294413c-b2b4-4e5b-9b8d-38deab9e8485.gif)
![demo](https://user-images.githubusercontent.com/40693636/175775159-710b69c6-ab55-4957-9195-6f963d95ba2e.gif)

## 使用 commitizen CLI + cz-git
可以尝试运行命令自动添加标识:
Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/breakingchange.md
Expand Up @@ -18,7 +18,7 @@ BREAKING CHANGE: use JavaScript features not available in Node 6.
```

## Use Option: `markBreakingChangeMode`
> Change "BREAKINGCHANGE" question that if you need to add the =="!"== mark in the header
> Add extra "BREAKING CHANGE" question that if you need to add the =="!"== mark in the header
```js{6}
// .commitlintrc.js
Expand All @@ -32,7 +32,7 @@ module.exports = {
```

Demo:
![demo](https://user-images.githubusercontent.com/40693636/174950214-b294413c-b2b4-4e5b-9b8d-38deab9e8485.gif)
![demo](https://user-images.githubusercontent.com/40693636/175775159-710b69c6-ab55-4957-9195-6f963d95ba2e.gif)

## Use commitizen CLI + cz-git
Try running command:
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/recipes/breakingchange.md
Expand Up @@ -18,7 +18,7 @@ BREAKING CHANGE: use JavaScript features not available in Node 6.
```

## 使用配置项: `markBreakingChangeMode`
> 改变 "BREAKINGCHANGE"的提问方式,询问是否需要添加 =="!"== 标识
> 额外添加 "BREAKINGCHANGE"的提问,询问是否需要添加 =="!"== 标识
```js{6}
// .commitlintrc.js
Expand All @@ -32,7 +32,7 @@ module.exports = {
```

示例:
![demo](https://user-images.githubusercontent.com/40693636/174950214-b294413c-b2b4-4e5b-9b8d-38deab9e8485.gif)
![demo](https://user-images.githubusercontent.com/40693636/175775159-710b69c6-ab55-4957-9195-6f963d95ba2e.gif)

## 使用 commitizen CLI + cz-git
可以尝试运行命令自动添加标识:
Expand Down
6 changes: 2 additions & 4 deletions packages/cz-git/src/generator/question.ts
Expand Up @@ -178,16 +178,14 @@ export const generateQuestions = (options: CommitizenGitOptions, cz: any) => {
message: options.messages?.breaking,
completeValue: options.defaultBody || undefined,
when: (answers: Answers) => {
if (options.markBreakingChangeMode === true) {
return answers.markBreaking;
} else if (
if (
options.allowBreakingChanges &&
answers.type &&
options.allowBreakingChanges.includes(answers.type)
) {
return true;
} else {
return false;
return answers.markBreaking || false;
}
},
transformer: (input: string) => useThemeCode(input, options.themeColorCode)
Expand Down

0 comments on commit a745bf2

Please sign in to comment.