-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump
@storybook/react
to ^7.4.2 (#1656)
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> <!-- Fixes #0000 --> Fixes #1255 ## Summary <!-- Please brief explanation of the changes made --> - 스토리북 메이저 버전을 7로 올리고 브레이킹 체인지에 대응합니다. ## Details <!-- Please elaborate description of the changes --> 버전 업에 따른 변경 사항은 다음과 같습니다. - `main` 파일 마이그레이션 (codemod 사용), ts 마이그레이션하여 스토리북에서 제공하는 타입 활용 ([#](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#esm-format-in-mainjs)). `preview` 파일도 themeProvider 분리하고 ts 마이그레이션 - `getTitle` 유틸을 활용해서 `component/.../lastFolderName`형식으로 타이틀 얻어오던 것을 제거. 스토리북 7버전 부터는 동적으로 타이틀을 계산하는 것을 허용하지 않고 있고, 명시적으로 지정하지 않으면 알아서 경로를 잘 보여주게 됩니다. ([#](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#titles-are-statically-computed)) - CSF2 -> CSF3으로 변경 (codemod 사용) - `control` 의 `option` 필드가 `control` 아래에 있었던 것을 하나 올려서 같은 depth 가 되도록 변경 ([#](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-controloptions)) - default export 되는 meta 의 타입 단언을 타입 선언으로 변경 - 이제 docs 가 스토리마다 있는 것이 아니라 컴포넌트 단위로 존재하게 됩니다. 이후 pr 에서 아래 이슈들을 차례대로 다루면 될 것 같습니다. #1083 #1000 ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> - No ## References <!-- Please list any other resources or points the reviewer should be aware of --> - https://storybook.js.org/docs/7.0/react/migration-guide#page-top - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#migration
- Loading branch information
1 parent
729dc76
commit 572ac77
Showing
67 changed files
with
5,511 additions
and
8,510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { dirname, join } from "path" | ||
|
||
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin' | ||
import { type StorybookConfig } from '@storybook/react-webpack5' | ||
|
||
function getAbsolutePath(value) { | ||
return dirname(require.resolve(join(value, "package.json"))) | ||
} | ||
|
||
const config: StorybookConfig = { | ||
stories: [ | ||
'../src/**/*.stories.(tsx|mdx)', | ||
], | ||
|
||
addons: [ | ||
getAbsolutePath("@storybook/addon-controls"), | ||
getAbsolutePath("@storybook/addon-actions"), | ||
getAbsolutePath("@storybook/addon-a11y"), | ||
getAbsolutePath("@storybook/addon-toolbars"), | ||
getAbsolutePath("@storybook/addon-docs"), | ||
getAbsolutePath("@storybook/addon-backgrounds"), | ||
], | ||
|
||
typescript: { | ||
/** | ||
* @note | ||
* | ||
* `react-docgen-typescript-plugin` introduces significant overhead | ||
* when HMR is enabled, so we enable it only in production. | ||
*/ | ||
reactDocgen: process.env.NODE_ENV === 'production' && 'react-docgen-typescript', | ||
reactDocgenTypescriptOptions: { | ||
shouldRemoveUndefinedFromOptional: true, | ||
shouldExtractLiteralValuesFromEnum: true, | ||
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true), | ||
}, | ||
}, | ||
|
||
webpackFinal: async (config) => { | ||
config.resolve = { | ||
...config.resolve, | ||
// Apply tsconfig alias path | ||
plugins: [ | ||
...(config?.resolve?.plugins ?? []), | ||
new TsconfigPathsPlugin({}), | ||
], | ||
extensions: [ | ||
...(config.resolve?.extensions ?? []), | ||
'.ts', | ||
'.tsx', | ||
] | ||
} | ||
|
||
config.module = { | ||
...config.module, | ||
rules: [ | ||
...(config.module?.rules ?? []), { | ||
test: /\.(ts|tsx)$/, | ||
loader: require.resolve('babel-loader'), | ||
options: { | ||
presets: [['react-app', { flow: false, typescript: true }]], | ||
} | ||
} | ||
] | ||
} | ||
|
||
return config | ||
}, | ||
|
||
framework: { | ||
name: '@storybook/react-webpack5', | ||
options: {} | ||
}, | ||
|
||
docs: { | ||
autodocs: true | ||
} | ||
} | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { Preview } from "@storybook/react" | ||
|
||
import { WithFoundationProvider } from './WithFoundationProvider' | ||
|
||
const preview: Preview = { | ||
decorators: [WithFoundationProvider], | ||
} | ||
|
||
export default preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.