Skip to content

Commit

Permalink
Merge pull request #22651 from storybookjs/fix/sandbox-init-command
Browse files Browse the repository at this point in the history
CLI: Skip prompting for eslint plugin with --yes flag
  • Loading branch information
JReinhold authored and shilman committed May 22, 2023
1 parent edc0e78 commit 1f2b405
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions code/lib/cli/src/generators/baseGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions code/lib/cli/src/generators/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export type GeneratorOptions = {
linkable: boolean;
pnp: boolean;
frameworkPreviewParts?: FrameworkPreviewParts;
// skip prompting the user
yes: boolean;
};

export interface FrameworkOptions {
Expand Down
1 change: 1 addition & 0 deletions code/lib/cli/src/initiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const installStorybook = async <Project extends ProjectType>(
builder: options.builder || (await detectBuilder(packageManager, projectType)),
linkable: !!options.linkable,
pnp: pnp || options.usePnp,
yes: options.yes,
};

const runGenerator: () => Promise<any> = async () => {
Expand Down

0 comments on commit 1f2b405

Please sign in to comment.