Skip to content

Commit 5fcdb72

Browse files
Migrate storybook to 6.2.9 (#18693)
#### Pull request checklist - [x] Addresses an existing issue: Fixes #18142 - [x] Include a change request file using `$ yarn change` #### Description of changes
1 parent 465a840 commit 5fcdb72

File tree

19 files changed

+2327
-1261
lines changed

19 files changed

+2327
-1261
lines changed

.storybook/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ module.exports = /** @type {Pick<StorybookConfig,'addons' |'stories' |'webpackFi
4343

4444
return config;
4545
},
46+
47+
core: {
48+
builder: 'webpack5',
49+
},
4650
});
4751

4852
/**
@@ -65,7 +69,7 @@ function overrideDefaultBabelLoader(rules) {
6569
}
6670

6771
const loaderIdx = rule.use.findIndex(loaderConfig => {
68-
return /** @type {LoaderObjectDef} */ (loaderConfig).loader === 'babel-loader';
72+
return /** @type {LoaderObjectDef} */ (loaderConfig).loader.includes('babel-loader');
6973
});
7074

7175
const loader = /** @type {LoaderObjectDef}*/ (rule.use[loaderIdx]);

apps/vr-tests/.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"rules": {
55
"@typescript-eslint/no-explicit-any": "off",
66
"@typescript-eslint/jsx-no-bind": "off",
7-
"deprecation/deprecation": "off"
7+
"deprecation/deprecation": "off",
8+
"import/no-extraneous-dependencies": ["error", { "packageDir": [".", "../.."] }]
89
}
910
}

apps/vr-tests/.storybook/preview.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,7 @@ setAddon({
4343
},
4444
});
4545

46-
/**
47-
* @type {import('@storybook/react').Meta['decorators']}
48-
*/
49-
export const decorators = [removeCanvasInlineStyles];
50-
51-
/**
52-
* Temporary solution to remove inline styles injected by new default SB layout (https://storybook.js.org/docs/react/configure/story-layout)
53-
* TODO - remove this once we migrate to SB 6.1
54-
* @see https://github.com/storybookjs/storybook/issues/12041#issuecomment-717177177
55-
* @param {Parameters<import('@storybook/react').Meta['decorators'][number]>[0]} Story
56-
*/
57-
function removeCanvasInlineStyles(Story) {
58-
document.body.removeAttribute('style');
59-
return createElement(Story);
60-
}
46+
export const parameters = { layout: 'none' };
6147

6248
// For static storybook per https://github.com/screener-io/screener-storybook#testing-with-static-storybook-app
6349
if (typeof window === 'object') {

apps/vr-tests/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
"@fluentui/react-theme": "^9.0.0-alpha.17",
3737
"@fluentui/scripts": "^1.0.0",
3838
"@fluentui/storybook": "^1.0.0",
39-
"@storybook/addons": "6.0.28",
40-
"@storybook/channels": "6.0.28",
41-
"@storybook/react": "6.0.28",
4239
"@types/react": "16.9.42",
4340
"@types/react-dom": "16.9.10",
4441
"csstype": "^2.6.7",

apps/vr-tests/src/utilities/FabricDecorator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { DecoratorFunction } from '@storybook/addons';
3-
import { StoryFnReactReturnType } from '@storybook/react/dist/client/preview/types';
3+
import { StoryFnReactReturnType } from '@storybook/react/dist/ts3.9/client/preview/types';
44

55
export const FabricDecorator: DecoratorFunction<StoryFnReactReturnType> = story => (
66
<div style={{ display: 'flex' }}>

apps/vr-tests/src/utilities/FluentProviderDecorator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FluentProvider } from '@fluentui/react-provider';
22
import { webLightTheme } from '@fluentui/react-theme';
33
import { DecoratorFunction } from '@storybook/addons';
4-
import { StoryFnReactReturnType } from '@storybook/react/dist/client/preview/types';
4+
import { StoryFnReactReturnType } from '@storybook/react/dist/ts3.9/client/preview/types';
55
import * as React from 'react';
66

77
export const FluentProviderDecorator: DecoratorFunction<StoryFnReactReturnType> = story => (

apps/vr-tests/src/utilities/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface IStoryConfig {
88
rtl?: boolean;
99
}
1010

11-
declare module '@storybook/addons/dist/types' {
11+
declare module '@storybook/addons/dist/ts3.9/types' {
1212
// eslint-disable-next-line @typescript-eslint/naming-convention
1313
interface StoryApi<StoryFnReturnType = unknown> {
1414
/** adds a story, but via VR Tests' addon which auto adds variants like RTL */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix: replace class with className in mdx file",
4+
"packageName": "@fluentui/react-examples",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "react-popver: fix Default story issue caused by storybook migration",
4+
"packageName": "@fluentui/react-popover",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"rename-package": "node -r ./scripts/ts-node-register ./scripts/rename-package.ts",
5353
"run:published": "node ./scripts/monorepo/runPublished.js",
5454
"runto:lerna": "node ./scripts/monorepo/runTo.js",
55-
"satisfied": "satisfied --skip-invalid --ignore \"sass|@testing-library|vue\"",
55+
"satisfied": "satisfied --skip-invalid --ignore \"angular|sass|svelte|@testing-library|vue\"",
5656
"scrub": "node ./scripts/scrub.js",
5757
"start": "node scripts/start.js",
5858
"start:legacy": "yarn workspace @fluentui/public-docsite-resources start",
@@ -84,16 +84,16 @@
8484
"@nrwl/node": "12.1.0",
8585
"@nrwl/tao": "12.1.0",
8686
"@nrwl/workspace": "12.1.0",
87-
"@storybook/addon-a11y": "6.0.28",
88-
"@storybook/addon-actions": "6.0.28",
89-
"@storybook/addon-docs": "6.0.28",
90-
"@storybook/addon-essentials": "6.0.28",
91-
"@storybook/addon-info": "6.0.0-alpha.2",
92-
"@storybook/addon-knobs": "6.0.28",
93-
"@storybook/addons": "6.0.28",
94-
"@storybook/channels": "6.0.28",
95-
"@storybook/core": "6.0.28",
96-
"@storybook/react": "6.0.28",
87+
"@storybook/addon-a11y": "6.2.9",
88+
"@storybook/addon-actions": "6.2.9",
89+
"@storybook/addon-docs": "6.2.9",
90+
"@storybook/addon-essentials": "6.2.9",
91+
"@storybook/addon-knobs": "6.2.9",
92+
"@storybook/addons": "6.2.9",
93+
"@storybook/channels": "6.2.9",
94+
"@storybook/core": "6.2.9",
95+
"@storybook/react": "6.2.9",
96+
"@storybook/builder-webpack5": "6.2.9",
9797
"@testing-library/jest-dom": "5.11.9",
9898
"@testing-library/react": "10.4.9",
9999
"@testing-library/react-hooks": "5.0.3",

0 commit comments

Comments
 (0)