Skip to content

Commit

Permalink
docs: update to storybook v7 (#3298)
Browse files Browse the repository at this point in the history
* docs: update to storybook v7

* ci: update storybook build command

* docs: fix typescript errors in stories

* chore: update build-storybook custom script

* test(e2e): update root selector for e2e tests

* chore: add storybook/csf dependency

* test: update lockfile test

---------

Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
  • Loading branch information
joshblack and joshblack authored May 23, 2023
1 parent 112fd2c commit ac698b5
Show file tree
Hide file tree
Showing 14 changed files with 23,456 additions and 84,749 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Build storybook
run: npx build-storybook
run: npx storybook build
- name: Install browsers
run: npx playwright install --with-deps
- name: Run storybook
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Build storybook
run: npx build-storybook
run: npx storybook build
- name: Install browsers
run: npx playwright install --with-deps
- name: Run storybook
Expand Down
40 changes: 26 additions & 14 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
{
name: '@storybook/addon-essentials',
options: {
backgrounds: false,
},
},
'@storybook/addon-storysource',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
Expand All @@ -16,26 +21,33 @@ module.exports = {
},
},
{
name: 'storybook-css-modules', // TODO: replace with @storybook/addon-styling for storybook v7
options: {cssModulesLoaderOptions: {modules: {localIdentName: 'prc_[local]-[hash:base64:5]'}}},
},
],
core: {
builder: {
name: 'webpack5',
name: 'storybook-css-modules',
// TODO: replace with @storybook/addon-styling for storybook v7
options: {
fsCache: true,
cssModulesLoaderOptions: {
modules: {
localIdentName: 'prc_[local]-[hash:base64:5]',
},
},
},
},
},
],
features: {
interactionsDebugger: true,
storyStoreV7: true,
buildStoriesJson: true,
},
framework: '@storybook/react',
reactOptions: {
fastRefresh: true,
strictMode: true,
framework: {
name: '@storybook/react-webpack5',
options: {
fastRefresh: true,
strictMode: true,
builder: {
fsCache: true,
},
},
},
docs: {
autodocs: true,
},
}
6 changes: 0 additions & 6 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ Object.entries(PrimerBreakpoints).forEach(([viewport, value]) => {
}
})

addons.setConfig({
// Some stories may set up keyboard event handlers, which can be interfered
// with by these keyboard shortcuts.
enableShortcuts: false,
})

export const parameters = {
actions: {argTypesRegex: '^on[A-Z].*'},
html: {
Expand Down
2 changes: 1 addition & 1 deletion e2e/test-helpers/storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ export async function visit(page: Page, options: Options) {

await page.goto(url.toString())
await page.waitForSelector('body.sb-show-main:not(.sb-show-preparing-story)')
await page.waitForSelector('#root > *')
await page.waitForSelector('#storybook-root > *')
await waitForImages(page)
}
Loading

0 comments on commit ac698b5

Please sign in to comment.