-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into yann/use-test-package-in-template-stories
- Loading branch information
Showing
14 changed files
with
181 additions
and
26 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import type { Renderer, ProjectAnnotations } from '@storybook/types'; | ||
import { GLOBAL_KEY } from './constants'; | ||
|
||
const preview: ProjectAnnotations<Renderer> = { | ||
globals: { | ||
// Required to make sure SB picks this up from URL params | ||
[GLOBAL_KEY]: '', | ||
}, | ||
export const globals: ProjectAnnotations<Renderer>['globals'] = { | ||
// Required to make sure SB picks this up from URL params | ||
[GLOBAL_KEY]: '', | ||
}; | ||
|
||
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
15 changes: 15 additions & 0 deletions
15
docs/snippets/common/main-config-builder-custom-config.js.mdx
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,15 @@ | ||
```js | ||
// .storybook/main.js|ts | ||
|
||
export default { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
core: { | ||
builder: { | ||
name: '@storybook/builder-vite', | ||
options: { | ||
viteConfigPath: '../customVite.config.js', | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` |
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,21 @@ | ||
```ts | ||
// .storybook/main.ts | ||
|
||
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite) | ||
import type { StorybookConfig } from '@storybook/your-framework'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
framework: '@storybook/your-framework', | ||
core: { | ||
builder: { | ||
name: '@storybook/builder-vite', | ||
options: { | ||
viteConfigPath: '../../../vite.config.js', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
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,23 @@ | ||
```js | ||
// .storybook/main.js|ts | ||
|
||
import { mergeConfig } from 'vite'; | ||
|
||
export default { | ||
stories: ['../src/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
core: { | ||
builder: '@storybook/builder-vite', | ||
}, | ||
async viteFinal(config, { configType }) { | ||
if (configType === 'DEVELOPMENT') { | ||
// Your development configuration goes here | ||
} | ||
if (configType === 'PRODUCTION') { | ||
// Your production configuration goes here. | ||
} | ||
return mergeConfig(config, { | ||
// Your environment configuration here | ||
}); | ||
}, | ||
}; | ||
``` |
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,27 @@ | ||
```ts | ||
// .storybook/main.ts | ||
|
||
// Replace your-framework with the framework you are using (e.g., react-vite, vue3-vite) | ||
import type { StorybookConfig } from '@storybook/your-framework'; | ||
|
||
import { mergeConfig } from 'vite'; | ||
|
||
const config: StorybookConfig = { | ||
// Replace your-framework with the framework you are using (e.g., react-vite, vue3-vite) | ||
framework: '@storybook/your-framework', | ||
stories: ['../src/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
async viteFinal(config, { configType }) { | ||
if (configType === 'DEVELOPMENT') { | ||
// Your development configuration goes here | ||
} | ||
if (configType === 'PRODUCTION') { | ||
// Your production configuration goes here. | ||
} | ||
return mergeConfig(config, { | ||
// Your environment configuration here | ||
}); | ||
}, | ||
}; | ||
|
||
export default config; | ||
``` |
7 changes: 7 additions & 0 deletions
7
docs/snippets/common/storybook-vite-builder-jest-mock.html.mdx
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,7 @@ | ||
```html | ||
<!-- .storybook/preview-head.html --> | ||
|
||
<script> | ||
window.global = window; | ||
</script> | ||
``` |
2 changes: 1 addition & 1 deletion
2
docs/snippets/common/storybook-vite-builder-react-docgen.js.mdx
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
17 changes: 17 additions & 0 deletions
17
docs/snippets/common/storybook-vite-builder-ts-configure.ts-4-9.mdx
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,17 @@ | ||
```ts | ||
// .storybook/main.ts | ||
|
||
// Replace your-framework with the framework you are using (e.g., react-vite, vue3-vite) | ||
import type { StorybookConfig } from '@storybook/your-framework'; | ||
|
||
const config: StorybookConfig = { | ||
framework: '@storybook/your-framework', | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
async viteFinal(config, options) { | ||
// Add your configuration here | ||
return config; | ||
}, | ||
}; | ||
|
||
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