Skip to content

Commit 4c6dd44

Browse files
committed
feat: chromatic
1 parent f179524 commit 4c6dd44

File tree

6 files changed

+49
-1
lines changed

6 files changed

+49
-1
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHROMATIC_PROJECT_TOKEN=

.github/workflows/chromatic.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Chromatic CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
chromatic:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [18.19.0]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install packages
23+
uses: ./.github/actions/install-packages
24+
25+
- name: Chromatic
26+
uses: chromaui/action@latest
27+
with:
28+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
29+
workingDir: packages/ui
30+
exitZeroOnChanges: true
31+
onlyChanged: true

bun.lockb

992 Bytes
Binary file not shown.

packages/ui/.storybook/main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { mergeConfig } from 'vite'
2+
import turbosnap from 'vite-plugin-turbosnap'
3+
14
module.exports = {
25
stories: ['../components/**/*.stories.mdx', '../components/**/*.stories.@(js|ts)'],
36
addons: [
@@ -14,4 +17,12 @@ module.exports = {
1417
},
1518
},
1619
},
20+
async viteFinal(config, { configType }) {
21+
return mergeConfig(config, {
22+
plugins:
23+
configType === 'PRODUCTION'
24+
? [turbosnap({ rootDir: config.root ?? process.cwd() })]
25+
: [],
26+
})
27+
},
1728
}

packages/ui/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"@vitejs/plugin-vue": "5.0.3",
2222
"@vuejs-jp/eslint-config": "workspace:*",
2323
"@vuejs-jp/typescript-config": "workspace:*",
24+
"chromatic": "10.9.4",
2425
"storybook": "7.6.12",
26+
"vite-plugin-turbosnap": "1.0.3",
2527
"vue": "3.4.15",
2628
"typescript": "5.3.3"
2729
},

turbo.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"$schema": "https://turbo.build/schema.json",
33
"globalDependencies": ["**/.env.*local"],
4+
"globalDotEnv": [".env"],
45
"pipeline": {
56
"build": {
67
"dependsOn": ["^build"],
7-
"outputs": [".nuxt/**", "!.nuxt/cache/**"]
8+
"outputs": [".nuxt/**", "!.nuxt/cache/**"],
9+
"dotEnv": [".env"]
810
},
911
"build-storybook": {
1012
"dependsOn": ["^build-storybook"],
@@ -17,6 +19,7 @@
1719
"dependsOn": ["^lint-fix"]
1820
},
1921
"dev": {
22+
"dotEnv": [".env"],
2023
"cache": false,
2124
"persistent": true
2225
}

0 commit comments

Comments
 (0)