1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/.storybook/main.js
legobeat 8675c7863e
devDeps: storybook@7 (#19092)
* devDeps: pin @babel/core and @babel/runtime in resulotions
    Without this: misses patch, lavamoat error


* storybook 6 to 7 migration
* devDeps: add @storybook/addon-mdx-gfm
* fix lint deps
* devDeps: remove unused require-from-string
* devDeps/resolutions: @types/react@^16.9.53
* devDeps: add @storybook/cli
* storybook: new-frameworks migration
* iyarc: remove resolved dependency advisory
* deps: set globalthis@1.0.1 in resolutions
   This is required since a file is copied over from a set path in the dist
   package subdirectory as of d13aabde23 (#10014).
   A future update should either vendor the shim, or update to
   compatibility with a maintained upstream version.

* mdx2 migration fixes
* chore: bump ljharb packages
* devDeps: @storybook/*@^7.0.10->^7.0.11
* storybook: update preview.js to use v7 addon api
* ci/test/storybook: echo between storybook build&test
* ci/circleci: resources tweak
* info-tab: handle undefined global.platform
* update lavamoat build policy
* update lavamoat browserify policies
2023-05-18 11:07:42 +09:00

89 lines
2.6 KiB
JavaScript

const path = require('path');
const {
ProvidePlugin
} = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const {
generateIconNames
} = require('../development/generate-icon-names');
module.exports = {
core: {
disableTelemetry: true
},
features: {
buildStoriesJson: true
},
stories: ['../ui/**/*.stories.js', '../ui/**/*.stories.tsx', '../ui/**/*.stories.mdx', './*.stories.mdx'],
addons: ['@storybook/addon-essentials', '@storybook/addon-actions', '@storybook/addon-a11y', '@storybook/addon-knobs', './i18n-party-addon/register.js', 'storybook-dark-mode', '@whitespace/storybook-addon-html', '@storybook/addon-mdx-gfm'],
staticDirs: ['../app', './images'],
// Uses babel.config.js settings and prevents "Missing class properties transform" error
babel: async options => ({
overrides: options.overrides
}),
// Sets env variables https://storybook.js.org/docs/react/configure/environment-variables/
env: async config => {
return {
...config,
// Creates the icon names environment variable for the component-library/icon/icon.js component
ICON_NAMES: generateIconNames()
};
},
webpackFinal: async config => {
config.context = process.cwd();
config.node = {
__filename: true
};
config.resolve.alias['webextension-polyfill'] = require.resolve('../ui/__mocks__/webextension-polyfill.js');
config.resolve.fallback = {
child_process: false,
constants: false,
crypto: false,
fs: false,
http: false,
https: false,
os: false,
path: false,
stream: require.resolve('stream-browserify'),
zlib: false,
_stream_transform: require.resolve('readable-stream/lib/_stream_transform.js'),
};
config.module.strictExportPresence = true;
config.module.rules.push({
test: /\.scss$/,
use: ['style-loader', {
loader: 'css-loader',
options: {
import: false,
url: false
}
}, {
loader: 'sass-loader',
options: {
sourceMap: true,
implementation: require('sass'),
sassOptions: {
includePaths: ['ui/css/']
}
}
}]
});
config.plugins.push(new CopyWebpackPlugin({
patterns: [{
from: path.join('node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
to: path.join('fonts', 'fontawesome')
}]
}));
config.plugins.push(new ProvidePlugin({
Buffer: ['buffer', 'Buffer']
}));
return config;
},
docs: {
autodocs: true
},
framework: {
name: '@storybook/react-webpack5',
options: {}
}
};