-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Add main configuration API reference pages #22539
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7320a59
Rename TOC item: @storybook/blocks -> Doc blocks
kylegach e8a89db
Add /docs/api/main-config-* pages
kylegach 37144b7
Update snippets & guides related to main-config-* pages
kylegach 06e8807
Update Overview to ensure "main.js" and "main.ts" are searchable
kylegach 92c7faa
Simplify presentation of properties
kylegach 8cac168
Update main.js|ts snippets for consistency
kylegach 1d00b24
Add examples for all main config sub properties
kylegach 1d3262e
Address comments:
kylegach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,22 @@ | ||
| --- | ||
| title: 'addons' | ||
| --- | ||
|
|
||
| Parent: [main.js|ts configuration](./main-config.md) | ||
|
|
||
| Type: `(string | { name: string; options?: AddonOptions })[]` | ||
|
|
||
| Registers the [addons](../addons/install-addons.md) loaded by Storybook. | ||
|
|
||
| For each addon's available options, see their respective [documentation](https://storybook.js.org/integrations). | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-addons.js.mdx', | ||
| 'common/main-config-addons.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> |
This file contains hidden or 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,35 @@ | ||
| --- | ||
| title: 'babelDefault' | ||
| --- | ||
|
|
||
| Parent: [main.js|ts configuration](./main-config.md) | ||
|
|
||
| Type: `(config: Babel.Config, options: Options) => Babel.Config | Promise<Babel.Config>` | ||
|
|
||
| `babelDefault` allows customization of Storybook's [Babel](https://babeljs.io/) setup. It is applied to the preview config before any user presets have been applied, which makes it useful and recommended for [addon authors](../addons/writing-presets.md#babel) so that the end user's [`babel`](./main-config-babel.md) setup can override it. | ||
|
|
||
| <div class="aside"> | ||
|
|
||
| 💡 To adjust your Storybook's Babel setup directly—not via an addon—use [`babel`](./main-config-babel.md) instead. | ||
|
|
||
| </div> | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/storybook-babel-configuration-example.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `Babel.Config` | ||
|
|
||
| See [Babel docs](https://babeljs.io/docs/options). | ||
|
|
||
| ## `Options` | ||
|
|
||
| Type: `{ configType?: 'DEVELOPMENT' | 'PRODUCTION' }` | ||
|
|
||
| There are other options that are difficult to document here. Please introspect the type definition for more information. |
This file contains hidden or 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,36 @@ | ||
| --- | ||
| title: 'babel' | ||
| --- | ||
|
|
||
| Parent: [main.js|ts configuration](./main-config.md) | ||
|
|
||
| Type: `(config: Babel.Config, options: Options) => Babel.Config | Promise<Babel.Config>` | ||
|
|
||
| Customize Storybook's [Babel](https://babeljs.io/) setup. | ||
|
|
||
| <div class="aside"> | ||
|
|
||
| 💡 [Addon authors](../addons/writing-presets.md#babel) should use [`babelDefault`](./main-config-babel-default.md) instead, which is applied to the preview config before any user presets have been applied. | ||
|
|
||
| </div> | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-babel.js.mdx', | ||
| 'common/main-config-babel.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `Babel.Config` | ||
|
|
||
| See [Babel docs](https://babeljs.io/docs/options). | ||
|
|
||
| ## `Options` | ||
|
|
||
| Type: `{ configType?: 'DEVELOPMENT' | 'PRODUCTION' }` | ||
|
|
||
| There are other options that are difficult to document here. Please introspect the type definition for more information. |
This file contains hidden or 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,11 @@ | ||
| --- | ||
| title: 'config' | ||
| --- | ||
|
|
||
| Parent: [main.js|ts configuration](./main-config.md) | ||
|
|
||
| Type: `string[] | ((config: string[], options: Options) => string[] | Promise<string[]>)` | ||
|
|
||
| Deprecated: `true` | ||
|
|
||
| Add additional scripts to run in the story preview. Deprecated in favor of [`previewAnnotations`](./main-config-preview-annotations.md). | ||
This file contains hidden or 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,181 @@ | ||
| --- | ||
| title: 'core' | ||
| --- | ||
|
|
||
| Parent: [main.js|ts configuration](./main-config.md) | ||
|
|
||
| Type: | ||
|
|
||
| ```ts | ||
| { | ||
| builder?: string | { name: string; options?: BuilderOptions }; | ||
| channelOptions?: ChannelOptions; | ||
| crossOriginIsolated?: boolean; | ||
| disableProjectJson?: boolean; | ||
| disableTelemetry?: boolean; | ||
| disableWebpackDefaults?: boolean; | ||
| enableCrashReports?: boolean; | ||
| renderer?: RendererName; | ||
| } | ||
| ``` | ||
|
|
||
| Configures Storybook's internal features. | ||
|
|
||
| ## `builder` | ||
|
|
||
| Type: | ||
|
|
||
| ```ts | ||
| | '@storybook/builder-vite' | '@storybook/builder-webpack5' | ||
| | { | ||
| name: '@storybook/builder-vite' | '@storybook/builder-webpack5'; | ||
| options?: BuilderOptions; | ||
| } | ||
| ``` | ||
|
|
||
| Configures Storybook's builder, [Vite](../builders/vite.md) or [Webpack](../builders/webpack.md). | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-core-builder.js.mdx', | ||
| 'common/main-config-core-builder.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `channelOptions` | ||
|
|
||
| Type: `ChannelOptions` | ||
|
|
||
| ```ts | ||
| { | ||
| allowClass: boolean; | ||
| allowDate: boolean; | ||
| allowFunction: boolean; | ||
| allowRegExp: boolean; | ||
| allowSymbol: boolean; | ||
| allowUndefined: boolean; | ||
| lazyEval: boolean; | ||
| maxDepth: number; | ||
| space: number | undefined; | ||
| } | ||
| ``` | ||
|
|
||
| Configures the channel used by Storybook to communicate between the manager and preview. | ||
|
|
||
| Only two properties are likely to be used: | ||
|
|
||
| ### `channelOptions.allowFunction` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| Default: `false` | ||
|
|
||
| Enables serializing functions across the channel, which can be a security risk. | ||
|
|
||
| ### `channelOptions.maxDepth` | ||
|
|
||
| Type: `number` | ||
|
|
||
| Default: `3` | ||
|
|
||
| The maximum depth of nested objects to serialize across the channel. Larger values will be slower. | ||
|
|
||
| ## `crossOriginIsolated` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| Enable CORS headings to run document in a "secure context". See [SharedArrayBuffer security requirements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements) | ||
|
|
||
| This enables these headers in development-mode: | ||
|
|
||
| - `Cross-Origin-Opener-Policy: same-origin` | ||
| - `Cross-Origin-Embedder-Policy: require-corp` | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-core-cross-origin-isolated.js.mdx', | ||
| 'common/main-config-core-cross-origin-isolated.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `disableProjectJson` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| Disables the generation of `project.json`, a file containing Storybook metadata | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-core-disable-project-json.js.mdx', | ||
| 'common/main-config-core-disable-project-json.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `disableTelemetry` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| Disables Storybook's [telemetry collection](../configure/telemetry.md). | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-core-disable-telemetry.js.mdx', | ||
| 'common/main-config-core-disable-telemetry.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `disableWebpackDefaults` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| Disables Storybook's default Webpack configuration. | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-core-disable-webpack-defaults.js.mdx', | ||
| 'common/main-config-core-disable-webpack-defaults.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `enableCrashReports` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| Enable crash reports to be sent to Storybook [telemetry](../configure/telemetry.md). | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-core-enable-crash-reports.js.mdx', | ||
| 'common/main-config-core-enable-crash-reports.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `renderer` | ||
|
|
||
| Type: `RendererName` | ||
|
|
||
| <!-- TOOD: Is this used? Should it be documented? --> |
This file contains hidden or 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,76 @@ | ||
| --- | ||
| title: 'docs' | ||
| --- | ||
|
|
||
| Parent: [main.js|ts configuration](./main-config.md) | ||
|
|
||
| Type: | ||
|
|
||
| ```ts | ||
| { | ||
| autodocs?: boolean | 'tag'; | ||
| defaultName?: string; | ||
| docsMode?: boolean; | ||
| } | ||
| ``` | ||
|
|
||
| Configures Storybook's [auto-generated documentation](../writing-docs/autodocs.md). | ||
|
|
||
| ## `autoDocs` | ||
|
|
||
| Type: `boolean | 'tag'` | ||
|
|
||
| Default: `'tag'` | ||
|
|
||
| Enables or disables automatic documentation for stories. | ||
|
|
||
| - `true`: Enables it for all stories | ||
| - `false`: Disables it for all stories | ||
| - `'tag'`: Enables it for stories tagged with `'autodocs'` | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-docs-autodocs.js.mdx', | ||
| 'common/main-config-docs-autodocs.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `defaultName` | ||
|
|
||
| Type: `string` | ||
|
|
||
| Default: `'Docs'` | ||
|
|
||
| Name used for generated documentation pages. | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-docs-default-name.js.mdx', | ||
| 'common/main-config-docs-default-name.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## `docsMode` | ||
|
|
||
| Type: `boolean` | ||
|
|
||
| Only show documentation pages in the sidebar (usually set with the `--docs` CLI flag). | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
|
|
||
| <CodeSnippets | ||
| paths={[ | ||
| 'common/main-config-docs-docs-mode.js.mdx', | ||
| 'common/main-config-docs-docs-mode.ts.mdx', | ||
| ]} | ||
| /> | ||
|
|
||
| <!-- prettier-ignore-end --> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.