Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update storybook and stories #2007

Merged
merged 38 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2f9ed53
chore(deps): update storybook/x
SgtPooki Jul 21, 2022
f637913
chore: migrate addons to .storybook/main.js
SgtPooki Jul 21, 2022
6ecf70c
chore: migrate storybook config to .storybook/main.js
SgtPooki Jul 21, 2022
d9029f3
chore(deps): fix storybook postCSS
SgtPooki Jul 21, 2022
983b328
chore(deps): migrate static-dir flag to main.js
SgtPooki Jul 21, 2022
a3935fd
chore: ignore storybook-static/
SgtPooki Jul 21, 2022
263abda
chore(deps): use storybook-CRA dep
SgtPooki Jul 21, 2022
5acfcba
chore(deps): use webpack5 with storybook
SgtPooki Jul 21, 2022
9ec9fee
fix: storybook webpack errors
SgtPooki Jul 21, 2022
17e972a
fix: npm run storybook succeeds
SgtPooki Jul 21, 2022
f97d322
fix: Support CSFv3 storybook components
SgtPooki Jul 21, 2022
6c92c79
chore: update Cid.stories.js
SgtPooki Jul 21, 2022
c220df4
fix: default storybook argTypes
SgtPooki Jul 22, 2022
9767c2d
chore: update JsonEditor.stories.js
SgtPooki Jul 22, 2022
29619cb
chore: update AddFilesInfo.stories.js
SgtPooki Jul 22, 2022
ecca78e
fix: Cid.stories.js
SgtPooki Jul 22, 2022
667a03b
chore: update info-boxes/**/*.stories.js
SgtPooki Jul 22, 2022
f92709d
update: breadcrumbs.stories.js
SgtPooki Jul 22, 2022
f748938
chore: run storiesOf migration script
SgtPooki Jul 24, 2022
c7aae28
chore: add jsdoc for story exports
SgtPooki Jul 24, 2022
545db02
chore: update eslint rules
SgtPooki Aug 16, 2022
64ca489
feat: Migrate FilesList.stories
SgtPooki Aug 16, 2022
8d97e49
chore: update .storybook/main.js
SgtPooki Aug 16, 2022
6bac680
fix: mark PinningModal file prop as required
SgtPooki Aug 17, 2022
379ef5a
feat: Finish migrating PinningModal story
SgtPooki Aug 17, 2022
3777780
fix: remove countly.init error for storybook
SgtPooki Aug 17, 2022
6253e09
feat: Migrate remaining storybook stories
SgtPooki Aug 17, 2022
effd977
Merge remote-tracking branch 'origin/main' into 1982-chore-update-sto…
SgtPooki Aug 17, 2022
d02bce0
fix: npm install and build
SgtPooki Aug 17, 2022
3112583
fix: eslint should pass CI
SgtPooki Aug 17, 2022
a11d2b5
chore: fix typecheck failures
SgtPooki Aug 18, 2022
bc17589
fix: run @storybook/cli migrate storiesof-to-csf
SgtPooki Aug 26, 2022
2613bef
fix: run eslint --fix
SgtPooki Aug 26, 2022
1e0cb61
fix: build-storybook warnings & errors
SgtPooki Aug 26, 2022
5016126
fix: PublishModal.stories.js renders properly
SgtPooki Aug 26, 2022
51594cf
feat: add test-storybook to CI
SgtPooki Aug 29, 2022
2f7a3d5
Merge branch 'main' into 1982-chore-update-storybook
SgtPooki Aug 29, 2022
efc9bb1
chore: add test-storybook.yml
SgtPooki Aug 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.storybook
16 changes: 14 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ module.exports = {
}
},
extends: ['react-app', 'standard', 'plugin:jsx-a11y/recommended'],
plugins: ['jsx-a11y'],
plugins: ['jsx-a11y', 'storybook'],
// ignore .ts files because it fails to parse it.
ignorePatterns: 'src/**/*.ts'
ignorePatterns: 'src/**/*.ts',
rules: {
'react/prop-types': [0, { ignore: ['className'], customValidators: [], skipUndeclared: true }] // TODO: set this rule to error when all issues are resolved.
},
overrides: [
{
files: ['src/**/*.stories.js'],
excludedFiles: '*.test.js',
rules: {
'import/no-anonymous-default-export': 'off'
}
}
]
}
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ jobs:
needs: build
uses: ./.github/workflows/test-e2e.yml

test-storybook:
name: 'test:e2e'
uses: ./.github/workflows/test-storybook.yml

# separate check for TS
typecheck:
name: typecheck
Expand All @@ -171,7 +175,7 @@ jobs:
release:
name: 'Run semantic release'
runs-on: ubuntu-latest
needs: [build, publishPreview, eslint, typecheck, test-e2e, test-unit]
needs: [build, publishPreview, eslint, typecheck, test-e2e, test-unit, test-storybook]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/test-storybook.yml
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/playwright-report
test/e2e/setup/ipfs-backend.json
test/e2e/state.json
storybook-static

# production
/build
Expand Down
4 changes: 0 additions & 4 deletions .storybook/addons.js

This file was deleted.

12 changes: 0 additions & 12 deletions .storybook/config.js

This file was deleted.

58 changes: 58 additions & 0 deletions .storybook/main.js
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
40 changes: 40 additions & 0 deletions .storybook/preview.js
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
Loading