Skip to content

Commit

Permalink
chore(dev-deps): bump storybook to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
100terres committed Mar 24, 2024
1 parent b8b1457 commit f57439e
Show file tree
Hide file tree
Showing 42 changed files with 2,130 additions and 5,806 deletions.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
- restore_cache:
keys:
# Restore cached node_modules
- v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
- v18-dependencies-{{ checksum "pnpm-lock.yaml" }}
# fallback to using the latest cache if no exact match is found
- v17-dependencies-
- v18-dependencies-

- run:
name: Install Dependencies
Expand All @@ -42,7 +42,7 @@ jobs:
paths:
- .pnpm-store
- node_modules
key: v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
key: v18-dependencies-{{ checksum "pnpm-lock.yaml" }}

validate:
docker:
Expand All @@ -54,7 +54,7 @@ jobs:

- restore_cache:
keys:
- v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
- v18-dependencies-{{ checksum "pnpm-lock.yaml" }}

- run:
name: Lint + Typecheck
Expand All @@ -74,7 +74,7 @@ jobs:

- restore_cache:
keys:
- v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
- v18-dependencies-{{ checksum "pnpm-lock.yaml" }}

- run:
name: Jest Suite
Expand All @@ -96,7 +96,7 @@ jobs:

- restore_cache:
keys:
- v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
- v18-dependencies-{{ checksum "pnpm-lock.yaml" }}

- run:
name: Check Bundle Size
Expand All @@ -112,7 +112,7 @@ jobs:

- restore_cache:
keys:
- v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
- v18-dependencies-{{ checksum "pnpm-lock.yaml" }}

- run:
name: Build asset
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:

- restore_cache:
keys:
- v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
- v18-dependencies-{{ checksum "pnpm-lock.yaml" }}

- run:
name: 'Run cypress'
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:

- restore_cache:
keys:
- v17-dependencies-{{ checksum "pnpm-lock.yaml" }}
- v18-dependencies-{{ checksum "pnpm-lock.yaml" }}

- run:
name: Accessibility Audit
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['airbnb', 'prettier', 'plugin:prettier/recommended'],
plugins: ['prettier', '@emotion', 'react', 'react-hooks', 'import', 'es5'],
plugins: ['prettier', 'react', 'react-hooks', 'import', 'es5'],
parser: '@babel/eslint-parser',
env: {
es6: true,
Expand Down
1 change: 0 additions & 1 deletion .storybook/compressed-logo-rfd.svg

This file was deleted.

8 changes: 8 additions & 0 deletions .storybook/environment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
interface ProcessEnv {
DISABLE_HMR?: 'true' | 'false' | undefined;
USE_PRODUCTION_BUILD?: 'true' | 'false' | undefined;
}

interface Process {
env: ProcessEnv;
}
37 changes: 0 additions & 37 deletions .storybook/main.js

This file was deleted.

73 changes: 73 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type { Options } from '@swc/core';
import type { StorybookConfig } from '@storybook/react-webpack5';
import { resolve } from 'path';
import { config as dotenvConfig } from 'dotenv';

dotenvConfig();

const storybookConfig: StorybookConfig = {
typescript: {
check: true,
checkOptions: {
typescript: {
configFile: './stories/tsconfig.json',
},
},
},
addons: [
'@storybook/addon-essentials',
'@storybook/addon-storysource',
'@storybook/addon-webpack5-compiler-swc',
],

core: {
disableTelemetry: true,
},

stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],

webpackFinal: async (config) => {
// We need to disable the hot module reloading when we run the lighthouse audit,
// because it wait for the load to finish, but the /__webpack_hmr query never ends.
// https://github.com/storybookjs/storybook/issues/3062#issuecomment-504550789
if (process.env.DISABLE_HMR === 'true') {
config.entry = (config.entry as string[]).filter(
(singleEntry) => !singleEntry.includes('/webpack-hot-middleware/'),
);
}

return config;
},

framework: {
name: '@storybook/react-webpack5',

options: {
// FIXME: The way we generate data isn't working properly with StrictMode
strictMode: false,
},
},

docs: {
autodocs: false,
},

swc: (config: Options): Options => {
return {
...config,
jsc: {
...(config?.jsc || {}),
baseUrl: resolve(__dirname),
paths: {
'@hello-pangea/dnd': [
process.env.USE_PRODUCTION_BUILD === 'true'
? resolve(__dirname, '../dist/dnd.esm')
: resolve(__dirname, '../src/index.ts'),
],
},
},
};
},
};

export default storybookConfig;
2 changes: 1 addition & 1 deletion .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addons } from '@storybook/addons';
import { addons } from '@storybook/manager-api';
import theme from './storybook-theme';

