From d978771b182d2a98035fa650f91fa7b949ab2089 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 11 Mar 2024 13:57:58 +0100 Subject: [PATCH 1/2] add a flag for detecting is the latest version we got from npm matches the version of the CLI exactly --- code/lib/cli/src/automigrate/index.ts | 4 +++- code/lib/cli/src/automigrate/types.ts | 5 +++-- code/lib/cli/src/migrate.ts | 7 ++++--- code/lib/cli/src/upgrade.ts | 4 +++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/code/lib/cli/src/automigrate/index.ts b/code/lib/cli/src/automigrate/index.ts index 20cbf98a4166..340a90f7ec38 100644 --- a/code/lib/cli/src/automigrate/index.ts +++ b/code/lib/cli/src/automigrate/index.ts @@ -103,6 +103,7 @@ export const doAutomigrate = async (options: AutofixOptionsFromCLI) => { mainConfigPath, configDir, isUpgrade: false, + isLatest: false, }); if (outcome) { @@ -125,6 +126,7 @@ export const automigrate = async ({ skipInstall, hideMigrationSummary = false, isUpgrade, + isLatest, }: AutofixOptions): Promise<{ fixResults: Record; preCheckFailure?: PreCheckFailure; @@ -140,7 +142,7 @@ export const automigrate = async ({ // 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' && + isLatest === false && fixId !== upgradeStorybookRelatedDependencies.id ) { return false; diff --git a/code/lib/cli/src/automigrate/types.ts b/code/lib/cli/src/automigrate/types.ts index 8dad3d3d2fa9..43447102162f 100644 --- a/code/lib/cli/src/automigrate/types.ts +++ b/code/lib/cli/src/automigrate/types.ts @@ -1,5 +1,5 @@ -import type { StorybookConfigRaw } from '@storybook/types'; import type { JsPackageManager, PackageManagerName } from '@storybook/core-common'; +import type { StorybookConfigRaw } from '@storybook/types'; export interface CheckOptions { packageManager: JsPackageManager; @@ -75,7 +75,8 @@ export interface AutofixOptions extends Omit Date: Mon, 11 Mar 2024 13:43:55 +0000 Subject: [PATCH 2/2] Write changelog for 8.0.0-rc.5 [skip ci] --- CHANGELOG.prerelease.md | 4 ++++ code/package.json | 3 ++- docs/versions/next.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.prerelease.md b/CHANGELOG.prerelease.md index 2b0e49086ea5..aec117765b12 100644 --- a/CHANGELOG.prerelease.md +++ b/CHANGELOG.prerelease.md @@ -1,3 +1,7 @@ +## 8.0.0-rc.5 + +- CLI: Automigration fix version detection of upgrading related packages - [#26410](https://github.com/storybookjs/storybook/pull/26410), thanks @ndelangen! + ## 8.0.0-rc.4 - Actions: Fix attaching action after a spy is restored to original function - [#26364](https://github.com/storybookjs/storybook/pull/26364), thanks @kasperpeulen! diff --git a/code/package.json b/code/package.json index 42309691e56c..3d37c1912e4f 100644 --- a/code/package.json +++ b/code/package.json @@ -294,5 +294,6 @@ "Dependency Upgrades" ] ] - } + }, + "deferredNextVersion": "8.0.0-rc.5" } diff --git a/docs/versions/next.json b/docs/versions/next.json index 60521e66f7a9..e522ee4c40f2 100644 --- a/docs/versions/next.json +++ b/docs/versions/next.json @@ -1 +1 @@ -{"version":"8.0.0-rc.4","info":{"plain":"- Actions: Fix attaching action after a spy is restored to original function - [#26364](https://github.com/storybookjs/storybook/pull/26364), thanks @kasperpeulen!\n- CLI: Add explicit actions to header story - [#26352](https://github.com/storybookjs/storybook/pull/26352), thanks @kasperpeulen!\n- CLI: Automigration for upgrading storybook related dependencies - [#26377](https://github.com/storybookjs/storybook/pull/26377), thanks @ndelangen!\n- CLI: Fix doctor compatibility check - [#26363](https://github.com/storybookjs/storybook/pull/26363), thanks @yannbf!\n- CLI: Fix fn reference in preact templates - [#26384](https://github.com/storybookjs/storybook/pull/26384), thanks @kasperpeulen!\n- CLI: Remove duplicated dependency warning - [#26385](https://github.com/storybookjs/storybook/pull/26385), thanks @yannbf!\n- CLI: Vite migration link (shorter) - [#26379](https://github.com/storybookjs/storybook/pull/26379), thanks @ndelangen!\n- Composition: Fix refs not loading when there's multiple - [#26356](https://github.com/storybookjs/storybook/pull/26356), thanks @ndelangen!\n- Dependencies: Broaden `esbuild` version range - [#26405](https://github.com/storybookjs/storybook/pull/26405), thanks @ndelangen!\n- Maintenance: Replace `@storybook/testing-library` with `@storybook/test` in monorepo - [#26351](https://github.com/storybookjs/storybook/pull/26351), thanks @ndelangen!\n- Maintenance: What's new modal changes - [#26355](https://github.com/storybookjs/storybook/pull/26355), thanks @kasperpeulen!\n- Portable Stories: Fix injected root element changing layout - [#26387](https://github.com/storybookjs/storybook/pull/26387), thanks @JReinhold!\n- React: Support all React component types in JSX Decorator - [#26382](https://github.com/storybookjs/storybook/pull/26382), thanks @yannbf!"}} +{"version":"8.0.0-rc.5","info":{"plain":"- CLI: Automigration fix version detection of upgrading related packages - [#26410](https://github.com/storybookjs/storybook/pull/26410), thanks @ndelangen!"}}