Skip to content

Commit 99a5faf

Browse files
authored
Merge pull request #32360 from storybookjs/shilman/clean-x-only-tags
Tags: Remove undocumented x-only tags
2 parents 109d310 + df9a72c commit 99a5faf

File tree

5 files changed

+7
-41
lines changed

5 files changed

+7
-41
lines changed

MIGRATION.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [Node.js 20.19+ or 22.12+ required](#nodejs-2019-or-2212-required)
88
- [Require `tsconfig.json` `moduleResolution` set to value that supports `types` condition](#require-tsconfigjson-moduleresolution-set-to-value-that-supports-types-condition)
99
- [`core.builder` configuration must be a fully resolved path](#corebuilder-configuration-must-be-a-fully-resolved-path)
10+
- [Removed x-only builtin tags](#removed-x-only-builtin-tags)
1011
- [From version 8.x to 9.0.0](#from-version-8x-to-900)
1112
- [Core Changes and Removals](#core-changes-and-removals)
1213
- [Dropped support for legacy packages](#dropped-support-for-legacy-packages)
@@ -580,6 +581,10 @@ export const core = {
580581
};
581582
```
582583

584+
#### Removed x-only builtin tags
585+
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.
586+
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.
587+
583588
## From version 8.x to 9.0.0
584589

585590
### Core Changes and Removals
@@ -1806,7 +1811,7 @@ These sections explain the rationale, and the required changes you might have to
18061811

18071812
### Deprecated `@storybook/testing-library` package
18081813

1809-
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:
1814+
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:
18101815

18111816
```diff
18121817
- import { userEvent } from '@storybook/testing-library';

code/core/src/core-server/presets/common-preset.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,6 @@ export const resolvedReact = async (existing: any) => {
278278
}
279279
};
280280

281-
/** Set up `dev-only`, `docs-only`, `test-only` tags out of the box */
282-
export const tags = async (existing: any) => {
283-
return {
284-
...existing,
285-
'dev-only': { excludeFromDocsStories: true },
286-
'docs-only': { excludeFromSidebar: true },
287-
'test-only': { excludeFromSidebar: true, excludeFromDocsStories: true },
288-
};
289-
};
290-
291281
export const managerEntries = async (existing: any) => {
292282
return [
293283
pathe.join(resolvePackageDir('storybook'), 'dist/core-server/presets/common-manager.js'),

code/core/src/manager/components/sidebar/TagsFilter.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ import { TagsFilterPanel } from './TagsFilterPanel';
1212

1313
const TAGS_FILTER = 'tags-filter';
1414

15-
const BUILT_IN_TAGS_HIDE = new Set([
16-
'dev',
17-
'docs-only',
18-
'test-only',
19-
'autodocs',
20-
'test',
21-
'attached-mdx',
22-
'unattached-mdx',
23-
]);
15+
const BUILT_IN_TAGS_HIDE = new Set(['dev', 'autodocs', 'test', 'attached-mdx', 'unattached-mdx']);
2416

2517
const Wrapper = styled.div({
2618
position: 'relative',

code/core/src/manager/components/sidebar/TagsFilterPanel.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ import type { Link } from '../../../components/components/tooltip/TooltipLinkLis
2020
const BUILT_IN_TAGS = new Set([
2121
'dev',
2222
'test',
23-
'dev-only',
24-
'test-only',
25-
'docs-only',
2623
'autodocs',
2724
'attached-mdx',
2825
'unattached-mdx',

code/e2e-tests/tags.spec.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,6 @@ test.describe('tags', () => {
1010
await new SbPage(page, expect).waitUntilLoaded();
1111
});
1212

13-
test('should correctly filter dev-only, docs-only, test-only stories', async ({ page }) => {
14-
const sbPage = new SbPage(page, expect);
15-
16-
await sbPage.navigateToStory('core/tags-config', 'docs');
17-
18-
// Sidebar should include dev-only and exclude docs-only and test-only
19-
await expect(page.locator('#core-tags-config--dev-only')).toHaveCount(1);
20-
await expect(page.locator('#core-tags-config--docs-only')).toHaveCount(0);
21-
await expect(page.locator('#core-tags-config--test-only')).toHaveCount(0);
22-
23-
// Autodocs should include docs-only and exclude dev-only and test-only
24-
const preview = sbPage.previewRoot();
25-
26-
await expect(preview.locator('#anchor--core-tags-config--dev-only')).toHaveCount(0);
27-
await expect(preview.locator('#anchor--core-tags-config--docs-only')).toHaveCount(1);
28-
await expect(preview.locator('#anchor--core-tags-config--test-only')).toHaveCount(0);
29-
});
30-
3113
test('should correctly add dev, autodocs, test stories', async ({ page }) => {
3214
const sbPage = new SbPage(page, expect);
3315

0 commit comments

Comments
 (0)