-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: implement new storybook architecture - for converged packages/react-menu #17866
Changes from all commits
2f8eecb
8b0a4a7
0970c0d
9b82bdb
52ce73b
3e72d33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,17 @@ | |
# docs/ [email protected] | ||
|
||
#### Build stuff | ||
/.storybook/ @microsoft/fluentui-react-build | ||
scripts/ @microsoft/fluentui-react-build | ||
package.json @microsoft/fluentui-react-build | ||
yarn.lock @microsoft/fluentui-react-build | ||
*.config.js @microsoft/fluentui-react-build | ||
*.sh @microsoft/fluentui-react-build | ||
*.yml @microsoft/fluentui-react-build | ||
tsconfig.json @microsoft/fluentui-react-build | ||
/tsconfig.base.json @microsoft/fluentui-react-build | ||
/jest.config.js @microsoft/fluentui-react-build | ||
/jest.preset.js @microsoft/fluentui-react-build | ||
lerna.json @microsoft/fluentui-react-build | ||
.codesandbox @microsoft/fluentui-react-build | ||
.devops @microsoft/fluentui-react-build | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const path = require('path'); | ||
const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin'); | ||
|
||
/** | ||
* @callback StorybookWebpackConfig | ||
* @param {import("webpack").Configuration} config | ||
* @param {{configType: 'DEVELOPMENT' | 'PRODUCTION'}} options - change the build configuration. 'PRODUCTION' is used when building the static version of storybook. | ||
* @returns {import("webpack").Configuration} | ||
*/ | ||
|
||
/** | ||
* @typedef {{check:boolean; checkOptions: Record<string,unknown>; reactDocgen: string | boolean; reactDocgenTypescriptOptions: Record<string,unknown>}} StorybookTsConfig | ||
*/ | ||
|
||
/** | ||
* @typedef {{stories: string[] ; addons: string[]; typescript: StorybookTsConfig; babel: (options:Record<string,unknown>)=>Promise<Record<string,unknown>>; webpackFinal: StorybookWebpackConfig}} StorybookConfig | ||
*/ | ||
|
||
module.exports = /** @type {Pick<StorybookConfig,'addons' |'stories' |'webpackFinal'>} */ ({ | ||
stories: [], | ||
addons: [ | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-a11y', | ||
'@storybook/addon-knobs/preset', | ||
'storybook-addon-performance', | ||
], | ||
webpackFinal: config => { | ||
const tsPaths = new TsconfigPathsPlugin({ | ||
configFile: path.resolve(__dirname, '../tsconfig.base.json'), | ||
}); | ||
|
||
if (config.resolve) { | ||
config.resolve.plugins ? config.resolve.plugins.push(tsPaths) : (config.resolve.plugins = [tsPaths]); | ||
} | ||
|
||
return config; | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { withFluentProvider, withStrictMode } from '@fluentui/react-storybook'; | ||
|
||
export const decorators = [withFluentProvider, withStrictMode]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../tsconfig.base.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"allowJs": true, | ||
"checkJs": true, | ||
"jsx": "preserve" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "chore(react-examples): process collocated stories properly and remove react-menu from dependencies", | ||
"packageName": "@fluentui/react-examples", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not really sure about the type, I'd say this is a breaking change hmm, but from what I remember, this package is not being used by anyone ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about used, but it is published |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "chore(react-menu): implement local storybook with stories", | ||
"packageName": "@fluentui/react-menu", | ||
"email": "[email protected]", | ||
"dependentChangeType": "none" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,9 +80,9 @@ | |
"@storybook/channels": "6.0.28", | ||
"@storybook/core": "6.0.28", | ||
"@storybook/react": "6.0.28", | ||
"@testing-library/jest-dom": "5.11.9", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reordered packages by |
||
"@testing-library/react": "10.4.9", | ||
"@testing-library/react-hooks": "5.0.3", | ||
"@testing-library/jest-dom": "5.11.9", | ||
"@types/copy-webpack-plugin": "6.4.0", | ||
"@types/jest": "24.9.1", | ||
"@types/jest-axe": "3.2.2", | ||
|
@@ -101,9 +101,9 @@ | |
"css-loader": "5.0.1", | ||
"cypress": "6.6.0", | ||
"cypress-real-events": "1.2.0", | ||
"eslint-plugin-es": "4.1.0", | ||
"chalk": "2.4.2", | ||
"danger": "^6.0.5", | ||
"eslint-plugin-es": "4.1.0", | ||
"file-loader": "6.2.0", | ||
"gulp": "^4.0.2", | ||
"html-webpack-plugin": "5.1.0", | ||
|
@@ -129,8 +129,9 @@ | |
"syncpack": "^5.6.10", | ||
"ts-jest": "24.3.0", | ||
"ts-loader": "8.0.14", | ||
"webpack": "5.21.2", | ||
"tsconfig-paths-webpack-plugin": "3.5.1", | ||
"typescript": "4.1.5", | ||
"webpack": "5.21.2", | ||
"webpack-cli": "4.3.1", | ||
"webpack-dev-server": "4.0.0-beta.0", | ||
"tmp": "0.2.1", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const rootMain = require('../../../.storybook/main'); | ||
|
||
module.exports = /** @type {Pick<import('../../../.storybook/main').StorybookConfig,'addons'|'stories'|'webpackFinal'>} */ ({ | ||
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'], | ||
addons: [...rootMain.addons], | ||
webpackFinal: (config, options) => { | ||
const localConfig = { ...rootMain.webpackFinal(config, options) }; | ||
|
||
return localConfig; | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as rootPreview from '../../../.storybook/preview'; | ||
|
||
export const decorators = [...rootPreview.decorators]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true | ||
}, | ||
"exclude": ["../**/*.test.ts", "../**/*.test.js", "../**/*.test.tsx", "../**/*.test.jsx"], | ||
"include": ["../src/**/*", "*.js"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would we be OK reming the perf addon ? I have never seen it mentioned nor have I ever used it in any meaningful way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do that, depends on requirements. It is used for react-examples that's why I added it here as well.
My understanding was that this is gonna be used for re-render perf metrics in the future ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't that why we created flamegrill ? 🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea