From c7a77ce5d671e40e40a9a4183d06caf816ee4b99 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 1 Sep 2025 16:19:45 +0800 Subject: [PATCH 1/2] Tags: Remove unodocumented x-only tags --- MIGRATION.md | 7 ++++++- .../src/core-server/presets/common-preset.ts | 10 ---------- .../manager/components/sidebar/TagsFilter.tsx | 10 +--------- .../components/sidebar/TagsFilterPanel.tsx | 3 --- code/e2e-tests/tags.spec.ts | 18 ------------------ 5 files changed, 7 insertions(+), 41 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index fbf6dec9fd35..e24f570c7b77 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -7,6 +7,7 @@ - [Node.js 20.19+ or 22.12+ required](#nodejs-2019-or-2212-required) - [Require `tsconfig.json` `moduleResolution` set to value that supports `types` condition](#require-tsconfigjson-moduleresolution-set-to-value-that-supports-types-condition) - [`core.builder` configuration must be a fully resolved path](#corebuilder-configuration-must-be-a-fully-resolved-path) + - [Removed x-only builtin tags](#removed-x-only-builtin-tags) - [From version 8.x to 9.0.0](#from-version-8x-to-900) - [Core Changes and Removals](#core-changes-and-removals) - [Dropped support for legacy packages](#dropped-support-for-legacy-packages) @@ -580,6 +581,10 @@ export const core = { }; ``` +#### Removed x-only builtin tags + +During development of Storybook [Tags](https://storybook.js.org/docs/writing-stories/tags), we created `dev-only`, `docs-only`, and `test-only` built-in tags. These tags were never documented and superceded by the currently-documented `dev`, `autodocs`, and `test` tags which provide more precise control. The outdated `x-only` tags are removed in 10.0. + ## From version 8.x to 9.0.0 ### Core Changes and Removals @@ -1806,7 +1811,7 @@ These sections explain the rationale, and the required changes you might have to ### Deprecated `@storybook/testing-library` package - The `@storybook/testing-library` package has been deprecated with the release of Storybook 8.0, and we recommend using the `@storybook/test` package instead. If you're migrating manually, you'll need to install the new package and update your imports as follows: +The `@storybook/testing-library` package has been deprecated with the release of Storybook 8.0, and we recommend using the `@storybook/test` package instead. If you're migrating manually, you'll need to install the new package and update your imports as follows: ```diff - import { userEvent } from '@storybook/testing-library'; diff --git a/code/core/src/core-server/presets/common-preset.ts b/code/core/src/core-server/presets/common-preset.ts index 7539f77c4378..d95626ee7e4a 100644 --- a/code/core/src/core-server/presets/common-preset.ts +++ b/code/core/src/core-server/presets/common-preset.ts @@ -278,16 +278,6 @@ export const resolvedReact = async (existing: any) => { } }; -/** Set up `dev-only`, `docs-only`, `test-only` tags out of the box */ -export const tags = async (existing: any) => { - return { - ...existing, - 'dev-only': { excludeFromDocsStories: true }, - 'docs-only': { excludeFromSidebar: true }, - 'test-only': { excludeFromSidebar: true, excludeFromDocsStories: true }, - }; -}; - export const managerEntries = async (existing: any) => { return [ pathe.join(resolvePackageDir('storybook'), 'dist/core-server/presets/common-manager.js'), diff --git a/code/core/src/manager/components/sidebar/TagsFilter.tsx b/code/core/src/manager/components/sidebar/TagsFilter.tsx index 53bd6ed2182e..2e5bf66e44ea 100644 --- a/code/core/src/manager/components/sidebar/TagsFilter.tsx +++ b/code/core/src/manager/components/sidebar/TagsFilter.tsx @@ -12,15 +12,7 @@ import { TagsFilterPanel } from './TagsFilterPanel'; const TAGS_FILTER = 'tags-filter'; -const BUILT_IN_TAGS_HIDE = new Set([ - 'dev', - 'docs-only', - 'test-only', - 'autodocs', - 'test', - 'attached-mdx', - 'unattached-mdx', -]); +const BUILT_IN_TAGS_HIDE = new Set(['dev', 'autodocs', 'test', 'attached-mdx', 'unattached-mdx']); const Wrapper = styled.div({ position: 'relative', diff --git a/code/core/src/manager/components/sidebar/TagsFilterPanel.tsx b/code/core/src/manager/components/sidebar/TagsFilterPanel.tsx index cd7dc975346c..baffdada1a95 100644 --- a/code/core/src/manager/components/sidebar/TagsFilterPanel.tsx +++ b/code/core/src/manager/components/sidebar/TagsFilterPanel.tsx @@ -20,9 +20,6 @@ import type { Link } from '../../../components/components/tooltip/TooltipLinkLis const BUILT_IN_TAGS = new Set([ 'dev', 'test', - 'dev-only', - 'test-only', - 'docs-only', 'autodocs', 'attached-mdx', 'unattached-mdx', diff --git a/code/e2e-tests/tags.spec.ts b/code/e2e-tests/tags.spec.ts index 6e1eca678db6..eb69384387af 100644 --- a/code/e2e-tests/tags.spec.ts +++ b/code/e2e-tests/tags.spec.ts @@ -10,24 +10,6 @@ test.describe('tags', () => { await new SbPage(page, expect).waitUntilLoaded(); }); - test('should correctly filter dev-only, docs-only, test-only stories', async ({ page }) => { - const sbPage = new SbPage(page, expect); - - await sbPage.navigateToStory('core/tags-config', 'docs'); - - // Sidebar should include dev-only and exclude docs-only and test-only - await expect(page.locator('#core-tags-config--dev-only')).toHaveCount(1); - await expect(page.locator('#core-tags-config--docs-only')).toHaveCount(0); - await expect(page.locator('#core-tags-config--test-only')).toHaveCount(0); - - // Autodocs should include docs-only and exclude dev-only and test-only - const preview = sbPage.previewRoot(); - - await expect(preview.locator('#anchor--core-tags-config--dev-only')).toHaveCount(0); - await expect(preview.locator('#anchor--core-tags-config--docs-only')).toHaveCount(1); - await expect(preview.locator('#anchor--core-tags-config--test-only')).toHaveCount(0); - }); - test('should correctly add dev, autodocs, test stories', async ({ page }) => { const sbPage = new SbPage(page, expect); From 7f1d4c872997f60c26e085c5c42e1190da5e80ec Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 2 Sep 2025 15:44:45 -0700 Subject: [PATCH 2/2] fix typo Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- MIGRATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MIGRATION.md b/MIGRATION.md index e24f570c7b77..7ea7f20f2c94 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -582,7 +582,7 @@ export const core = { ``` #### Removed x-only builtin tags - +During development of Storybook [Tags](https://storybook.js.org/docs/writing-stories/tags), we created `dev-only`, `docs-only`, and `test-only` built-in tags. These tags were never documented and superseded by the currently-documented `dev`, `autodocs`, and `test` tags which provide more precise control. The outdated `x-only` tags are removed in 10.0. During development of Storybook [Tags](https://storybook.js.org/docs/writing-stories/tags), we created `dev-only`, `docs-only`, and `test-only` built-in tags. These tags were never documented and superceded by the currently-documented `dev`, `autodocs`, and `test` tags which provide more precise control. The outdated `x-only` tags are removed in 10.0. ## From version 8.x to 9.0.0