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: Log UpgradeStorybookToSameVersionError but continue upgrade as normal #27217

Merged
merged 6 commits into from
Jun 5, 2024
4 changes: 3 additions & 1 deletion code/lib/cli/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ export const doUpgrade = async ({
if (!isCanary && lt(currentVersion, beforeVersion)) {
throw new UpgradeStorybookToLowerVersionError({ beforeVersion, currentVersion });
}

if (!isCanary && eq(currentVersion, beforeVersion)) {
throw new UpgradeStorybookToSameVersionError({ beforeVersion });
// Not throwing, as the beforeVersion calculation doesn't always work in monorepos.
logger.error(new UpgradeStorybookToSameVersionError({ beforeVersion }));
valentinpalkovic marked this conversation as resolved.
Show resolved Hide resolved
}

const [latestVersion, packageJson] = await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion code/lib/core-events/src/errors/server-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ export class UpgradeStorybookToSameVersionError extends StorybookError {

template() {
return dedent`
You are trying to upgrade Storybook to the same version that is currently installed in the project, version ${this.data.beforeVersion}. This is not supported.
You are upgrading Storybook to the same version that is currently installed in the project, version ${this.data.beforeVersion}.

This usually happens when running the upgrade command without a version specifier, e.g. "npx storybook upgrade".
This will cause npm to run the globally cached storybook binary, which might be the same version that you already have.
Expand Down
Loading