From 3c168f0562462ad67269e5c470ed685da72c60f5 Mon Sep 17 00:00:00 2001 From: Kasper Peulen Date: Mon, 15 Jul 2024 16:35:04 +0200 Subject: [PATCH] Merge pull request #28604 from storybookjs/kasper/storybook-doctor-error CLI: Add diagnostic when the `storybook` package is missing (cherry picked from commit cbfe2099c3a3a990518c0200474396e4e549a378) --- code/lib/cli/src/doctor/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/lib/cli/src/doctor/index.ts b/code/lib/cli/src/doctor/index.ts index 6aab5507b21a..0e2f0747aa7a 100644 --- a/code/lib/cli/src/doctor/index.ts +++ b/code/lib/cli/src/doctor/index.ts @@ -105,6 +105,15 @@ export const doctor = async ({ const allDependencies = (await packageManager.getAllDependencies()) as Record; + if (!('storybook' in allDependencies)) { + logDiagnostic( + `Package ${chalk.cyan('storybook')} not found`, + dedent` + The ${chalk.cyan('storybook')} package was not found in your package.json. + Installing ${chalk.cyan('storybook')} as a direct dev dependency in your package.json is required. + ` + ); + } const incompatibleStorybookPackagesList = await getIncompatibleStorybookPackages({ currentStorybookVersion: storybookVersion, });