Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Fix duplicated dependency warning for major version differences #21850

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('getMigrationSummary', () => {
const installationMetadata: InstallationMetadata = {
duplicatedDependencies: {
'@storybook/core-client': ['7.0.0', '7.1.0'],
'@storybook/instrumenter': ['7.0.0', '7.1.0'],
'@storybook/instrumenter': ['6.0.0', '7.1.0'],
'@storybook/core-common': ['6.0.0', '7.1.0'],
'@storybook/addon-essentials': ['7.0.0', '7.1.0'],
},
Expand Down Expand Up @@ -136,13 +136,13 @@ describe('getMigrationSummary', () => {
Critical: The following dependencies are duplicated and WILL cause unexpected behavior:

@storybook/instrumenter:
7.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/core-common:
6.0.0, 7.1.0

@storybook/addon-essentials:
7.0.0, 7.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function getWarnings(installationMetadata: InstallationMetadata) {

const hasMultipleMajorVersions = hasMultipleVersions(versions);

if (hasMultipleMajorVersions || disallowList.includes(dep)) {
if (disallowList.includes(dep) && hasMultipleMajorVersions) {
acc.critical.push(`${chalk.redBright(dep)}:\n${versions.join(', ')}`);
} else {
acc.trivial.push(`${chalk.hex('#ff9800')(dep)}:\n${versions.join(', ')}`);
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/automigrate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export async function runFixes({
const sbVersionCoerced = storybookVersion && semver.coerce(storybookVersion)?.version;
if (!sbVersionCoerced) {
logger.info(dedent`
[Storybook automigrate] ❌ Unable to determine storybook version so the automigrations will be skipped.
[Storybook automigrate] ❌ Unable to determine storybook version so the automigrations will be skipped.
🤔 Are you running automigrate from your project directory? Please specify your Storybook config directory with the --config-dir flag.
`);
return {
Expand Down