8000 feat(prompt modules): prompt groups · sarvex/vue-cli@eef64a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit eef64a5

Browse files
author
Guillaume Chau
committed
feat(prompt modules): prompt groups
1 parent 2276aed commit eef64a5

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

packages/@vue/cli-global-utils/lib/promptModules/cssPreprocessors.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module.exports = cli => {
2+
const featureName = 'CSS Pre-processors'
3+
24
cli.injectFeature({
3-
name: 'CSS Pre-processors',
5+
name: featureName,
46
value: 'css-preprocessor',
57
description: 'Add support for CSS pre-processors like Sass, Less or Stylus',
68
link: 'https://cli.vuejs.org/guide/css.html'
@@ -14,6 +16,7 @@ module.exports = cli => {
1416
type: 'list',
1517
message: `Pick a CSS pre-processor${process.env.VUE_CLI_API_MODE ? '' : ` (${notice})`}:`,
1618
description: `${notice}.`,
19+
group: featureName,
1720
choices: [
1821
// In Vue CLI <= 3.3, the value of Sass option in 'sass' an means 'node-sass'.
1922
// Considering the 'sass' package on NPM is actually for Dart Sass, we renamed it to 'node-sass'.

packages/@vue/cli-global-utils/lib/promptModules/e2e.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module.exports = cli => {
2+
const featureName = 'E2E Testing'
3+
24
cli.injectFeature({
3-
name: 'E2E Testing',
5+
name: featureName,
46
value: 'e2e',
57
short: 'E2E',
68
description: 'Add an End-to-End testing solution to the app like Cypress or Nightwatch',
@@ -13,6 +15,7 @@ module.exports = cli => {
1315
when: answers => answers.features.includes('e2e'),
1416
type: 'list',
1517
message: 'Pick a E2E testing solution:',
18+
group: featureName,
1619
choices: [
1720
{
1821
name: 'Cypress (Chrome only)',

packages/@vue/cli-global-utils/lib/promptModules/linter.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ module.exports = cli => {
44
eslintConfig
55
} = require('@vue/cli-shared-utils/lib/pluginPrompts/eslint')
66

7+
const FeatureName = 'Linter / Formatter'
8+
79
cli.injectFeature({
8-
name: 'Linter / Formatter',
10+
name: FeatureName,
911
value: 'linter',
1012
short: 'Linter',
1113
description: 'Check and enforce code quality with ESLint or Prettier',
@@ -17,6 +19,7 @@ module.exports = cli => {
1719
cli.injectPrompt({
1820
...eslintConfig,
1921
name: 'eslintConfig',
22+
group: FeatureName,
2023
when: answers => answers.features.includes('linter'),
2124
choices: answers => [
2225
...(
@@ -34,6 +37,7 @@ module.exports = cli => {
3437

3538
cli.injectPrompt({
3639
...lintOn,
40+
group: FeatureName,
3741
when: answers => answers.features.includes('linter')
3842
})
3943

packages/@vue/cli-global-utils/lib/promptModules/router.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ module.exports = cli => {
33
historyMode
44
} = require('@vue/cli-shared-utils/lib/pluginPrompts/router')
55

6+
const featureName = 'Router'
7+
68
cli.injectFeature({
7-
name: 'Router',
9+
name: featureName,
810
value: 'router',
911
description: 'Structure the app with dynamic pages',
1012
link: 'https://router.vuejs.org/'
1113
})
1214

1315
cli.injectPrompt({
1416
...historyMode,
17+
group: featureName,
1518
when: answers => answers.features.includes('router')
1619
})
1720

packages/@vue/cli-global-utils/lib/promptModules/typescript.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ const {
44
} = require('@vue/cli-shared-utils/lib/pluginPrompts/typescript')
55

66
module.exports = cli => {
7+
const featureName = 'TypeScript'
8+
79
cli.injectFeature({
8-
name: 'TypeScript',
10+
name: featureName,
911
value: 'ts',
1012
short: 'TS',
1113
description: 'Add support for the TypeScript language',
@@ -16,11 +18,13 @@ module.exports = cli => {
1618
cli.injectPrompt({
1719
...classComponent,
1820
name: 'tsClassComponent',
21+
group: featureName,
1922
when: answers => answers.features.includes('ts')
2023
})
2124

2225
cli.injectPrompt({
2326
...useTsWithBabel,
27+
group: featureName,
2428
when: answers => answers.features.includes('ts'),
2529
default: answers => answers.features.includes('babel')
2630
})

packages/@vue/cli-global-utils/lib/promptModules/unit.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module.exports = cli => {
2+
const featureName = 'Unit Testing'
3+
24
cli.injectFeature({
3-
name: 'Unit Testing',
5+
name: featureName,
46
value: 'unit',
57
short: 'Unit',
68
description: 'Add a Unit Testing solution like Jest or Mocha',
@@ -13,6 +15,7 @@ module.exports = cli => {
1315
when: answers => answers.features.includes('unit'),
1416
type: 'list',
1517
message: 'Pick a unit testing solution:',
18+
group: featureName,
1619
choices: [
1720
{
1821
name: 'Mocha + Chai',

0 commit comments

Comments
 (0)
0