diff --git a/code/lib/cli/src/upgrade.ts b/code/lib/cli/src/upgrade.ts index eaee3a819f88..5537d3fe6b2a 100644 --- a/code/lib/cli/src/upgrade.ts +++ b/code/lib/cli/src/upgrade.ts @@ -292,7 +292,8 @@ export const doUpgrade = async ({ const packageManager = JsPackageManagerFactory.getPackageManager({ force: pkgMgr }); - const beforeVersion = await getStorybookCoreVersion(); + // If we can't determine the existing version (Yarn PnP), fallback to v0.0.0 to not block the upgrade + const beforeVersion = (await getStorybookCoreVersion()) ?? '0.0.0'; const currentVersion = versions['@storybook/cli']; const isCanary = currentVersion.startsWith('0.0.0'); diff --git a/code/lib/telemetry/src/package-json.ts b/code/lib/telemetry/src/package-json.ts index 8163cc2fa167..56e6823b5920 100644 --- a/code/lib/telemetry/src/package-json.ts +++ b/code/lib/telemetry/src/package-json.ts @@ -28,10 +28,8 @@ export const getActualPackageJson = async (packageName: string) => { return packageJson; }; -// Note that this probably doesn't work in PNPM mode +// Note that this probably doesn't work in Yarn PNP mode because @storybook/telemetry doesn't depend on @storybook/cli export const getStorybookCoreVersion = async () => { - const coreVersions = await Promise.all( - ['@storybook/core-common', '@storybook/core-server'].map(getActualPackageVersion) - ); - return coreVersions.find((v) => v.version)?.version; + const { version } = await getActualPackageVersion('@storybook/cli'); + return version; };