Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup TurboSnap #115

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ jobs:
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
externals: |
- 'public/**'
onlyChanged: true
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
12 changes: 11 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { StorybookConfig } from "@storybook/react-vite";
import { mergeConfig } from "vite";
import turbosnap from "vite-plugin-turbosnap";

import { CHROMATIC_BASE_URL } from "../src/constants";

const useDistVersion = process.env.CHROMATIC_USE_DIST_VERSION === "true";
Expand Down Expand Up @@ -34,14 +37,21 @@ const config: StorybookConfig = {
name: "@storybook/react-vite",
options: {},
},
logLevel: "debug",
staticDirs: ["../public"],
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
logLevel: "debug",
refs: {
"@storybook/components": {
title: "@storybook/components",
url: "https://next--635781f3500dd2c49e189caf.chromatic.com",
},
},
async viteFinal(config, { configType }) {
const rootDir = config.root ?? process.cwd();
return mergeConfig(config, {
plugins: configType === "PRODUCTION" ? [turbosnap({ rootDir })] : [],
});
},
};

export default config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"typescript": "^4.9.5",
"vite": "^4.1.4",
"vite-plugin-environment": "^1.1.3",
"vite-plugin-turbosnap": "^1.0.3",
"zx": "^1.14.1"
},
"peerDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13119,6 +13119,11 @@ vite-plugin-environment@^1.1.3:
resolved "https://registry.yarnpkg.com/vite-plugin-environment/-/vite-plugin-environment-1.1.3.tgz#d01a04abb2f69730a4866c9c9db51d3dab74645b"
integrity sha512-9LBhB0lx+2lXVBEWxFZC+WO7PKEyE/ykJ7EPWCq95NEcCpblxamTbs5Dm3DLBGzwODpJMEnzQywJU8fw6XGGGA==

vite-plugin-turbosnap@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/vite-plugin-turbosnap/-/vite-plugin-turbosnap-1.0.3.tgz#5519bc7b5f8e9c589e8d11fb6b053ec086f41f0a"
integrity sha512-p4D8CFVhZS412SyQX125qxyzOgIFouwOcvjZWk6bQbNPR1wtaEzFT6jZxAjf1dejlGqa6fqHcuCvQea6EWUkUA==

vite@^4.1.4:
version "4.4.9"
resolved "https://registry.yarnpkg.com/vite/-/vite-4.4.9.tgz#1402423f1a2f8d66fd8d15e351127c7236d29d3d"
Expand Down
Loading