Skip to content

chore: add a base directory for TurboSnap #9258

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

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ jobs:
# https://www.chromatic.com/docs/github-actions#forked-repositories
projectToken: 695c25b6cb65
workingDir: "./site"
storybookBaseDir: "./site"
# Prevent excessive build runs on minor version changes
skip: "@(renovate/**|dependabot/**)"
# Run TurboSnap to trace file dependencies to related stories
Expand All @@ -593,6 +594,7 @@ jobs:
buildScriptName: "storybook:build"
projectToken: 695c25b6cb65
workingDir: "./site"
storybookBaseDir: "./site"
# Run TurboSnap to trace file dependencies to related stories
# and tell chromatic to only take snapshots of relevent stories
onlyChanged: true
Expand Down
16 changes: 16 additions & 0 deletions site/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import turbosnap from "vite-plugin-turbosnap"
import { mergeConfig } from "vite"

module.exports = {
stories: ["../src/**/*.stories.tsx"],
addons: [
Expand All @@ -11,4 +14,17 @@ module.exports = {
name: "@storybook/react-vite",
options: {},
},
async viteFinal(config, { configType }) {
config.plugins = config.plugins || []
// return the customized config
if (configType === "PRODUCTION") {
// ignore @ts-ignore because it's not in the vite types yet
config.plugins.push(
turbosnap({
rootDir: config.root || "",
}),
)
}
return config
},
}
5 changes: 3 additions & 2 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"playwright:test": "playwright test --config=e2e/playwright.config.ts",
"gen:provisioner": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./e2e/ --ts_proto_opt=outputJsonMethods=false,outputEncodeMethods=encode-no-creation,outputClientImpl=false,nestJs=false,outputPartialMethods=false,fileSuffix=Generated,suffix=hey -I ../provisionersdk/proto ../provisionersdk/proto/provisioner.proto && pnpm exec prettier --ignore-path '/dev/null' --cache --write './e2e/provisionerGenerated.ts'",
"storybook": "STORYBOOK=true storybook dev -p 6006",
"storybook:build": "storybook build --webpack-stats-json",
"storybook:build": "storybook build",
"test": "jest --selectProjects test",
"test:ci": "jest --selectProjects test --silent",
"test:coverage": "jest --selectProjects test --collectCoverage",
Expand Down Expand Up @@ -172,7 +172,8 @@
"ts-node": "10.9.1",
"ts-proto": "1.156.0",
"typescript": "5.1.6",
"vite-plugin-checker": "0.6.0"
"vite-plugin-checker": "0.6.0",
"vite-plugin-turbosnap": "1.0.2"
},
"browserslist": [
"chrome 66",
Expand Down
7 changes: 7 additions & 0 deletions site/pnpm-lock.yaml

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