Merge branch 'next' into norbert/lodash-es

This commit is contained in:
Norbert de Langen 2024-09-25 09:55:06 +02:00
commit 4b4821c275
102 changed files with 295 additions and 193 deletions

View File

@ -1,3 +1,9 @@
## 8.3.3
- CLI: Show constraints in error when getting depndencies - [#29187](https://github.com/storybookjs/storybook/pull/29187), thanks @andrasczeh!
- React-Vite: Downgrade react-docgen-typescript plugin - [#29184](https://github.com/storybookjs/storybook/pull/29184), thanks @shilman!
- UI: Fix composed storybook TooltipLinkList bug where href isn't passed forward - [#29175](https://github.com/storybookjs/storybook/pull/29175), thanks @JSMike!
## 8.3.2
- CLI: Fix skip-install for stable latest releases - [#29133](https://github.com/storybookjs/storybook/pull/29133), thanks @valentinpalkovic!

View File

@ -1,3 +1,22 @@
## 8.4.0-alpha.1
- Addon Test: Support story name as test description - [#29147](https://github.com/storybookjs/storybook/pull/29147), thanks @InfiniteXyy!
- Addon-Interactions: Use ansi-to-html for colored test errors - [#29110](https://github.com/storybookjs/storybook/pull/29110), thanks @kasperpeulen!
- Angular: Fix sourceDecorator to apply excludeDecorators flag - [#29069](https://github.com/storybookjs/storybook/pull/29069), thanks @JSMike!
- Builder-vite: Replace .at() call with [] in codegen - [#29048](https://github.com/storybookjs/storybook/pull/29048), thanks @Chudesnov!
- CLI: Ensure `.gitignore` updated via CLI ends with a newline - [#29124](https://github.com/storybookjs/storybook/pull/29124), thanks @3w36zj6!
- CLI: Fix skip-install for stable latest releases - [#29133](https://github.com/storybookjs/storybook/pull/29133), thanks @valentinpalkovic!
- CLI: Show constraints in error when getting depndencies - [#29187](https://github.com/storybookjs/storybook/pull/29187), thanks @andrasczeh!
- Core: Do not add packageManager field to package.json during `storybook dev` - [#29152](https://github.com/storybookjs/storybook/pull/29152), thanks @valentinpalkovic!
- Core: Do not prebundle better-opn - [#29137](https://github.com/storybookjs/storybook/pull/29137), thanks @valentinpalkovic!
- Core: Do not prebundle jsdoc-type-pratt-parser - [#29134](https://github.com/storybookjs/storybook/pull/29134), thanks @valentinpalkovic!
- Core: Replace `fs-extra` with the native APIs - [#29126](https://github.com/storybookjs/storybook/pull/29126), thanks @ziebam!
- Next.js: Upgrade sass-loader from ^12 to ^13 - [#29040](https://github.com/storybookjs/storybook/pull/29040), thanks @HoncharenkoZhenya!
- React-Vite: Downgrade react-docgen-typescript plugin - [#29184](https://github.com/storybookjs/storybook/pull/29184), thanks @shilman!
- UI: Fix composed storybook TooltipLinkList bug where href isn't passed forward - [#29175](https://github.com/storybookjs/storybook/pull/29175), thanks @JSMike!
- Viewport-addon: Add InitialViewportKeys type to viewport addon - [#29182](https://github.com/storybookjs/storybook/pull/29182), thanks @hyeongrok7874!
- Vite: Add jsdoc-type-pratt-parser to `optimizeDeps` - [#29179](https://github.com/storybookjs/storybook/pull/29179), thanks @tobiasdiez!
## 8.4.0-alpha.0

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-a11y",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Test component compliance with web accessibility standards",
"keywords": [
"a11y",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-actions",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Get UI feedback when an action is performed on an interactive element",
"keywords": [
"storybook",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-backgrounds",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Switch backgrounds to view components in different settings",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-controls",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Interact with component inputs dynamically in the Storybook UI",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-docs",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Document component usage and properties in Markdown",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-essentials",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Curated addons to bring out the best of Storybook",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-mdx-gfm",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "GitHub Flavored Markdown in Storybook",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-highlight",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Highlight DOM nodes within your stories",
"keywords": [
"storybook-addons",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-interactions",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Automate, test and debug user interactions",
"keywords": [
"storybook-addons",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-jest",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "React storybook addon that show component jest report",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-links",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Link stories together to build demos and prototypes with your UI components",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-measure",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Inspect layouts by visualizing the box model",
"keywords": [
"storybook-addons",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-onboarding",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook Addon Onboarding - Introduces a new onboarding experience",
"keywords": [
"storybook-addons",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-outline",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Outline all elements with CSS to help with layout placement and alignment",
"keywords": [
"storybook-addons",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storysource",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "View a storys source code to see how it works and paste into your app",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/experimental-addon-test",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Integrate Vitest with Storybook",
"keywords": [
"storybook-addons",

View File

@ -148,7 +148,7 @@ export const myCustomDecorator = ({ themes, defaultState, ...rest }) => {
Let's use Vuetify as an example. Vuetify uses it's own global state to know which theme to render. To build a custom decorator to accommodate this method we'll need to do the following
```js
// .storybook/withVeutifyTheme.decorator.js
// .storybook/withVuetifyTheme.decorator.js
import { DecoratorHelpers } from '@storybook/addon-themes';
import { useTheme } from 'vuetify';

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-themes",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Switch between multiple themes for you components in Storybook",
"keywords": [
"css",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-toolbars",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Create your own toolbar items that control story rendering",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-viewport",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Build responsive components by adjusting Storybooks viewport size and orientation",
"keywords": [
"addon",

View File

@ -1,6 +1,6 @@
import type { ViewportMap } from './types';
export const INITIAL_VIEWPORTS: ViewportMap = {
const INITIAL_VIEWPORTS_DATA = {
iphone5: {
name: 'iPhone 5',
styles: {
@ -225,7 +225,12 @@ export const INITIAL_VIEWPORTS: ViewportMap = {
},
type: 'mobile',
},
};
} as const;
export type InitialViewportKeys = keyof typeof INITIAL_VIEWPORTS_DATA;
export const INITIAL_VIEWPORTS: ViewportMap = INITIAL_VIEWPORTS_DATA;
export const DEFAULT_VIEWPORT = 'responsive';
export const MINIMAL_VIEWPORTS: ViewportMap = {

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/builder-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "A plugin to run and build Storybooks with Vite",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-vite/#readme",
"bugs": {

View File

@ -27,7 +27,7 @@ export async function generateModernIframeScriptCode(options: Options, projectRo
.map(
(previewAnnotation, index) =>
// Prefer the updated module from an HMR update, otherwise import the original module
`hmrPreviewAnnotationModules.at(${index}) ?? import('${previewAnnotation}')`
`hmrPreviewAnnotationModules[${index}] ?? import('${previewAnnotation}')`
)
.join(',\n')}])
return composeConfigs(configs);

View File

@ -32,6 +32,7 @@ const INCLUDE_CANDIDATES = [
'fast-deep-equal',
'html-tags',
'isobject',
'jsdoc-type-pratt-parser', // TODO: Remove this once it's converted to ESM: https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/173
'loader-utils',
'lodash/camelCase.js',
'lodash/camelCase',

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/builder-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
@ -376,6 +376,7 @@
"glob": "^10.0.0",
"globby": "^14.0.1",
"handlebars": "^4.7.7",
"jiti": "^1.21.6",
"js-yaml": "^4.1.0",
"lazy-universal-dotenv": "^4.0.0",
"leven": "^4.0.0",

View File

@ -418,7 +418,7 @@ export abstract class JsPackageManager {
.find((version) => satisfies(version, constraint));
invariant(
latestVersionSatisfyingTheConstraint != null,
'No version satisfying the constraint.'
`No version satisfying the constraint: ${packageName}${constraint}`
);
return latestVersionSatisfyingTheConstraint;
}

View File

@ -1,87 +1,87 @@
// auto generated file, do not edit
export default {
'@storybook/addon-a11y': '8.4.0-alpha.0',
'@storybook/addon-actions': '8.4.0-alpha.0',
'@storybook/addon-backgrounds': '8.4.0-alpha.0',
'@storybook/addon-controls': '8.4.0-alpha.0',
'@storybook/addon-docs': '8.4.0-alpha.0',
'@storybook/addon-essentials': '8.4.0-alpha.0',
'@storybook/addon-mdx-gfm': '8.4.0-alpha.0',
'@storybook/addon-highlight': '8.4.0-alpha.0',
'@storybook/addon-interactions': '8.4.0-alpha.0',
'@storybook/addon-jest': '8.4.0-alpha.0',
'@storybook/addon-links': '8.4.0-alpha.0',
'@storybook/addon-measure': '8.4.0-alpha.0',
'@storybook/addon-onboarding': '8.4.0-alpha.0',
'@storybook/addon-outline': '8.4.0-alpha.0',
'@storybook/addon-storysource': '8.4.0-alpha.0',
'@storybook/experimental-addon-test': '8.4.0-alpha.0',
'@storybook/addon-themes': '8.4.0-alpha.0',
'@storybook/addon-toolbars': '8.4.0-alpha.0',
'@storybook/addon-viewport': '8.4.0-alpha.0',
'@storybook/builder-vite': '8.4.0-alpha.0',
'@storybook/builder-webpack5': '8.4.0-alpha.0',
'@storybook/core': '8.4.0-alpha.0',
'@storybook/builder-manager': '8.4.0-alpha.0',
'@storybook/channels': '8.4.0-alpha.0',
'@storybook/client-logger': '8.4.0-alpha.0',
'@storybook/components': '8.4.0-alpha.0',
'@storybook/core-common': '8.4.0-alpha.0',
'@storybook/core-events': '8.4.0-alpha.0',
'@storybook/core-server': '8.4.0-alpha.0',
'@storybook/csf-tools': '8.4.0-alpha.0',
'@storybook/docs-tools': '8.4.0-alpha.0',
'@storybook/manager': '8.4.0-alpha.0',
'@storybook/manager-api': '8.4.0-alpha.0',
'@storybook/node-logger': '8.4.0-alpha.0',
'@storybook/preview': '8.4.0-alpha.0',
'@storybook/preview-api': '8.4.0-alpha.0',
'@storybook/router': '8.4.0-alpha.0',
'@storybook/telemetry': '8.4.0-alpha.0',
'@storybook/theming': '8.4.0-alpha.0',
'@storybook/types': '8.4.0-alpha.0',
'@storybook/angular': '8.4.0-alpha.0',
'@storybook/ember': '8.4.0-alpha.0',
'@storybook/experimental-nextjs-vite': '8.4.0-alpha.0',
'@storybook/html-vite': '8.4.0-alpha.0',
'@storybook/html-webpack5': '8.4.0-alpha.0',
'@storybook/nextjs': '8.4.0-alpha.0',
'@storybook/preact-vite': '8.4.0-alpha.0',
'@storybook/preact-webpack5': '8.4.0-alpha.0',
'@storybook/react-vite': '8.4.0-alpha.0',
'@storybook/react-webpack5': '8.4.0-alpha.0',
'@storybook/server-webpack5': '8.4.0-alpha.0',
'@storybook/svelte-vite': '8.4.0-alpha.0',
'@storybook/svelte-webpack5': '8.4.0-alpha.0',
'@storybook/sveltekit': '8.4.0-alpha.0',
'@storybook/vue3-vite': '8.4.0-alpha.0',
'@storybook/vue3-webpack5': '8.4.0-alpha.0',
'@storybook/web-components-vite': '8.4.0-alpha.0',
'@storybook/web-components-webpack5': '8.4.0-alpha.0',
'@storybook/blocks': '8.4.0-alpha.0',
storybook: '8.4.0-alpha.0',
sb: '8.4.0-alpha.0',
'@storybook/cli': '8.4.0-alpha.0',
'@storybook/codemod': '8.4.0-alpha.0',
'@storybook/core-webpack': '8.4.0-alpha.0',
'create-storybook': '8.4.0-alpha.0',
'@storybook/csf-plugin': '8.4.0-alpha.0',
'@storybook/instrumenter': '8.4.0-alpha.0',
'@storybook/react-dom-shim': '8.4.0-alpha.0',
'@storybook/source-loader': '8.4.0-alpha.0',
'@storybook/test': '8.4.0-alpha.0',
'@storybook/preset-create-react-app': '8.4.0-alpha.0',
'@storybook/preset-html-webpack': '8.4.0-alpha.0',
'@storybook/preset-preact-webpack': '8.4.0-alpha.0',
'@storybook/preset-react-webpack': '8.4.0-alpha.0',
'@storybook/preset-server-webpack': '8.4.0-alpha.0',
'@storybook/preset-svelte-webpack': '8.4.0-alpha.0',
'@storybook/preset-vue3-webpack': '8.4.0-alpha.0',
'@storybook/html': '8.4.0-alpha.0',
'@storybook/preact': '8.4.0-alpha.0',
'@storybook/react': '8.4.0-alpha.0',
'@storybook/server': '8.4.0-alpha.0',
'@storybook/svelte': '8.4.0-alpha.0',
'@storybook/vue3': '8.4.0-alpha.0',
'@storybook/web-components': '8.4.0-alpha.0',
'@storybook/addon-a11y': '8.4.0-alpha.1',
'@storybook/addon-actions': '8.4.0-alpha.1',
'@storybook/addon-backgrounds': '8.4.0-alpha.1',
'@storybook/addon-controls': '8.4.0-alpha.1',
'@storybook/addon-docs': '8.4.0-alpha.1',
'@storybook/addon-essentials': '8.4.0-alpha.1',
'@storybook/addon-mdx-gfm': '8.4.0-alpha.1',
'@storybook/addon-highlight': '8.4.0-alpha.1',
'@storybook/addon-interactions': '8.4.0-alpha.1',
'@storybook/addon-jest': '8.4.0-alpha.1',
'@storybook/addon-links': '8.4.0-alpha.1',
'@storybook/addon-measure': '8.4.0-alpha.1',
'@storybook/addon-onboarding': '8.4.0-alpha.1',
'@storybook/addon-outline': '8.4.0-alpha.1',
'@storybook/addon-storysource': '8.4.0-alpha.1',
'@storybook/experimental-addon-test': '8.4.0-alpha.1',
'@storybook/addon-themes': '8.4.0-alpha.1',
'@storybook/addon-toolbars': '8.4.0-alpha.1',
'@storybook/addon-viewport': '8.4.0-alpha.1',
'@storybook/builder-vite': '8.4.0-alpha.1',
'@storybook/builder-webpack5': '8.4.0-alpha.1',
'@storybook/core': '8.4.0-alpha.1',
'@storybook/builder-manager': '8.4.0-alpha.1',
'@storybook/channels': '8.4.0-alpha.1',
'@storybook/client-logger': '8.4.0-alpha.1',
'@storybook/components': '8.4.0-alpha.1',
'@storybook/core-common': '8.4.0-alpha.1',
'@storybook/core-events': '8.4.0-alpha.1',
'@storybook/core-server': '8.4.0-alpha.1',
'@storybook/csf-tools': '8.4.0-alpha.1',
'@storybook/docs-tools': '8.4.0-alpha.1',
'@storybook/manager': '8.4.0-alpha.1',
'@storybook/manager-api': '8.4.0-alpha.1',
'@storybook/node-logger': '8.4.0-alpha.1',
'@storybook/preview': '8.4.0-alpha.1',
'@storybook/preview-api': '8.4.0-alpha.1',
'@storybook/router': '8.4.0-alpha.1',
'@storybook/telemetry': '8.4.0-alpha.1',
'@storybook/theming': '8.4.0-alpha.1',
'@storybook/types': '8.4.0-alpha.1',
'@storybook/angular': '8.4.0-alpha.1',
'@storybook/ember': '8.4.0-alpha.1',
'@storybook/experimental-nextjs-vite': '8.4.0-alpha.1',
'@storybook/html-vite': '8.4.0-alpha.1',
'@storybook/html-webpack5': '8.4.0-alpha.1',
'@storybook/nextjs': '8.4.0-alpha.1',
'@storybook/preact-vite': '8.4.0-alpha.1',
'@storybook/preact-webpack5': '8.4.0-alpha.1',
'@storybook/react-vite': '8.4.0-alpha.1',
'@storybook/react-webpack5': '8.4.0-alpha.1',
'@storybook/server-webpack5': '8.4.0-alpha.1',
'@storybook/svelte-vite': '8.4.0-alpha.1',
'@storybook/svelte-webpack5': '8.4.0-alpha.1',
'@storybook/sveltekit': '8.4.0-alpha.1',
'@storybook/vue3-vite': '8.4.0-alpha.1',
'@storybook/vue3-webpack5': '8.4.0-alpha.1',
'@storybook/web-components-vite': '8.4.0-alpha.1',
'@storybook/web-components-webpack5': '8.4.0-alpha.1',
'@storybook/blocks': '8.4.0-alpha.1',
storybook: '8.4.0-alpha.1',
sb: '8.4.0-alpha.1',
'@storybook/cli': '8.4.0-alpha.1',
'@storybook/codemod': '8.4.0-alpha.1',
'@storybook/core-webpack': '8.4.0-alpha.1',
'create-storybook': '8.4.0-alpha.1',
'@storybook/csf-plugin': '8.4.0-alpha.1',
'@storybook/instrumenter': '8.4.0-alpha.1',
'@storybook/react-dom-shim': '8.4.0-alpha.1',
'@storybook/source-loader': '8.4.0-alpha.1',
'@storybook/test': '8.4.0-alpha.1',
'@storybook/preset-create-react-app': '8.4.0-alpha.1',
'@storybook/preset-html-webpack': '8.4.0-alpha.1',
'@storybook/preset-preact-webpack': '8.4.0-alpha.1',
'@storybook/preset-react-webpack': '8.4.0-alpha.1',
'@storybook/preset-server-webpack': '8.4.0-alpha.1',
'@storybook/preset-svelte-webpack': '8.4.0-alpha.1',
'@storybook/preset-vue3-webpack': '8.4.0-alpha.1',
'@storybook/html': '8.4.0-alpha.1',
'@storybook/preact': '8.4.0-alpha.1',
'@storybook/react': '8.4.0-alpha.1',
'@storybook/server': '8.4.0-alpha.1',
'@storybook/svelte': '8.4.0-alpha.1',
'@storybook/vue3': '8.4.0-alpha.1',
'@storybook/web-components': '8.4.0-alpha.1',
};

View File

@ -169,7 +169,7 @@ const getItemProps = memoize(100)((onClick, href, LinkWrapper) => ({
export type LinkWrapperType = (props: any) => ReactNode;
export interface ListItemProps extends Omit<ComponentProps<typeof Item>, 'href' | 'title'> {
export interface ListItemProps extends Omit<ComponentProps<typeof Item>, 'title'> {
loading?: boolean;
title?: ReactNode;
center?: ReactNode;

View File

@ -22,7 +22,7 @@ export interface Link extends Omit<ListItemProps, 'onClick'> {
id: string;
onClick?: (
event: SyntheticEvent,
item: Pick<ListItemProps, 'id' | 'active' | 'disabled' | 'title'>
item: Pick<ListItemProps, 'id' | 'active' | 'disabled' | 'title' | 'href'>
) => void;
}
@ -31,11 +31,11 @@ interface ItemProps extends Link {
}
const Item = ({ id, onClick, ...rest }: ItemProps) => {
const { active, disabled, title } = rest;
const { active, disabled, title, href } = rest;
const handleClick = useCallback(
(event: SyntheticEvent) => onClick?.(event, { id, active, disabled, title }),
[onClick, id, active, disabled, title]
(event: SyntheticEvent) => onClick?.(event, { id, active, disabled, title, href }),
[onClick, id, active, disabled, title, href]
);
return <ListItem id={`list-item-${id}`} {...rest} {...(onClick && { onClick: handleClick })} />;

View File

@ -213,6 +213,55 @@ describe('transformer', () => {
`);
});
describe("use the story's name as test title", () => {
it('should support CSF v3 via name property', async () => {
const code = `
export default { component: Button }
export const Primary = { name: "custom name" };`;
const result = await transform({ code });
expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
component: Button,
title: "automatic/calculated/title"
};
export default _meta;
export const Primary = {
name: "custom name"
};
const _isRunningFromThisFile = import.meta.url.includes(globalThis.__vitest_worker__.filepath ?? _expect.getState().testPath);
if (_isRunningFromThisFile) {
_test("custom name", _testStory("Primary", Primary, _meta, []));
}
`);
});
it('should support CSF v1/v2 via storyName property', async () => {
const code = `
export default { component: Button }
export const Story = () => {}
Story.storyName = 'custom name';`;
const result = await transform({ code: code });
expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
component: Button,
title: "automatic/calculated/title"
};
export default _meta;
export const Story = () => {};
Story.storyName = 'custom name';
const _isRunningFromThisFile = import.meta.url.includes(globalThis.__vitest_worker__.filepath ?? _expect.getState().testPath);
if (_isRunningFromThisFile) {
_test("custom name", _testStory("Story", Story, _meta, []));
}
`);
});
});
it('should add test statement to const declared exported stories', async () => {
const code = `
export default {};

View File

@ -202,15 +202,17 @@ export async function vitestTransform({
const getTestStatementForStory = ({
exportName,
testTitle,
node,
}: {
exportName: string;
testTitle: string;
node: t.Node;
}): t.ExpressionStatement => {
// Create the _test expression directly using the exportName identifier
const testStoryCall = t.expressionStatement(
t.callExpression(vitestTestId, [
t.stringLiteral(exportName),
t.stringLiteral(testTitle),
t.callExpression(testStoryId, [
t.stringLiteral(exportName),
t.identifier(exportName),
@ -239,10 +241,9 @@ export async function vitestTransform({
return;
}
return getTestStatementForStory({
exportName,
node,
});
// use the story's name as the test title for vitest, and fallback to exportName
const testTitle = parsed._stories[exportName].name ?? exportName;
return getTestStatementForStory({ testTitle, exportName, node });
})
.filter((st) => !!st) as t.ExpressionStatement[];

View File

@ -1 +1 @@
export const version = '8.4.0-alpha.0';
export const version = '8.4.0-alpha.1';

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/builder-manager",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook manager builder",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/channels",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/client-logger",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/components",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Core Storybook Components",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-common",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-events",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Event names used in storybook core",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-server",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/csf-tools",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Parse and manipulate CSF and Storybook config files",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/docs-tools",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Shared utility functions for frameworks to implement docs",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/manager-api",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Core Storybook Manager API & Context",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/manager",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Core Storybook UI",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/node-logger",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preview-api",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preview",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/router",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Core Storybook Router",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/telemetry",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Telemetry logging for crash reports and usage statistics",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/theming",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Core Storybook Components",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/types",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Core Storybook TS Types",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/angular",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
"keywords": [
"storybook",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/ember",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/frameworks/ember",
"bugs": {

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/experimental-nextjs-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Next.js and Vite",
"keywords": [
"storybook",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/html-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for HTML and Vite: Develop HTML in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/html-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/nextjs",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Next.js",
"keywords": [
"storybook",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preact-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Preact and Vite: Develop Preact components in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preact-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Preact: Develop Preact Component in isolation.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for React and Vite: Develop React components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -47,7 +47,7 @@
"prep": "jiti ../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@joshwooding/vite-plugin-react-docgen-typescript": "0.3.1",
"@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0",
"@rollup/pluginutils": "^5.0.2",
"@storybook/builder-vite": "workspace:*",
"@storybook/react": "workspace:*",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/server-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/svelte-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Svelte and Vite: Develop Svelte components in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/svelte-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Svelte: Develop Svelte Component in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/sveltekit",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for SvelteKit",
"keywords": [
"storybook",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue3-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Vue3 and Vite: Develop Vue3 components in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue3-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Vue 3: Develop Vue 3 Components in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/web-components-vite",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for web-components and Vite: Develop Web Components in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/web-components-webpack5",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for web-components: View web components snippets in isolation with Hot Reloading.",
"keywords": [
"lit",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/blocks",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook Doc Blocks",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "sb",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook CLI",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/cli",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook CLI",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "storybook",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook's CLI - install, dev, build, upgrade, and more",
"keywords": [
"cli",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/codemod",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "A collection of codemod scripts written with JSCodeshift",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-webpack",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "create-storybook",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Initialize Storybook into your project",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/create-storybook",
"bugs": {

View File

@ -375,7 +375,7 @@ export async function doInitiate(options: CommandOptions): Promise<
if (foundGitIgnoreFile && foundGitIgnoreFile.includes(rootDirectory)) {
const contents = await readFile(foundGitIgnoreFile, 'utf-8');
if (!contents.includes('*storybook.log')) {
await appendFile(foundGitIgnoreFile, '\n*storybook.log');
await appendFile(foundGitIgnoreFile, '\n*storybook.log\n');
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/csf-plugin",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Enrich CSF files via static analysis",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/instrumenter",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react-dom-shim",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/source-loader",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Source loader",
"keywords": [
"lib",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/test",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/root",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"private": true,
"description": "Storybook root",
"homepage": "https://storybook.js.org/",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preset-create-react-app",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Create React App preset",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preset-html-webpack",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preset-preact-webpack",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Preact: Develop Preact Component in isolation.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preset-react-webpack",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preset-server-webpack",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preset-svelte-webpack",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Svelte: Develop Svelte Component in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preset-vue3-webpack",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook for Vue 3: Develop Vue 3 Components in isolation with Hot Reloading.",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/html",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook HTML renderer",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preact",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook Preact renderer",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook React renderer",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/server",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook Server renderer",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/svelte",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook Svelte renderer",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue3",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook Vue 3 renderer",
"keywords": [
"storybook"

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/web-components",
"version": "8.4.0-alpha.0",
"version": "8.4.0-alpha.1",
"description": "Storybook web-components renderer",
"keywords": [
"lit",

View File

@ -3677,9 +3677,9 @@ __metadata:
languageName: node
linkType: hard
"@joshwooding/vite-plugin-react-docgen-typescript@npm:0.3.1":
version: 0.3.1
resolution: "@joshwooding/vite-plugin-react-docgen-typescript@npm:0.3.1"
"@joshwooding/vite-plugin-react-docgen-typescript@npm:0.3.0":
version: 0.3.0
resolution: "@joshwooding/vite-plugin-react-docgen-typescript@npm:0.3.0"
dependencies:
glob: "npm:^7.2.0"
glob-promise: "npm:^4.2.0"
@ -3691,7 +3691,7 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/a9c7a03d7d1daf5bd64949255516ba64c88d5600366c8c74dcdb6f37c2a6099daaec02860b7587d2220e61afa47a0b2de17ef70d723c2db02f24e0890edfd9f3
checksum: 10c0/31098ad8fcc2440437534599c111d9f2951dd74821e8ba46c521b969bae4c918d830b7bb0484efbad29a51711bb62d3bc623d5a1ed5b1695b5b5594ea9dd4ca0
languageName: node
linkType: hard
@ -6089,6 +6089,7 @@ __metadata:
glob: "npm:^10.0.0"
globby: "npm:^14.0.1"
handlebars: "npm:^4.7.7"
jiti: "npm:^1.21.6"
js-yaml: "npm:^4.1.0"
jsdoc-type-pratt-parser: "npm:^4.0.0"
lazy-universal-dotenv: "npm:^4.0.0"
@ -6696,7 +6697,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@storybook/react-vite@workspace:frameworks/react-vite"
dependencies:
"@joshwooding/vite-plugin-react-docgen-typescript": "npm:0.3.1"
"@joshwooding/vite-plugin-react-docgen-typescript": "npm:0.3.0"
"@rollup/pluginutils": "npm:^5.0.2"
"@storybook/builder-vite": "workspace:*"
"@storybook/react": "workspace:*"
@ -18328,6 +18329,15 @@ __metadata:
languageName: node
linkType: hard
"jiti@npm:^1.21.6":
version: 1.21.6
resolution: "jiti@npm:1.21.6"
bin:
jiti: bin/jiti.js
checksum: 10c0/05b9ed58cd30d0c3ccd3c98209339e74f50abd9a17e716f65db46b6a35812103f6bde6e134be7124d01745586bca8cc5dae1d0d952267c3ebe55171949c32e56
languageName: node
linkType: hard
"jju@npm:^1.4.0":
version: 1.4.0
resolution: "jju@npm:1.4.0"

Some files were not shown because too many files have changed in this diff Show More