Skip to content

Commit 0da5f7b

Browse files
Merge pull request #19 from strozw/fix/example
fix: Update storybook to make example work
2 parents b356ae5 + 9fa344d commit 0da5f7b

File tree

5 files changed

+3080
-5329
lines changed

5 files changed

+3080
-5329
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This is a Vite plugin that allows you to use Next.js features in Vite. It is the basis for `@storybook/experimental-nextjs-vite` and should be used when running portable stories in Vitest.
44

55
## Features
6-
76
- **Next.js Integration**: Seamlessly integrate Next.js features into your Vite project.
87
- **Storybook Compatibility**: Acts as the foundation for [the `@storybook/experimental-nextjs-vite` framework](https://storybook.js.org/docs/get-started/frameworks/nextjs#with-vite), enabling you to use Storybook with Next.js in a Vite environment.
98
- **Portable Stories**: Ideal for running portable stories in Vitest, ensuring your components are tested in an environment that closely mirrors production.
@@ -116,12 +115,12 @@ When testing components that rely on Next.js Server Actions, you need to ensure
116115

117116
```ts
118117
// vitest.config.ts
119-
import { defineConfig } from "vite";
118+
import { defineConfig } from "vitest/config";
120119
import nextjs from "vite-plugin-storybook-nextjs";
121120

122121
export default defineConfig({
123122
plugins: [nextjs()],
124-
vitest: {
123+
test: {
125124
environment: "jsdom", // 👈 Add this
126125
},
127126
});

example/.storybook/vitest.config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from "node:path";
22
import url from "node:url";
3-
import { storybookTest } from "@storybook/experimental-addon-test/vite-plugin";
3+
import { storybookTest } from "@storybook/experimental-addon-test/vitest-plugin";
44
import { storybookNextJsPlugin } from "@storybook/experimental-nextjs-vite/vite-plugin";
55
import Inspect from "vite-plugin-inspect";
66
import { defineConfig } from "vitest/config";
@@ -9,10 +9,10 @@ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
99

1010
export default defineConfig({
1111
plugins: [
12-
storybookNextJsPlugin({ dir: path.join(__dirname, "..") }),
1312
storybookTest({
1413
configDir: __dirname,
1514
}),
15+
storybookNextJsPlugin({ dir: path.join(__dirname, "..") }),
1616
Inspect({ build: true, outputDir: ".vite-inspect" }),
1717
],
1818
test: {

example/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
"styled-jsx": "^5.1.6"
2222
},
2323
"devDependencies": {
24-
"@chromatic-com/storybook": "^1.5.0",
25-
"@storybook/addon-actions": "0.0.0-pr-29044-sha-67f91ec6",
26-
"@storybook/addon-essentials": "0.0.0-pr-29044-sha-67f91ec6",
27-
"@storybook/addon-interactions": "0.0.0-pr-29044-sha-67f91ec6",
28-
"@storybook/addon-links": "0.0.0-pr-29044-sha-67f91ec6",
29-
"@storybook/addon-onboarding": "0.0.0-pr-29044-sha-67f91ec6",
30-
"@storybook/addon-toolbars": "0.0.0-pr-29044-sha-67f91ec6",
31-
"@storybook/blocks": "0.0.0-pr-29044-sha-67f91ec6",
32-
"@storybook/experimental-nextjs-vite": "0.0.0-pr-29044-sha-67f91ec6",
33-
"@storybook/experimental-addon-test": "0.0.0-pr-29044-sha-67f91ec6",
34-
"@storybook/react": "0.0.0-pr-29044-sha-67f91ec6",
35-
"@storybook/test": "0.0.0-pr-29044-sha-67f91ec6",
24+
"@chromatic-com/storybook": "^2.0.2",
25+
"@storybook/addon-actions": "^8.3.1",
26+
"@storybook/addon-essentials": "^8.3.1",
27+
"@storybook/addon-interactions": "^8.3.1",
28+
"@storybook/addon-links": "^8.3.1",
29+
"@storybook/addon-onboarding": "^8.3.1",
30+
"@storybook/addon-toolbars": "^8.3.1",
31+
"@storybook/blocks": "^8.3.1",
32+
"@storybook/experimental-addon-test": "^8.3.1",
33+
"@storybook/experimental-nextjs-vite": "^8.3.1",
34+
"@storybook/react": "^8.3.1",
35+
"@storybook/test": "^8.3.1",
3636
"@testing-library/dom": "^10.3.2",
3737
"@testing-library/jest-dom": "^6.4.6",
3838
"@testing-library/react": "^16.0.0",
@@ -48,7 +48,7 @@
4848
"playwright": "^1.45.3",
4949
"postcss": "^8.4.38",
5050
"serve": "^14.2.3",
51-
"storybook": "0.0.0-pr-29044-sha-67f91ec6",
51+
"storybook": "^8.3.1",
5252
"tailwindcss": "^3.4.4",
5353
"typescript": "^5",
5454
"vite-plugin-inspect": "^0.8.5",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"react": "^18",
7676
"rollup": "^4.18.0",
7777
"sharp": "^0.33.4",
78-
"storybook": "8.3.0-alpha.3",
78+
"storybook": "^8.3.0",
7979
"tsup": "^8.1.0",
8080
"typescript": "^5.0.0",
8181
"vite": "^5.0.0",

0 commit comments

Comments
 (0)