-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26611 from storybookjs/version-non-patch-from-8.1…
….0-alpha.4 Release: Prerelease 8.1.0-alpha.5
- Loading branch information
Showing
100 changed files
with
1,255 additions
and
1,146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
18.18.2 | ||
18.19.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, * as ReactExport from 'react'; | ||
import * as ReactDom from 'react-dom'; | ||
import * as ReactDomServer from 'react-dom/server'; | ||
|
||
export const ResolvedReact = () => { | ||
return ( | ||
<> | ||
<p> | ||
<code>react</code>:{' '} | ||
<code data-testid="component-react"> | ||
{ReactExport.version ?? 'no version export found'} | ||
</code> | ||
</p> | ||
<p> | ||
<code>react-dom</code>:{' '} | ||
<code data-testid="component-react-dom"> | ||
{ReactDom.version ?? 'no version export found'} | ||
</code> | ||
</p> | ||
<p> | ||
<code>react-dom/server</code>:{' '} | ||
<code data-testid="component-react-dom-server"> | ||
{ReactDomServer.version ?? 'no version export found'} | ||
</code> | ||
</p> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
import { version as reactVersion } from 'react'; | ||
import { version as reactDomVersion } from 'react-dom'; | ||
import { ResolvedReactVersion } from './ResolvedReactVersion'; | ||
import { Meta } from '@storybook/blocks'; | ||
import * as ReactExport from 'react'; | ||
import * as ReactDom from 'react-dom'; | ||
import * as ReactDomServer from 'react-dom/server'; | ||
import { ResolvedReact } from './ResolvedReact'; | ||
|
||
<Meta title="docs2/ResolvedReact" name="MDX"/> | ||
|
||
This doc is used to display the resolved version of React and its related packages. | ||
As long as `@storybook/addon-docs` is installed, `react` and `react-dom` should be available to import from and should resolve to the same version. | ||
|
||
The MDX here ensures that it works in an MDX file. | ||
|
||
- See the [autodocs](/docs/addons-docs-docs2-resolvedreact--docs) for how it resolves in autodocs. | ||
- See the [Story](/story/addons-docs-docs2-resolvedreact--story) for how it resolves in the actual story. | ||
|
||
**Note: There appears to be a bug in the _production_ build of `react-dom`, where it reports version `18.2.0-next-9e3b772b8-20220608` while in fact version `18.2.0` is installed.** | ||
|
||
## In MDX | ||
|
||
<code>react</code>: <code data-testid="mdx-react">{reactVersion}</code> | ||
<code>react</code>: <code data-testid="mdx-react">{ReactExport.version ?? 'no version export found'}</code> | ||
|
||
<code>react-dom</code>: <code data-testid="mdx-react-dom">{ReactDom.version ?? 'no version export found'}</code> | ||
|
||
<code>react-dom</code>: <code data-testid="mdx-react-dom">{reactDomVersion}</code> | ||
<code>react-dom/server</code>: <code data-testid="mdx-react-dom-server">{ReactDomServer.version ?? 'no version export found'}</code> | ||
|
||
## In `ResolvedReactVersion` component | ||
## In `ResolvedReact` component | ||
|
||
<ResolvedReactVersion /> | ||
<ResolvedReact /> |
15 changes: 0 additions & 15 deletions
15
code/addons/docs/template/stories/docs2/ResolvedReactVersion.jsx
This file was deleted.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
code/addons/docs/template/stories/docs2/resolved-react.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { within, expect } from '@storybook/test'; | ||
import * as ReactExport from 'react'; | ||
import * as ReactDom from 'react-dom'; | ||
import * as ReactDomServer from 'react-dom/server'; | ||
|
||
/** | ||
* This component is used to display the resolved version of React and its related packages. | ||
* As long as `@storybook/addon-docs` is installed, `react` and `react-dom` should be available to import from and should resolve to the same version. | ||
* | ||
* The autodocs here ensures that it also works in the generated documentation. | ||
* | ||
* - See the [MDX docs](/docs/addons-docs-docs2-resolvedreact--mdx) for how it resolves in MDX. | ||
* - See the [Story](/story/addons-docs-docs2-resolvedreact--story) for how it resolves in the actual story. | ||
* | ||
* **Note: There appears to be a bug in the _production_ build of `react-dom`, where it reports version `18.2.0-next-9e3b772b8-20220608` while in fact version `18.2.0` is installed.** | ||
*/ | ||
export default { | ||
title: 'Docs2/ResolvedReact', | ||
component: globalThis.Components.Html, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
content: { table: { disable: true } }, | ||
}, | ||
args: { | ||
content: ` | ||
<p> | ||
<code>react</code>: <code data-testid="react">${ | ||
ReactExport.version ?? 'no version export found' | ||
}</code> | ||
</p> | ||
<p> | ||
<code>react-dom</code>: <code data-testid="react-dom">${ | ||
ReactDom.version ?? 'no version export found' | ||
}</code> | ||
</p> | ||
<p> | ||
<code>react-dom/server</code>: <code data-testid="react-dom-server">${ | ||
ReactDomServer.version ?? 'no version export found' | ||
}</code> | ||
</p> | ||
`, | ||
}, | ||
parameters: { | ||
docs: { | ||
name: 'ResolvedReact', | ||
}, | ||
}, | ||
}; | ||
|
||
export const Story = { | ||
// This test is more or less the same as the E2E test we have for MDX and autodocs entries in addon-docs.spec.ts | ||
play: async ({ canvasElement, step, parameters }: any) => { | ||
const canvas = await within(canvasElement); | ||
|
||
const actualReactVersion = (await canvas.findByTestId('react')).textContent; | ||
const actualReactDomVersion = (await canvas.findByTestId('react-dom')).textContent; | ||
const actualReactDomServerVersion = (await canvas.findByTestId('react-dom-server')).textContent; | ||
|
||
step('Expect React packages to all resolve to the same version', () => { | ||
// react-dom has a bug in its production build, reporting version 18.2.0-next-9e3b772b8-20220608 even though version 18.2.0 is installed. | ||
expect(actualReactDomVersion!.startsWith(actualReactVersion!)).toBeTruthy(); | ||
|
||
if (parameters.renderer === 'preact') { | ||
// the preact/compat alias doesn't have a version export in react-dom/server | ||
return; | ||
} | ||
expect(actualReactDomServerVersion).toBe(actualReactVersion); | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.