diff --git a/code/lib/cli/src/upgrade.ts b/code/lib/cli/src/upgrade.ts index f0b7cc5ff612..bb07d053d5d4 100644 --- a/code/lib/cli/src/upgrade.ts +++ b/code/lib/cli/src/upgrade.ts @@ -19,6 +19,7 @@ import { getStorybookInfo, loadMainConfig, JsPackageManagerFactory, + getCoercedStorybookVersion, } from '@storybook/core-common'; import { automigrate } from './automigrate/index'; import { autoblock } from './autoblock/index'; @@ -141,10 +142,11 @@ export const doUpgrade = async ({ throw new UpgradeStorybookToSameVersionError({ beforeVersion }); } - const [latestVersion, packageJson] = await Promise.all([ + const [latestVersion, packageJson, storybookVersion] = await Promise.all([ // packageManager.latestVersion('@storybook/cli'), packageManager.retrievePackageJson(), + getCoercedStorybookVersion(packageManager), ]); const isOutdated = lt(currentVersion, latestVersion); @@ -188,7 +190,7 @@ export const doUpgrade = async ({ const mainConfig = await loadMainConfig({ configDir }); // GUARDS - if (!beforeVersion) { + if (!storybookVersion) { throw new UpgradeStorybookUnknownCurrentVersionError(); }