You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/guides/ecosystem/storybook.md
+17-30Lines changed: 17 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,41 +12,23 @@ tocHeading: 2
12
12
13
13
## Setup
14
14
15
-
We recommend using the [Storybook CLI](https://storybook.js.org/docs/get-started/install) to setup a project from scratch:
15
+
> _This guide assumes Storybook v10+_
16
+
17
+
We recommend using the [Storybook CLI](https://storybook.js.org/docs/get-started/install) to setup a project from scratch using the Web Components template:
As part of the prompts, we suggest the following answers to project type (**web_components**) and builder (**Vite**):
30
-
31
-
```shell
32
-
✔ Do you want to manually choose a Storybook project type to install? … yes
33
-
? Please choose a project type from the following list: › - Use arrow-keys. Return to submit.
34
-
↑ webpack_react
35
-
nextjs
36
-
vue3
37
-
angular
38
-
ember
39
-
❯ web_components
40
-
html
41
-
qwik
42
-
preact
43
-
↓ svelte
44
-
45
-
We were not able to detect the right builder for your project. Please selectone: › - Use arrow-keys. Return to submit.
46
-
❯ Vite
47
-
Webpack 5
48
-
```
49
-
50
32
> See our Vitest docs for additional configuration examples to support [Import Attributes](/guides/ecosystem/vitest/#import-attributes) and [Greenwood resource plugins](/guides/ecosystem/vitest/#resource-plugins) usage in your components. For that guide, you'll be updating a _vite.config.js_ file instead.
51
33
52
34
## Usage
@@ -81,15 +63,18 @@ You should now be good to start writing your first story! 📚
@@ -151,7 +136,9 @@ You'll want to create a CommonJS version with the following name, depending on w
151
136
152
137
If you are using any of Greenwood's Content as Data [Client APIs](/docs/content-as-data/data-client/), you'll want to configure Storybook to mock the HTTP calls Greenwood's data client makes, and provide the desired response needed based on the API being called.
153
138
154
-
This can be accomplished with the [**storybook-addon-fetch-mock**](https://storybook.js.org/addons/storybook-addon-fetch-mock) addon and configuring it with the right `matcher.url` and `matcher.response`
139
+
This can be accomplished with the [**storybook-addon-fetch-mock**](https://storybook.js.org/addons/storybook-addon-fetch-mock) addon and configuring it with the right `matcher.url` and `matcher.response`.
140
+
141
+
> Be aware of this [open issue](https://github.com/JohnAlbin/storybook-addon-fetch-mock/issues/32) with **storybook-addon-fetch-mock**.
155
142
156
143
1. First, install the **storybook-addon-fetch-mock** addon
@@ -225,13 +225,13 @@ You should now be good to start writing your first test! ⚡
225
225
226
226
## Import Attributes
227
227
228
-
As [Vite does not support Import Attributes](https://github.com/vitejs/vite/issues/14674), you will need to update your _vitest.config.js_ file and write a [custom plugin](https://vitejs.dev/guide/api-plugin) to work around this.
228
+
As [Vite does not support Import Attributes](https://github.com/vitejs/vite/issues/14674), you will need to update your _vite.config.js_ file and write a [custom plugin](https://vitejs.dev/guide/api-plugin) to work around this.
229
229
230
230
In this example we are handling for CSS Module scripts:
@@ -302,13 +302,13 @@ Phew, should be all set now.
302
302
303
303
## Resource Plugins
304
304
305
-
If you're using one of Greenwood's [resource plugins](/docs/plugins/), you'll want to update the _vitest.config.js_ file with a plugin that can leverage Greenwood's plugins to automatically handle custom transformations.
305
+
If you're using one of Greenwood's [resource plugins](/docs/plugins/), you'll want to update the _vite.config.js_ file with a plugin that can leverage Greenwood's plugins to automatically handle custom transformations.
306
306
307
307
For example, if you're using Greenwood's [Raw Plugin](https://github.com/ProjectEvergreen/greenwood/tree/master/packages/plugin-import-raw), you'll need to create a wrapping Vite plugin to handle this transformation.
0 commit comments