diff --git a/code/lib/cli/src/generators/baseGenerator.ts b/code/lib/cli/src/generators/baseGenerator.ts index 760ee4348072..999c533f0025 100644 --- a/code/lib/cli/src/generators/baseGenerator.ts +++ b/code/lib/cli/src/generators/baseGenerator.ts @@ -167,7 +167,13 @@ const hasFrameworkTemplates = (framework?: SupportedFrameworks) => export async function baseGenerator( packageManager: JsPackageManager, npmOptions: NpmOptions, - { language, builder = CoreBuilder.Webpack5, pnp, frameworkPreviewParts }: GeneratorOptions, + { + language, + builder = CoreBuilder.Webpack5, + pnp, + frameworkPreviewParts, + yes: skipPrompts, + }: GeneratorOptions, renderer: SupportedRenderers, options: FrameworkOptions = defaultOptions, framework?: SupportedFrameworks @@ -358,8 +364,7 @@ export async function baseGenerator( ); if (hasEslint && !isStorybookPluginInstalled) { - const shouldInstallESLintPlugin = await suggestESLintPlugin(); - if (shouldInstallESLintPlugin) { + if (skipPrompts || (await suggestESLintPlugin())) { depsToInstall.push('eslint-plugin-storybook'); await configureEslintPlugin(eslintConfigFile, packageManager); } diff --git a/code/lib/cli/src/generators/types.ts b/code/lib/cli/src/generators/types.ts index 6ef446c6538c..c4298cc85529 100644 --- a/code/lib/cli/src/generators/types.ts +++ b/code/lib/cli/src/generators/types.ts @@ -9,6 +9,8 @@ export type GeneratorOptions = { linkable: boolean; pnp: boolean; frameworkPreviewParts?: FrameworkPreviewParts; + // skip prompting the user + yes: boolean; }; export interface FrameworkOptions { diff --git a/code/lib/cli/src/initiate.ts b/code/lib/cli/src/initiate.ts index b49ebc6a4d9a..6d62f6061ca7 100644 --- a/code/lib/cli/src/initiate.ts +++ b/code/lib/cli/src/initiate.ts @@ -65,6 +65,7 @@ const installStorybook = async ( builder: options.builder || (await detectBuilder(packageManager, projectType)), linkable: !!options.linkable, pnp: pnp || options.usePnp, + yes: options.yes, }; const runGenerator: () => Promise = async () => {