From 6a51a6354e1be8e5c4ce78ee14e27ddab84d3c32 Mon Sep 17 00:00:00 2001 From: Zhengqbbb <1074059947@qq.com> Date: Wed, 11 May 2022 21:34:12 +0800 Subject: [PATCH] docs(guide): add multiple scopes guide link #14 --- docs/guide/option-engineer.md | 16 ++++++++++++++++ docs/guide/recipes.md | 21 +++++++++++++++++++++ docs/zh/guide/option-engineer.md | 16 ++++++++++++++++ docs/zh/guide/recipes.md | 21 +++++++++++++++++++++ packages/@cz-git/plugin-inquirer/README.md | 2 ++ 5 files changed, 76 insertions(+) diff --git a/docs/guide/option-engineer.md b/docs/guide/option-engineer.md index d4490b93c..ddab2c038 100644 --- a/docs/guide/option-engineer.md +++ b/docs/guide/option-engineer.md @@ -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) diff --git a/docs/guide/recipes.md b/docs/guide/recipes.md index 5c7243ad1..c87bcc7a7 100644 --- a/docs/guide/recipes.md +++ b/docs/guide/recipes.md @@ -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 ==\== or ==\== to choice +- use ==\== 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 diff --git a/docs/zh/guide/option-engineer.md b/docs/zh/guide/option-engineer.md index 0f1dc4f14..27fa70300 100644 --- a/docs/zh/guide/option-engineer.md +++ b/docs/zh/guide/option-engineer.md @@ -29,6 +29,22 @@ lastUpdated: true 如果定义`scopeOverrides` 就要定义通用的 `scopes` ::: +## enableMultipleScopes + +- **描述** : 是否开启在选择 **模块范围** 时使用多选模式 +- **类型** : `boolean` +- **默认** : `false` + +:::tip +示例与使用方式 [⇒ 查看小窍门](/zh/guide/recipes.html#支持多选-scopes) +::: + +## scopeEnumSeparator + +- **描述** : 在多选模式下 **模块范围** 之间的分隔符 +- **类型** : `string` +- **默认** : `,` + ## allowCustomScopes - **描述** : 是否在选择 **模块范围** 显示自定义选项(custom) diff --git a/docs/zh/guide/recipes.md b/docs/zh/guide/recipes.md index 638cc1ebb..43e7cc2b3 100644 --- a/docs/zh/guide/recipes.md +++ b/docs/zh/guide/recipes.md @@ -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 diff --git a/packages/@cz-git/plugin-inquirer/README.md b/packages/@cz-git/plugin-inquirer/README.md index 7f8add566..72f964f0f 100644 --- a/packages/@cz-git/plugin-inquirer/README.md +++ b/packages/@cz-git/plugin-inquirer/README.md @@ -1,5 +1,7 @@ # @cz-git/inquirer +(WIP) + > provide cz-git's inquirer plugins, include **search-list, search-checkbox** ## demo