addons.setConfig({
Expand Down
35 changes: 21 additions & 14 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
import '@atlaskit/css-reset';

import { DecoratorFn } from '@storybook/react';
import { Preview } from '@storybook/react';
import React from 'react';
import { resetData } from '../stories/src/data';
import GlobalStyles from './custom-decorators/global-styles';
import welcomeMessage from './welcome-message';

welcomeMessage();

export const decorators: DecoratorFn[] = [
(story, { id }: { id: string }) => {
resetData(id);
const preview: Preview = {
decorators: [
(Story, { id }) => {
resetData(id);

return story({ key: id });
},
(story) => <GlobalStyles>{story()}</GlobalStyles>,
];

export const parameters = {
layout: 'fullscreen',
return <Story key={id} />;
},
(Story) => (
<GlobalStyles>
<Story />
</GlobalStyles>
),
],
parameters: {
layout: 'fullscreen',

options: {
storySort: {
order: ['Welcome', 'Examples'],
options: {
storySort: {
order: ['Welcome', 'Examples'],
},
},
},
};

export default preview;
12 changes: 6 additions & 6 deletions .storybook/storybook-theme.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { create } from '@storybook/theming';
import logo from './compressed-logo-rfd.svg';
import { create } from '@storybook/theming/create';

const brandTitle = `
<span
style="display:flex;align-items:center"
title="@hello-pangea/dnd"
>
<img
<div
alt="Logo of @hello-pangea/dnd"
src="${logo}"
style="display:block;width:auto;height:42px;max-width:100%"
/>
style="display:block;width:65px;height:42px"
>
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 331 226" fill="#0BAF7C"><path d="M217.1 171.2L38.5 171V187.5L228.4 187.7L217.1 171.2Z"/><path d="M288.3 118.5L288.4 30.5H270.6L270.5 117.7C280.6 109.5 285.8 114 288.3 118.5Z"/><path d="M109.381 85.5692C112.235 82.7212 112.239 78.0992 109.391 75.2455C106.543 72.3919 101.921 72.3873 99.0676 75.2353C96.214 78.0833 96.2094 82.7053 99.0574 85.559C101.905 88.4126 106.527 88.4172 109.381 85.5692Z"/><path d="M125.9 91.1C125.9 102.5 135.6 111.8 147.2 110.9C157.6 110.1 165.5 101.2 165.5 90.7V89.4H125.8L125.9 91.1V91.1Z"/><path d="M314.4 133.3V131.2C314.4 123.5 308.2 117.3 300.5 117.3C298 117.3 295.7 118 293.7 119.1C293 117.3 291.9 115.6 290.5 114.2C287.8 111.6 284.3 110.1 280.6 110.1C278.5 110.1 276.4 110.6 274.5 111.5L274.6 12.7L16.8 12.4L16.6 176.3L214.5 176.5C216.5 180.1 218.8 183.9 220.4 185.7L246.2 211.6H293.4L294.6 210.1C294.9 209.7 303.1 199.5 309.2 186.8C312.6 179.7 314.4 171.7 314.4 163.7V133.3V133.3ZM24.6 168.3L24.7 20.4L266.5 20.6L266.4 111.6C264.5 110.6 262.3 110.1 260 110.1C254.1 110.1 249.1 113.9 247.1 119.1C245.1 118 242.9 117.4 240.5 117.4C236.8 117.4 233.4 118.9 230.8 121.5C228.2 124.1 226.8 127.6 226.8 131.3V138.5C224.9 137.4 222.6 136.8 220.2 136.8C218.1 136.8 216.2 137.6 214.7 139.2C210.4 143.7 210.4 153.5 210.8 164.2C210.9 165.7 210.9 167 210.9 168C210.9 168.2 210.9 168.4 211 168.6L24.6 168.3V168.3ZM302 183.3C297.6 192.4 292 200.4 289.6 203.5H249.6L226.5 180.3C223.6 176.9 219.9 169.3 219 167.1C219 166.1 218.9 165 218.9 163.7C218.5 152.6 219 146.2 220.5 144.7C222 144.7 223.1 145.2 224 146.1C226.2 148.4 226.8 152.9 226.9 155.3V157.5H234.9V156.6V155.2V131.1C234.9 129.5 235.5 128 236.6 126.9C237.7 125.8 239.1 125.2 240.6 125.2C243.8 125.2 246.3 127.9 246.3 131.1V147H254.3V132.8V123.9C254.3 120.6 256.9 118 260.2 118C261.8 118 263.3 118.6 264.4 119.7C265.5 120.8 266.1 122.3 266.2 123.9L266.3 139.8H266.5H274.5V132.2V123.9C274.5 122.3 275.1 120.9 276.3 119.7C277.5 118.6 279 117.9 280.6 117.9C282.2 117.9 283.8 118.5 284.9 119.7C286 120.8 286.7 122.3 286.7 123.9V130.6V131.1V147H294.7V139.9V130.7C295 127.7 297.5 125.3 300.6 125.3C303.9 125.3 306.5 128 306.5 131.2V147V163.7C306.4 170.5 304.8 177.3 302 183.3V183.3Z"/><path d="M253.914 154.828L246.028 156.17L251.293 187.124L259.18 185.782L253.914 154.828Z"/><path d="M287.013 154.667L281.719 185.618L289.604 186.966L294.898 156.015L287.013 154.667Z"/><path d="M274.4 151.4H266.4V183.4H274.4V151.4Z"/><path d="M191.925 85.5885C194.779 82.7406 194.784 78.1185 191.936 75.2649C189.088 72.4113 184.466 72.4067 181.612 75.2547C178.758 78.1026 178.754 82.7247 181.602 85.5783C184.45 88.4319 189.072 88.4365 191.925 85.5885Z"/></svg>
</div>
<span style="margin-left:8px;color:#0BAF7C;font-family:monospace;font-size:26px">
rfd
</span>
Expand Down
23 changes: 19 additions & 4 deletions browser-test-harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,34 @@ const waitOn = require('wait-on');
const ports = require('./server-ports');

const storybook = childProcess.spawn(process.execPath, [
path.join('node_modules', 'cross-env', 'src', 'bin', 'cross-env-shell.js'),
path.resolve(
__dirname,
'node_modules',
'cross-env',
'src',
'bin',
'cross-env-shell.js',
),
'DISABLE_HMR=true',
'USE_PRODUCTION_BUILD=true',
path.join('node_modules', '.bin', 'start-storybook'),
path.resolve(__dirname, 'node_modules', '.bin', 'storybook'),
'dev',
'--ci',
'-p',
`${ports.storybook}`,
]);

const cspServer = childProcess.spawn(process.execPath, [
path.join('node_modules', 'cross-env', 'src', 'bin', 'cross-env-shell.js'),
path.resolve(
__dirname,
'node_modules',
'cross-env',
'src',
'bin',
'cross-env-shell.js',
),
'USE_PRODUCTION_BUILD=true',
path.join('csp-server', 'start.sh'),
path.resolve(__dirname, 'csp-server', 'start.sh'),
`${ports.cspServer}`,
]);

Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/reorder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('reorder', () => {
it('should reorder within a list', () => {
// order: 1, 2
cy.get(getHandleSelector()).eq(0).as('first').should('contain', 'id:G1');
cy.get(getHandleSelector()).eq(1).should('contain', 'id:G2');
cy.get(getHandleSelector()).eq(1).as('second').should('contain', 'id:G2');

// reorder operation
cy.get('@first')
Expand All @@ -28,9 +28,9 @@ describe('reorder', () => {

// order now 2, 1
// note: not using get aliases as they where returning incorrect results
cy.get(getHandleSelector()).eq(0).should('contain', 'id:G2');
cy.get('@first').should('contain', 'id:G2');

cy.get(getHandleSelector()).eq(1).should('contain', 'id:G1');
cy.get('@second').should('contain', 'id:G1');

// element should maintain focus post drag
cy.focused().should('contain', 'id:G1');
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"build": "pnpm build:clean && pnpm build:dist",
"build:clean": "rimraf dist",
"build:dist": "cross-env NODE_ENV=production rollup -c",
"storybook": "start-storybook -p 9002",
"build-storybook": "build-storybook -c .storybook -o site",
"storybook": "storybook dev -p 9002",
"build-storybook": "storybook build -c .storybook -o site",
"prepublishOnly": "pnpm build"
},
"dependencies": {
Expand Down Expand Up @@ -99,7 +99,6 @@
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@commitlint/cz-commitlint": "19.2.0",
"@emotion/babel-preset-css-prop": "11.11.0",
"@emotion/eslint-plugin": "11.11.0",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.0",
Expand All @@ -112,15 +111,15 @@
"@rollup/plugin-replace": "5.0.5",
"@rollup/plugin-strip": "3.0.4",
"@rollup/plugin-terser": "0.4.4",
"@storybook/addon-docs": "6.5.16",
"@storybook/addon-essentials": "6.5.16",
"@storybook/addon-storysource": "6.5.16",
"@storybook/addons": "6.5.16",
"@storybook/builder-webpack5": "6.5.16",
"@storybook/core": "6.5.16",
"@storybook/manager-webpack5": "6.5.16",
"@storybook/react": "6.5.16",
"@storybook/theming": "6.5.16",
"@storybook/addon-docs": "8.0.4",
"@storybook/addon-essentials": "8.0.4",
"@storybook/addon-storysource": "8.0.4",
"@storybook/addon-webpack5-compiler-swc": "1.0.2",
"@storybook/manager-api": "8.0.4",
"@storybook/react": "8.0.4",
"@storybook/react-webpack5": "8.0.4",
"@storybook/theming": "8.0.4",
"@swc/core": "1.4.8",
"@testing-library/dom": "9.3.4",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.2.2",
Expand Down Expand Up @@ -194,6 +193,7 @@
"rollup": "4.13.0",
"rollup-plugin-dts": "6.1.0",
"seedrandom": "3.0.5",
"storybook": "8.0.4",
"styled-components": "6.1.8",
"stylelint": "16.2.1",
"stylelint-config-recommended": "14.0.0",
Expand Down
Loading

0 comments on commit f57439e

Please sign in to comment.