From b1978746c568716ade7d26dc5bffd95ecee3d3c8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 8 Mar 2024 15:58:59 +0100 Subject: [PATCH] Revert "remove hard-coded login in inner command" This reverts commit 909cb23f3876abc7f642c40f7f365fbee4745458. --- .../upgrade-storybook-related-dependencies.ts | 6 ------ code/lib/cli/src/automigrate/index.ts | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/code/lib/cli/src/automigrate/fixes/upgrade-storybook-related-dependencies.ts b/code/lib/cli/src/automigrate/fixes/upgrade-storybook-related-dependencies.ts index 7a57e38c7d8d..c780d5eff59e 100644 --- a/code/lib/cli/src/automigrate/fixes/upgrade-storybook-related-dependencies.ts +++ b/code/lib/cli/src/automigrate/fixes/upgrade-storybook-related-dependencies.ts @@ -55,12 +55,6 @@ export const upgradeStorybookRelatedDependencies = { promptDefaultValue: false, async check({ packageManager, storybookVersion }) { - const latestStorybookVersion = await packageManager.latestVersion('storybook'); - - if (storybookVersion !== latestStorybookVersion) { - return null; - } - const analyzedPackages = await getIncompatibleStorybookPackages({ currentStorybookVersion: storybookVersion, packageManager, diff --git a/code/lib/cli/src/automigrate/index.ts b/code/lib/cli/src/automigrate/index.ts index 8ae73c57102a..20cbf98a4166 100644 --- a/code/lib/cli/src/automigrate/index.ts +++ b/code/lib/cli/src/automigrate/index.ts @@ -29,6 +29,7 @@ import { getMigrationSummary } from './helpers/getMigrationSummary'; import { getStorybookData } from './helpers/mainConfigFile'; import { doctor } from '../doctor'; +import { upgradeStorybookRelatedDependencies } from './fixes/upgrade-storybook-related-dependencies'; import dedent from 'ts-dedent'; const logger = console; @@ -133,7 +134,20 @@ export const automigrate = async ({ return null; } - const selectedFixes: Fix[] = inputFixes || allFixes; + const selectedFixes: Fix[] = + inputFixes || + allFixes.filter((fix) => { + // we only allow this automigration when the user explicitly asks for it, or they are upgrading to the latest version of storybook + if ( + fix.id === upgradeStorybookRelatedDependencies.id && + isUpgrade !== 'latest' && + fixId !== upgradeStorybookRelatedDependencies.id + ) { + return false; + } + + return true; + }); const fixes: Fix[] = fixId ? selectedFixes.filter((f) => f.id === fixId) : selectedFixes; if (fixId && fixes.length === 0) {