mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Merge pull request #30605 from storybookjs/fix-printing-selected-features
CLI: Fix printing of selected features
This commit is contained in:
commit
fea7c5d32c
@ -299,13 +299,12 @@ export async function doInitiate(options: CommandOptions): Promise<
|
||||
test: { name: 'Testing', description: 'Fast browser-based component tests, watch mode' },
|
||||
};
|
||||
|
||||
const printFeatures = (features: Set<GeneratorFeature>) =>
|
||||
Array.from(features)
|
||||
.map((f) => selectableFeatures[f].name)
|
||||
.join(', ') || 'none';
|
||||
|
||||
let selectedFeatures = new Set<GeneratorFeature>();
|
||||
selectedFeatures.toString = () =>
|
||||
selectedFeatures.size === 0
|
||||
? 'none'
|
||||
: Array.from(selectedFeatures)
|
||||
.map((f) => selectableFeatures[f].name)
|
||||
.join(', ');
|
||||
|
||||
if (options.features?.length > 0) {
|
||||
if (options.features.includes('docs')) {
|
||||
@ -314,7 +313,7 @@ export async function doInitiate(options: CommandOptions): Promise<
|
||||
if (options.features.includes('test')) {
|
||||
selectedFeatures.add('test');
|
||||
}
|
||||
logger.log(`Selected features: ${selectedFeatures}`);
|
||||
logger.log(`Selected features: ${printFeatures(selectedFeatures)}`);
|
||||
} else if (options.yes || !isInteractive) {
|
||||
selectedFeatures.add('docs');
|
||||
|
||||
@ -322,7 +321,7 @@ export async function doInitiate(options: CommandOptions): Promise<
|
||||
// Don't automatically add test feature in CI
|
||||
selectedFeatures.add('test');
|
||||
}
|
||||
logger.log(`Selected features: ${selectedFeatures}`);
|
||||
logger.log(`Selected features: ${printFeatures(selectedFeatures)}`);
|
||||
} else {
|
||||
const out = await prompts({
|
||||
type: 'multiselect',
|
||||
@ -527,7 +526,7 @@ export async function doInitiate(options: CommandOptions): Promise<
|
||||
boxen(
|
||||
dedent`
|
||||
Storybook was successfully installed in your project! 🎉
|
||||
Additional features: ${selectedFeatures}
|
||||
Additional features: ${printFeatures(selectedFeatures)}
|
||||
|
||||
To run Storybook manually, run ${picocolors.yellow(
|
||||
picocolors.bold(storybookCommand)
|
||||
|
Loading…
x
Reference in New Issue
Block a user