1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Update to @storybook/*@6 (#9956)

Our Storybook dependencies have been updated to v6.1.9, from v5. This
was done to address a security vulnerability in a transitive dependency
of these packages (`highlight.js`).

The primary changes required by this Storybook update were the change
in import path for the `withKnobs` hook, the change in background
config format, and the webpack configuration. Storybook seems to work
correctly.

The migration was guided by the Storybook changelog[1] and the
Storybook v6 migration guide[2].

There is one Storybook error remaining; it fails to load the Euclid
font. This is a pre-existing error though, so we can fix it in a later
PR.

The `yarn.lock` file was deduplicated in this PR as well, as it was
required to fix various install warnings that were introduced with this
update.

[1]: https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md
[2]: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md
This commit is contained in:
Mark Stacey 2020-11-30 16:40:46 -03:30 committed by GitHub
parent 6a9c15d4a4
commit 429847a686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 2269 additions and 2158 deletions

View File

@ -1,3 +1,7 @@
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
stories: ['../ui/app/**/*.stories.js'],
addons: [
@ -5,4 +9,36 @@ module.exports = {
'@storybook/addon-actions',
'@storybook/addon-backgrounds'
],
webpackFinal: async (config) => {
config.module.strictExportPresence = true
config.module.rules.push({
test: /\.scss$/,
loaders: [
'style-loader',
{
loader: 'css-loader',
options: {
import: false,
url: false,
},
},
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
],
})
config.plugins.push(new CopyWebpackPlugin({
patterns: [
{
from: path.join('node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
to: path.join('fonts', 'fontawesome'),
},
],
}))
return config
},
}

View File

@ -1,6 +1,6 @@
import React from 'react'
import { addDecorator, addParameters } from '@storybook/react'
import { withKnobs } from '@storybook/addon-knobs/react'
import { withKnobs } from '@storybook/addon-knobs'
import { I18nProvider, LegacyI18nProvider } from '../ui/app/contexts/i18n'
import { Provider } from 'react-redux'
import configureStore from '../ui/app/store/store'
@ -8,10 +8,13 @@ import '../ui/app/css/index.scss'
import en from '../app/_locales/en/messages'
addParameters({
backgrounds: [
{ name: 'light', value: '#FFFFFF'},
{ name: 'dark', value: '#333333' },
],
backgrounds: {
default: 'light',
values: [
{ name: 'light', value: '#FFFFFF'},
{ name: 'dark', value: '#333333' },
],
}
})
const styles = {

View File

@ -1,41 +0,0 @@
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
module: {
strictExportPresence: true,
rules: [
{
test: /\.scss$/,
loaders: [
'style-loader',
{
loader: 'css-loader',
options: {
import: false,
url: false,
},
},
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
],
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: path.join('node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
to: path.join('fonts', 'fontawesome'),
},
],
}),
],
}

View File

@ -192,11 +192,11 @@
"@metamask/forwarder": "^1.1.0",
"@metamask/test-dapp": "^4.0.1",
"@sentry/cli": "^1.58.0",
"@storybook/addon-actions": "^5.3.14",
"@storybook/addon-backgrounds": "^5.3.14",
"@storybook/addon-knobs": "^5.3.14",
"@storybook/core": "^5.3.14",
"@storybook/react": "^5.3.14",
"@storybook/addon-actions": "^6.1.9",
"@storybook/addon-backgrounds": "^6.1.9",
"@storybook/addon-knobs": "^6.1.9",
"@storybook/core": "^6.1.9",
"@storybook/react": "^6.1.9",
"@storybook/storybook-deployer": "^2.8.6",
"@testing-library/react": "^10.4.8",
"@testing-library/react-hooks": "^3.2.1",

View File

@ -1,7 +1,7 @@
import React from 'react'
import { action } from '@storybook/addon-actions'
import classnames from 'classnames'
import { text, boolean } from '@storybook/addon-knobs/react'
import { text, boolean } from '@storybook/addon-knobs'
import Button from '../button'
import ButtonGroup from '.'

View File

