-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update storybook and stories (#2007)
* chore(deps): update storybook/x * chore: migrate addons to .storybook/main.js * chore: migrate storybook config to .storybook/main.js * chore(deps): fix storybook postCSS * chore(deps): migrate static-dir flag to main.js @see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated---static-dir-cli-flag * chore: ignore storybook-static/ * chore(deps): use storybook-CRA dep This addresses the following warning when running `npm run storybook`: WARN Storybook support for Create React App is now a separate preset. WARN To use the new preset, install `@storybook/preset-create-react-app` and add it to the list of `addons` in your `.storybook/main.js` config file. WARN The built-in preset has been disabled in Storybook 6.0. * chore(deps): use webpack5 with storybook @see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5 * fix: storybook webpack errors Resolves the following error: Error: NormalModuleFactory.beforeResolve (IgnorePlugin) is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created. * fix: npm run storybook succeeds but displays error in built website * fix: Support CSFv3 storybook components @see https://storybook.js.org/docs/react/api/csf * chore: update Cid.stories.js * fix: default storybook argTypes * chore: update JsonEditor.stories.js * chore: update AddFilesInfo.stories.js * fix: Cid.stories.js * chore: update info-boxes/**/*.stories.js * update: breadcrumbs.stories.js * chore: run storiesOf migration script * Ran `git ls-files | grep 'stories.js' | xargs -n1 -- npx --yes sb migrate storiesof-to-csf --glob` * Normalized default stories exports * Added jsdoc comment for default exports * export default as object literal * chore: add jsdoc for story exports * chore: update eslint rules * disable default export rule for stories * enable react/prop-types validation warning * feat: Migrate FilesList.stories * chore: update .storybook/main.js * fix: mark PinningModal file prop as required * feat: Finish migrating PinningModal story * fix: remove countly.init error for storybook * feat: Migrate remaining storybook stories * fix: npm install and build * fix: eslint should pass CI * chore: fix typecheck failures * fix: run @storybook/cli migrate storiesof-to-csf Migrated leftover storiesOf stories with: `npx @storybook/cli migrate storiesof-to-csf -g '**/(Radio|PublishModal).stories.js'` * fix: run eslint --fix * fix: build-storybook warnings & errors * fix: PublishModal.stories.js renders properly * feat: add test-storybook to CI * chore: add test-storybook.yml
- Loading branch information
Showing
53 changed files
with
82,741 additions
and
65,050 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!.storybook |
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,34 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
|
||
test-storybook: | ||
name: 'test:storybook' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.12.0 | ||
- name: Setup npm@8.1.0 | ||
run: | | ||
npm install -g npm@8.1.0 | ||
- name: Cache bigger downloads | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ github.workspace }}/.cache | ||
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }} | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm | ||
|
||
- name: Run test-storybook:ci | ||
run: npm run test-storybook:ci |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
/** | ||
* @file StoryBook configuration file | ||
* @see https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#from-version-52x-to-53x | ||
*/ | ||
|
||
const webpack = require('webpack') | ||
|
||
const webpackOverride = require('../config-overrides') | ||
|
||
/** @type {import('@storybook/core-common').StorybookConfig} */ | ||
const storybookConfig = { | ||
core: { | ||
builder: 'webpack5' | ||
}, | ||
reactOptions: { | ||
legacyRootApi: true | ||
}, | ||
stories: [ | ||
'../src/**/*.stories.@(ts|js|tsx|jsx)' | ||
], | ||
framework: '@storybook/react', | ||
addons: [ | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-actions', | ||
'@storybook/addon-links', | ||
'@storybook/addon-a11y', | ||
// '@storybook/addon-knobs', | ||
'@storybook/addon-controls', | ||
// '@storybook/addon-postcss', | ||
'@storybook/preset-create-react-app', | ||
'@storybook/addon-coverage' | ||
], | ||
staticDirs: [ | ||
'../public' | ||
], | ||
features: { | ||
postcss: false, | ||
storyStoreV7: true | ||
}, | ||
webpackFinal: async (config) => { | ||
return webpackOverride({ | ||
...config, | ||
// @see https://github.com/storybookjs/storybook/issues/18276#issuecomment-1137101774 | ||
plugins: config.plugins.map(plugin => { | ||
if (plugin.constructor.name === 'IgnorePlugin') { | ||
return new webpack.IgnorePlugin({ | ||
resourceRegExp: plugin.options.resourceRegExp, | ||
contextRegExp: plugin.options.contextRegExp | ||
}) | ||
} | ||
|
||
return plugin | ||
}) | ||
}) | ||
} | ||
} | ||
|
||
module.exports = storybookConfig |
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,40 @@ | ||
import { Provider } from 'redux-bundler-react' | ||
import { I18nextProvider } from 'react-i18next' | ||
import { DndProvider } from 'react-dnd' | ||
import 'react-virtualized/styles.css' | ||
import '../src/index.css' | ||
|
||
import getStore from '../src/bundles' | ||
import i18n from '../src/i18n' | ||
import DndBackend from '../src/lib/dnd-backend' | ||
|
||
/** | ||
* @type {import('@storybook/addons').BaseAnnotations} | ||
*/ | ||
const baseAnnotations = { | ||
decorators: [ | ||
(Story) => ( | ||
<Provider store={getStore(undefined)}> | ||
<I18nextProvider i18n={i18n} > | ||
<DndProvider backend={DndBackend}> | ||
<Story /> | ||
</DndProvider> | ||
</I18nextProvider> | ||
</Provider> | ||
) | ||
], | ||
/** | ||
* @see https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args | ||
*/ | ||
argTypes: { | ||
onChange: { | ||
action: 'changed' | ||
}, | ||
onClick: { | ||
action: 'clicked' | ||
} | ||
} | ||
} | ||
|
||
export const decorators = baseAnnotations.decorators | ||
export const argTypes = baseAnnotations.argTypes |
Oops, something went wrong.