Skip to content

Commit

Permalink
chore(dependencies): switched to safest newest dependencies (nodejs#2610
Browse files Browse the repository at this point in the history
)

chore(react): upgrade to react 18 and forced compatibility

fix(jest): fix jest reading cache folder

chore(tests): updated tests for dark theme

chore(snapshots): updated snapshots

chore(storybook): remove deprecated parts and removed unnecessary override
  • Loading branch information
ovflowd authored Aug 5, 2022
1 parent 1531ca3 commit b5ce031
Show file tree
Hide file tree
Showing 37 changed files with 39,248 additions and 46,419 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module.exports = {
extends: ['airbnb', 'plugin:prettier/recommended'],
extends: [
'airbnb',
'plugin:prettier/recommended',
'plugin:storybook/recommended',
],
env: {
browser: true,
node: true,
Expand Down
2 changes: 0 additions & 2 deletions .storybook/addons.js

This file was deleted.

32 changes: 24 additions & 8 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
// some config came from https://dev.to/romansorin/integrating-gatsby-tailwind-and-storybook-2cbi

module.exports = {
stories: ['../stories/**/*.stories.js', '../stories/**/*.stories.tsx'],
addons: ['@storybook/addon-actions', '@storybook/addon-links'],
core: {
builder: 'webpack5',
framework: {
name: '@storybook/react-webpack5',
options: { fastRefresh: true },
},
core: { builder: 'webpack5' },
// Some of this configuration was taken from https://www.gatsbyjs.com/docs/how-to/testing/visual-testing-with-storybook/
webpackFinal: async config => {
// Use babel-plugin-remove-graphql-queries to remove static queries from components when rendering in storybook
config.module.rules[2].use[0].options.plugins.push(
require.resolve('babel-plugin-remove-graphql-queries')
);

// Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
config.module.rules[0].exclude = [/node_modules\/(?!(gatsby)\/)/];
config.module.rules[2].exclude = [/node_modules\/(?!(gatsby)\/)/];

// use installed babel-loader which is v8.0-beta (which is meant to work with @babel/core@7)
config.module.rules[0].use[0].loader = require.resolve('babel-loader');
config.module.rules[2].use[0].loader = require.resolve('babel-loader');

// use @babel/preset-react for JSX and env (instead of staged presets)
config.module.rules[0].use[0].options.presets = [
config.module.rules[2].use[0].options.presets = [
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-env'),
];
config.module.rules[0].use[0].options.plugins = [

config.module.rules[2].use[0].options.plugins = [
// use @babel/plugin-proposal-class-properties for class arrow functions
require.resolve('@babel/plugin-proposal-class-properties'),
require.resolve('@babel/plugin-proposal-private-methods'),
Expand All @@ -30,8 +39,10 @@ module.exports = {
},
],
];

// Prefer Gatsby ES6 entrypoint (module) over commonjs (main) entrypoint
config.resolve.mainFields = ['browser', 'module', 'main'];

config.module.rules.push(
{
test: /\.(ts|tsx)$/,
Expand Down Expand Up @@ -69,18 +80,23 @@ module.exports = {
],
}
);

config.resolve.extensions.push('.ts', '.tsx');

// Use SVGR for SVG files
const fileLoaderRule = config.module.rules.find(rule =>
rule.test.test('.svg')
);

fileLoaderRule.exclude = /\.svg$/;

config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack', 'url-loader'],
});

config.performance.hints = false;

return config;
},
};
1 change: 0 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ global.__BASE_PATH__ = '';

// Navigating through a gatsby app using gatsby-link or any other gatsby component will use the `___navigate` method.
// In Storybook it makes more sense to log an action than doing an actual navigate. Checkout the actions addon docs for more info: https://github.com/storybookjs/storybook/tree/master/addons/actions.

window.___navigate = pathname => {
action('NavigateTo:')(pathname);
};
3 changes: 1 addition & 2 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ module.exports = {
},
plugins: [
'gatsby-plugin-catch-links',
'gatsby-plugin-dark-mode',
'@skagami/gatsby-plugin-dark-mode',
'gatsby-transformer-yaml',
'gatsby-plugin-react-helmet',
`gatsby-remark-images`,
{
resolve: 'gatsby-plugin-canonical-urls',
Expand Down
Loading

0 comments on commit b5ce031

Please sign in to comment.