From 9353ae4a2b48904977fbff9fceabead01cdf7909 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 6 Dec 2022 14:34:17 +0100 Subject: [PATCH 1/2] add a flag to the sb init when the expected renderer is html, so the cli knows what project type it is. --- scripts/tasks/sandbox-parts.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/tasks/sandbox-parts.ts b/scripts/tasks/sandbox-parts.ts index ab7674e29e9c..a5e396c1f75b 100644 --- a/scripts/tasks/sandbox-parts.ts +++ b/scripts/tasks/sandbox-parts.ts @@ -101,7 +101,15 @@ export const install: Task['run'] = async ({ sandboxDir, template }, { link, dry ); } - await executeCLIStep(steps.init, { cwd, optionValues: { debug, yes: true }, dryRun, debug }); + const flags = template.expected.renderer === '@storybook/html' ? '--type html' : undefined; + + await executeCLIStep(steps.init, { + cwd, + optionValues: { debug, yes: true }, + dryRun, + debug, + argument: flags, + }); const mainConfig = await readMainConfig({ cwd }); // Enable or disable Storybook features From 34f3c21d08aa0a598da04e740226997b7170d756 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 6 Dec 2022 15:17:28 +0100 Subject: [PATCH 2/2] make it be part of the options object --- scripts/tasks/sandbox-parts.ts | 5 ++--- scripts/utils/cli-step.ts | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/tasks/sandbox-parts.ts b/scripts/tasks/sandbox-parts.ts index a5e396c1f75b..31a397445b50 100644 --- a/scripts/tasks/sandbox-parts.ts +++ b/scripts/tasks/sandbox-parts.ts @@ -101,14 +101,13 @@ export const install: Task['run'] = async ({ sandboxDir, template }, { link, dry ); } - const flags = template.expected.renderer === '@storybook/html' ? '--type html' : undefined; + const extra = template.expected.renderer === '@storybook/html' ? { type: 'html' } : {}; await executeCLIStep(steps.init, { cwd, - optionValues: { debug, yes: true }, + optionValues: { debug, yes: true, ...extra }, dryRun, debug, - argument: flags, }); const mainConfig = await readMainConfig({ cwd }); diff --git a/scripts/utils/cli-step.ts b/scripts/utils/cli-step.ts index 53dfcf9cc5d3..8563a46f287c 100644 --- a/scripts/utils/cli-step.ts +++ b/scripts/utils/cli-step.ts @@ -33,6 +33,7 @@ export const steps = { icon: '⚙️', options: createOptions({ yes: { type: 'boolean', inverse: true }, + type: { type: 'string' }, debug: { type: 'boolean' }, }), },