Skip to content

Commit 4844d0f

Browse files
committed
chore: use vite-plugin-turbosnap
1 parent ab36d4c commit 4844d0f

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.turbo/
12
lib/
23
storybook-static/
34

cspell.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,13 @@
1212
"rust",
1313
"typescript"
1414
],
15-
"words": ["Autoprefix", "gtag", "lucide", "preact", "serde"]
15+
"words": [
16+
"autodocs",
17+
"Autoprefix",
18+
"gtag",
19+
"lucide",
20+
"preact",
21+
"serde",
22+
"turbosnap"
23+
]
1624
}

package-lock.json

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ui/.storybook/main.ts

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { StorybookConfig } from "@storybook/preact-vite";
2+
import { mergeConfig } from "vite";
3+
import turbosnap from "vite-plugin-turbosnap";
24

35
const config: StorybookConfig = {
46
stories: ["../src/**/*.stories.@(ts|tsx)"],
@@ -12,6 +14,15 @@ const config: StorybookConfig = {
1214
name: "@storybook/preact-vite",
1315
options: {},
1416
},
17+
async viteFinal(config, { configType }) {
18+
const isProduction = configType === "PRODUCTION";
19+
20+
return mergeConfig(config, {
21+
plugins: isProduction
22+
? [turbosnap({ rootDir: config.root ?? process.cwd() })]
23+
: [],
24+
});
25+
},
1526
docs: {
1627
autodocs: "tag",
1728
},

packages/ui/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"@testing-library/preact": "^3.2.3",
2424
"@twind/preset-autoprefix": "^1.0.7",
2525
"@twind/preset-tailwind": "^1.1.4",
26-
"storybook": "^7.6.17"
26+
"storybook": "^7.6.17",
27+
"vite-plugin-turbosnap": "^1.0.3"
2728
},
2829
"typings": "lib/index.d.ts",
2930
"dependencies": {

0 commit comments

Comments
 (0)