@ -1,6 +1,6 @@
import React from 'react'
import { action } from '@storybook/addon-actions'
import { text, boolean } from '@storybook/addon-knobs/react'
import { text, boolean } from '@storybook/addon-knobs'
import Button from '.'
export default {

View File

@ -1,6 +1,6 @@
import React from 'react'
import { action } from '@storybook/addon-actions'
import { boolean, select, text } from '@storybook/addon-knobs/react'
import { boolean, select, text } from '@storybook/addon-knobs'
import CheckBox, {
CHECKED,
INDETERMINATE,

View File

@ -1,6 +1,6 @@
import React from 'react'
import { action } from '@storybook/addon-actions'
import { boolean, select, text } from '@storybook/addon-knobs/react'
import { boolean, select, text } from '@storybook/addon-knobs'
import Dropdown from '.'
export default {

View File

@ -1,5 +1,5 @@
import React from 'react'
import { color, number } from '@storybook/addon-knobs/react'
import { color, number } from '@storybook/addon-knobs'
import Approve from './approve-icon.component'
import Copy from './copy-icon.component'
import Interaction from './interaction-icon.component'

View File

@ -1,6 +1,5 @@
import React from 'react'
import { text, boolean } from '@storybook/addon-knobs/react'
import { number } from '@storybook/addon-knobs'
import { text, boolean, number } from '@storybook/addon-knobs'
import Identicon from './identicon.component'
export default { title: 'Identicon' }

View File

@ -1,5 +1,5 @@
import React from 'react'
import { text } from '@storybook/addon-knobs/react'
import { text } from '@storybook/addon-knobs'
import InfoTooltip from './info-tooltip'
export default {

View File

@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import { text } from '@storybook/addon-knobs/react'
import { text } from '@storybook/addon-knobs'
import Send from '../icon/send-icon.component'
import Interaction from '../icon/interaction-icon.component'
import Approve from '../icon/approve-icon.component'

View File

@ -1,5 +1,5 @@
import React from 'react'
import { text } from '@storybook/addon-knobs/react'
import { text } from '@storybook/addon-knobs'
import { action } from '@storybook/addon-actions'
import Popover from './popover.component'

View File

@ -1,5 +1,5 @@
import React from 'react'
import { text } from '@storybook/addon-knobs/react'
import { text } from '@storybook/addon-knobs'
import Tab from './tab/tab.component'
import Tabs from './tabs.component'

View File

@ -1,6 +1,6 @@
import React from 'react'
import { action } from '@storybook/addon-actions'
import { text } from '@storybook/addon-knobs/react'
import { text } from '@storybook/addon-knobs'
import ActionableMessage from '.'
export default {

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { action } from '@storybook/addon-actions'
import { boolean } from '@storybook/addon-knobs/react'
import { boolean } from '@storybook/addon-knobs'
import DropdownInputPair from '../dropdown-input-pair'
import DropdownSearchList from '../dropdown-search-list'

View File

@ -1,5 +1,5 @@
import React from 'react'
import { number } from '@storybook/addon-knobs/react'
import { number } from '@storybook/addon-knobs'
import CountdownTimer from './countdown-timer'
export default {

View File

@ -1,5 +1,5 @@
import React from 'react'
import { text, number } from '@storybook/addon-knobs/react'
import { text, number } from '@storybook/addon-knobs'
import ExchangeRateDisplay from './exchange-rate-display'
export default {

View File

@ -1,6 +1,6 @@
import React from 'react'
import { action } from '@storybook/addon-actions'
import { text } from '@storybook/addon-knobs/react'
import { text } from '@storybook/addon-knobs'
import FeeCard from './fee-card'
const tokenApprovalTextComponent = (

View File

@ -1,5 +1,5 @@
import React from 'react'
import { text, number, boolean } from '@storybook/addon-knobs/react'
import { text, number, boolean } from '@storybook/addon-knobs'
import MainQuoteSummary from './main-quote-summary'
export default {

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { action } from '@storybook/addon-actions'
import { object } from '@storybook/addon-knobs/react'
import { object } from '@storybook/addon-knobs'
import Button from '../../../components/ui/button'
import mockQuoteData from './mock-quote-data'
import SelectQuotePopover from '.'

4292
yarn.lock

File diff suppressed because it is too large Load Diff