diff --git a/src/bin/add-story.ts b/src/bin/add-story.ts index 6a765617..acf46f86 100644 --- a/src/bin/add-story.ts +++ b/src/bin/add-story.ts @@ -27,11 +27,31 @@ export async function command(params: { cliCommandOptions: CliCommandOptions }) console.log(chalk.cyan("Theme type:")); const { value: themeType } = await cliSelect({ - values: [...THEME_TYPES] + values: [...THEME_TYPES].filter(themeType => { + switch (themeType) { + case "account": + return buildContext.implementedThemeTypes.account.isImplemented; + case "login": + return buildContext.implementedThemeTypes.login.isImplemented; + } + assert>(false); + }) }).catch(() => { process.exit(-1); }); + if ( + themeType === "account" && + (assert(buildContext.implementedThemeTypes.account.isImplemented), + buildContext.implementedThemeTypes.account.type === "Single-Page") + ) { + console.log( + `${chalk.red("✗")} Sorry, there is no Storybook support for Single-Page Account themes.` + ); + + process.exit(0); + } + console.log(`→ ${themeType}`); console.log(chalk.cyan("Select the page you want to create a Storybook for:"));