Skip to content

Commit

Permalink
Merge pull request #115 from chromaui/setup-turbosnap
Browse files Browse the repository at this point in the history
Setup TurboSnap
  • Loading branch information
ghengeveld authored Sep 22, 2023
2 parents 50cc103 + a91e3de commit c982f99
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
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 @@ -120,6 +120,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
4 changes: 4 additions & 0 deletions production.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"autoAcceptChanges": "main",
"exitOnceUploaded": true,
"externals": ["public/**"],
"onlyChanged": true,
"projectId": "Project:6480e1b0042842f149cfd74c",
"projectToken": "chpt_5a1a378a1392c49",
"zip": true
Expand Down
4 changes: 4 additions & 0 deletions staging.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"autoAcceptChanges": "main",
"exitOnceUploaded": true,
"externals": ["public/**"],
"onlyChanged": true,
"projectToken": "chpt_fdc053b44dc78f3",
"projectId": "Project:64936c844fd570be8b75bdac",
"zip": true
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13127,6 +13127,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

0 comments on commit c982f99

Please sign in to comment.