Skip to content

Commit

Permalink
chore: use vite-plugin-turbosnap
Browse files Browse the repository at this point in the history
  • Loading branch information
9renpoto committed Feb 23, 2024
1 parent ab36d4c commit 4844d0f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.turbo/
lib/
storybook-static/

Expand Down
10 changes: 9 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,13 @@
"rust",
"typescript"
],
"words": ["Autoprefix", "gtag", "lucide", "preact", "serde"]
"words": [
"autodocs",
"Autoprefix",
"gtag",
"lucide",
"preact",
"serde",
"turbosnap"
]
}
9 changes: 8 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions packages/ui/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { StorybookConfig } from "@storybook/preact-vite";
import { mergeConfig } from "vite";
import turbosnap from "vite-plugin-turbosnap";

const config: StorybookConfig = {
stories: ["../src/**/*.stories.@(ts|tsx)"],
Expand All @@ -12,6 +14,15 @@ const config: StorybookConfig = {
name: "@storybook/preact-vite",
options: {},
},
async viteFinal(config, { configType }) {
const isProduction = configType === "PRODUCTION";

return mergeConfig(config, {
plugins: isProduction
? [turbosnap({ rootDir: config.root ?? process.cwd() })]
: [],
});
},
docs: {
autodocs: "tag",
},
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"@testing-library/preact": "^3.2.3",
"@twind/preset-autoprefix": "^1.0.7",
"@twind/preset-tailwind": "^1.1.4",
"storybook": "^7.6.17"
"storybook": "^7.6.17",
"vite-plugin-turbosnap": "^1.0.3"
},
"typings": "lib/index.d.ts",
"dependencies": {
Expand Down

0 comments on commit 4844d0f

Please sign in to comment.