Skip to content

Commit 1187a11

Browse files
Storybook 9 (#14688)
* Storybook 9 * Import path * Fix chai ambient type error * Fix AR storybook error CleanCSS * Remove deprecated addon-essentials and add addon-docs * Add comments * Update * Update pnpm-lock.yaml * Types chai resolution * stop bundling clean-css Move font CSS minification to the server template so Storybook imports only the raw font-face rules, fixing the iframe HTTP_PROXY error * Fix TypeError: Cannot read properties of undefined (reading 'HOSTNAME') Replace direct process.env.HOSTNAME usage with a runtimeHostname() fallback to prevent TypeError in build * Fix TypeError : Cannot read properties of undefined (reading 'HOSTNAME') * Update forceBrazeMessage.ts * Fix undefined error SCR_URL * Fix backgrounds * Fixes and improvements * Fix backgrounds in chromatic * Update preview.ts * Remove localhost fallback
1 parent 0c56b8a commit 1187a11

File tree

161 files changed

+860
-1234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+860
-1234
lines changed

apps-rendering/.storybook/fonts-css.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import CleanCSS from 'clean-css';
2-
31
type FontFamily =
42
| 'GH Guardian Headline'
53
| 'Guardian Egyptian Web' // Legacy of GH Guardian Headline
@@ -278,5 +276,4 @@ const getStyleString: () => string = () => {
278276
);
279277
};
280278

281-
export const getFontsCss = (): string =>
282-
new CleanCSS().minify(getStyleString()).styles;
279+
export const getFontsCss = (): string => getStyleString();

apps-rendering/.storybook/main.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ module.exports = {
1616
// Global options for webpack
1717
config.resolve.extensions?.push('.ts', '.tsx');
1818

19-
config.resolve.fallback ??= {};
20-
// clean-css will try to import these packages
21-
config.resolve.fallback['http'] = false;
22-
config.resolve.fallback['https'] = false;
23-
2419
// Required as otherwise 'process' will not be defined when included on its own (without .env)
2520
// e.g process?.env?.SOME_VAR
2621
config.plugins.push(

apps-rendering/.storybook/preview.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,14 @@ export const viewports = [320, 375, 480, 660, 740, 980, 1140, 1300];
8282

8383
export const parameters = {
8484
viewport: {
85-
viewports: guardianViewports,
86-
defaultViewport: 'wide',
85+
options: guardianViewports,
8786
},
8887
layout: 'fullscreen',
8988
};
89+
90+
export const initialGlobals = {
91+
viewport: {
92+
value: 'wide',
93+
isRotated: false,
94+
},
95+
};

apps-rendering/package.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,9 @@
5252
"@guardian/source": "9.0.0",
5353
"@guardian/source-development-kitchen": "17.0.0",
5454
"@smithy/property-provider": "2.0.16",
55-
"@storybook/addon-essentials": "8.6.14",
55+
"@storybook/addon-docs": "9.1.13",
5656
"@storybook/addon-webpack5-compiler-babel": "3.0.6",
57-
"@storybook/components": "8.6.14",
58-
"@storybook/core-events": "8.6.14",
59-
"@storybook/manager-api": "8.6.14",
60-
"@storybook/preview-api": "8.6.14",
61-
"@storybook/react": "8.6.14",
62-
"@storybook/react-webpack5": "8.6.14",
63-
"@storybook/theming": "8.6.14",
57+
"@storybook/react-webpack5": "9.1.13",
6458
"@types/clean-css": "4.2.11",
6559
"@types/compression": "1.8.1",
6660
"@types/express": "5.0.1",
@@ -95,7 +89,7 @@
9589
"react-dom": "18.3.1",
9690
"react-test-renderer": "18.3.1",
9791
"require-from-string": "2.0.2",
98-
"storybook": "8.6.14",
92+
"storybook": "9.1.13",
9993
"thrift": "0.20.0",
10094
"ts-jest": "29.1.2",
10195
"ts-loader": "9.5.4",

apps-rendering/src/components/Layout/Layout.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { Edition } from '@guardian/apps-rendering-api-models/edition';
44
import { ArticleSpecial, formatToString } from '../../articleFormat';
55
import { breakpoints } from '@guardian/source/foundations';
6-
import type { StoryFn } from '@storybook/react';
6+
import type { StoryFn } from '@storybook/react-webpack5';
77
import {
88
analysis,
99
article,

apps-rendering/src/components/Pagination/Pagination.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
formatToString,
55
} from '../../articleFormat';
66
import { breakpoints } from '@guardian/source/foundations';
7-
import type { StoryFn } from '@storybook/react';
7+
import type { StoryFn } from '@storybook/react-webpack5';
88
import { getAllThemes } from 'fixtures/article';
99
import { Pagination } from '.';
1010

dotcom-rendering/.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ module.exports = {
6363
'eslint:recommended',
6464
'@guardian/eslint-config-typescript',
6565
'plugin:jsx-a11y/recommended',
66+
'plugin:ssr-friendly/recommended',
67+
'plugin:storybook/recommended',
6668
// eslint-config-prettier disables formatting rules that conflict with prettier
6769
// needs to go last so it can override other configuration. See https://github.com/prettier/eslint-config-prettier#installation
6870
'prettier',
69-
'plugin:ssr-friendly/recommended',
7071
],
7172
parser: '@typescript-eslint/parser',
7273
parserOptions: {

dotcom-rendering/.storybook/decorators/configContextDecorator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { ConfigProvider } from '../../src/components/ConfigContext';
3-
import type { Decorator } from '@storybook/react';
3+
import type { Decorator } from '@storybook/react-webpack5';
44
import { Config } from '../../src/types/configContext';
55

66
const defaultConfig = {

dotcom-rendering/.storybook/decorators/gridDecorators.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { css } from '@emotion/react';
2-
import type { Decorator } from '@storybook/react';
2+
import type { Decorator } from '@storybook/react-webpack5';
33
import { grid } from '../../src/grid';
44
import { from } from '@guardian/source/foundations';
55

dotcom-rendering/.storybook/decorators/splitThemeDecorator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
textSans17,
1414
textSansBold20,
1515
} from '@guardian/source/foundations';
16-
import { Decorator } from '@storybook/react';
16+
import { Decorator } from '@storybook/react-webpack5';
1717
import { storybookPaletteDeclarations as paletteDeclarations } from '../mocks/paletteDeclarations';
1818
import type { ReactNode } from 'react';
1919

0 commit comments

Comments
 (0)