diff --git a/code/lib/cli/src/automigrate/helpers/getMigrationSummary.test.ts b/code/lib/cli/src/automigrate/helpers/getMigrationSummary.test.ts index eb49848ab2c0..f43e84370852 100644 --- a/code/lib/cli/src/automigrate/helpers/getMigrationSummary.test.ts +++ b/code/lib/cli/src/automigrate/helpers/getMigrationSummary.test.ts @@ -129,7 +129,35 @@ describe('getMigrationSummary', () => { The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook. Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/docs/8.0/migration-guide - And reach out on Discord if you need help: https://discord.gg/storybook" + And reach out on Discord if you need help: https://discord.gg/storybook + + ───────────────────────────────────────────────── + + Critical: The following dependencies are duplicated and WILL cause unexpected behavior: + + @storybook/instrumenter: + 6.0.0, 7.1.0 + + @storybook/core-common: + 6.0.0, 7.1.0 + + + + + Attention: The following dependencies are duplicated which might cause unexpected behavior: + + @storybook/addon-essentials: + 7.0.0, 7.1.0 + + + + + Please try de-duplicating these dependencies by running yarn dedupe + + + + + You can find more information for a given dependency by running yarn why " `); }); diff --git a/code/lib/cli/src/automigrate/helpers/getMigrationSummary.ts b/code/lib/cli/src/automigrate/helpers/getMigrationSummary.ts index 21df32c01d77..aa0503865749 100644 --- a/code/lib/cli/src/automigrate/helpers/getMigrationSummary.ts +++ b/code/lib/cli/src/automigrate/helpers/getMigrationSummary.ts @@ -4,6 +4,7 @@ import dedent from 'ts-dedent'; import type { InstallationMetadata } from '@storybook/core-common'; import type { FixSummary } from '../types'; import { FixStatus } from '../types'; +import { getDuplicatedDepsWarnings } from '../../doctor/getDuplicatedDepsWarnings'; export const messageDivider = '\n\n'; const segmentDivider = '\n\n─────────────────────────────────────────────────\n\n'; @@ -52,6 +53,7 @@ export function getMigrationSummary({ fixResults, fixSummary, logFile, + installationMetadata, }: { fixResults: Record; fixSummary: FixSummary; @@ -73,6 +75,14 @@ export function getMigrationSummary({ And reach out on Discord if you need help: ${chalk.yellow('https://discord.gg/storybook')} `); + const duplicatedDepsMessage = installationMetadata + ? getDuplicatedDepsWarnings(installationMetadata) + : getDuplicatedDepsWarnings(); + + if (duplicatedDepsMessage) { + messages.push(duplicatedDepsMessage.join(messageDivider)); + } + const hasNoFixes = Object.values(fixResults).every((r) => r === FixStatus.UNNECESSARY); const hasFailures = Object.values(fixResults).some( (r) => r === FixStatus.FAILED || r === FixStatus.CHECK_FAILED diff --git a/code/lib/cli/src/doctor/getDuplicatedDepsWarnings.ts b/code/lib/cli/src/doctor/getDuplicatedDepsWarnings.ts index d76c01d9ee97..272313300728 100644 --- a/code/lib/cli/src/doctor/getDuplicatedDepsWarnings.ts +++ b/code/lib/cli/src/doctor/getDuplicatedDepsWarnings.ts @@ -101,15 +101,15 @@ export function getDuplicatedDepsWarnings( messages.push( '\n', - `You can find more information for a given dependency by running ${chalk.cyan( - `${installationMetadata.infoCommand} ` + `Please try de-duplicating these dependencies by running ${chalk.cyan( + `${installationMetadata.dedupeCommand}` )}` ); messages.push( '\n', - `Please try de-duplicating these dependencies by running ${chalk.cyan( - `${installationMetadata.dedupeCommand}` + `You can find more information for a given dependency by running ${chalk.cyan( + `${installationMetadata.infoCommand} ` )}` );