Skip to content

Commit

Permalink
docs(guide): add multiple scopes guide
Browse files Browse the repository at this point in the history
link #14
  • Loading branch information
Zhengqbbb committed May 11, 2022
1 parent 89470d9 commit 6a51a63
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/guide/option-engineer.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ If you define a `scope-enum` using the [commitlint](https://github.com/conventio
If you define `scopeOverrides` then define generic `scopes`
:::

## enableMultipleScopes

- **description** : Whether to enable the use of **multiple scopes mode**
- **type** : `boolean`
- **default** : `false`

:::tip
Demo And Usage [⇒ see the recipes](/guide/recipes.html#support-for-multiple-scopes)
:::

## scopeEnumSeparator

- **description** : Separator between **scopes** in multiple scopes mode
- **type** : `string`
- **default** : `,`

## allowCustomScopes

- **description** : whether to display custom options when selecting **module scope** (custom)
Expand Down
21 changes: 21 additions & 0 deletions docs/guide/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ module.exports = {

![demo-gif](https://user-images.githubusercontent.com/40693636/156002738-af17087e-2d2b-4a80-a681-d63751282ec8.gif)

#### Support for multiple scopes

- use ==\<Right\>== or ==\<Space\>== to choice
- use ==\<Enter\>== to submit

```js{8,9}
// .commitlintrc.js
const fs = require('fs')
const path = require('path')
const packages = fs.readdirSync(path.resolve(__dirname, 'packages'))
module.exports = {
prompt: {
scopes: [...packages],
enableMultipleScopes: true,
scopeEnumSeparator: ","
}
}
```

![demo-gif](https://user-images.githubusercontent.com/40693636/167858696-398a19fd-932f-4453-832a-795edcb75ad7.gif)

### scopes for business system

```js
Expand Down
16 changes: 16 additions & 0 deletions docs/zh/guide/option-engineer.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ lastUpdated: true
如果定义`scopeOverrides` 就要定义通用的 `scopes`
:::

## enableMultipleScopes

- **描述** : 是否开启在选择 **模块范围** 时使用多选模式
- **类型** : `boolean`
- **默认** : `false`

:::tip
示例与使用方式 [⇒ 查看小窍门](/zh/guide/recipes.html#支持多选-scopes)
:::

## scopeEnumSeparator

- **描述** : 在多选模式下 **模块范围** 之间的分隔符
- **类型** : `string`
- **默认** : `,`

## allowCustomScopes

- **描述** : 是否在选择 **模块范围** 显示自定义选项(custom)
Expand Down
21 changes: 21 additions & 0 deletions docs/zh/guide/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ module.exports = {

![demo-gif](https://user-images.githubusercontent.com/40693636/156002738-af17087e-2d2b-4a80-a681-d63751282ec8.gif)

#### 支持多选 scopes

- 使用 ==\<右箭头\>== 或 ==\<空格\>== 选中
- 使用 ==\<回车\>== 确定

```js{8,9}
// .commitlintrc.js
const fs = require('fs')
const path = require('path')
const packages = fs.readdirSync(path.resolve(__dirname, 'packages'))
module.exports = {
prompt: {
scopes: [...packages],
enableMultipleScopes: true,
scopeEnumSeparator: ","
}
}
```

![demo-gif](https://user-images.githubusercontent.com/40693636/167858696-398a19fd-932f-4453-832a-795edcb75ad7.gif)

### 针对 项目业务 的 scopes

```js
Expand Down
2 changes: 2 additions & 0 deletions packages/@cz-git/plugin-inquirer/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @cz-git/inquirer

(WIP)

> provide cz-git's inquirer plugins, include **search-list, search-checkbox**
## demo
Expand Down

0 comments on commit 6a51a63

Please # to comment.