Skip to content

Commit

Permalink
Merge pull request #10 from vuejs-jp/feature/chromatic-deploy-test
Browse files Browse the repository at this point in the history
feat: chromatic
  • Loading branch information
jiyuujin authored Feb 15, 2024
2 parents f179524 + 86a82eb commit 079d9da
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 9 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHROMATIC_PROJECT_TOKEN=
33 changes: 33 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Chromatic CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
chromatic:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.19.0]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install packages
uses: ./.github/actions/install-packages

- name: Chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: packages/ui
exitZeroOnChanges: true
onlyChanged: true
Binary file modified bun.lockb
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/ui/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { mergeConfig } from 'vite'
import turbosnap from 'vite-plugin-turbosnap'

module.exports = {
stories: ['../components/**/*.stories.mdx', '../components/**/*.stories.@(js|ts)'],
addons: [
'@chromatic-com/storybook',
'@storybook/addon-a11y',
'@storybook/addon-backgrounds',
'@storybook/addon-essentials',
Expand All @@ -14,4 +18,12 @@ module.exports = {
},
},
},
async viteFinal(config, { configType }) {
return mergeConfig(config, {
plugins:
configType === 'PRODUCTION'
? [turbosnap({ rootDir: config.root ?? process.cwd() })]
: [],
})
},
}
1 change: 1 addition & 0 deletions packages/ui/chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"projectId":"Project:65c74499999b5699c4fe0bfc"}
19 changes: 11 additions & 8 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@
"lint-fix": "eslint . --ext js,jsx,ts,tsx,vue --ignore-path .eslintignore --fix"
},
"devDependencies": {
"@chromatic-com/storybook": "1.1.7",
"@nuxt/kit": "3.10.0",
"@storybook/addon-a11y": "7.6.12",
"@storybook/addon-backgrounds": "7.6.12",
"@storybook/addon-essentials": "7.6.12",
"@storybook/addon-links": "7.6.12",
"@storybook/builder-vite": "7.6.12",
"@storybook/vue3": "7.6.12",
"@storybook/vue3-vite": "7.6.12",
"@storybook/addon-a11y": "8.0.0-beta.2",
"@storybook/addon-backgrounds": "8.0.0-beta.2",
"@storybook/addon-essentials": "8.0.0-beta.2",
"@storybook/addon-links": "8.0.0-beta.2",
"@storybook/builder-vite": "8.0.0-beta.2",
"@storybook/vue3": "8.0.0-beta.2",
"@storybook/vue3-vite": "8.0.0-beta.2",
"@vitejs/plugin-vue": "5.0.3",
"@vuejs-jp/eslint-config": "workspace:*",
"@vuejs-jp/typescript-config": "workspace:*",
"storybook": "7.6.12",
"chromatic": "10.9.4",
"storybook": "8.0.0-beta.2",
"vite-plugin-turbosnap": "1.0.3",
"vue": "3.4.15",
"typescript": "5.3.3"
},
Expand Down
5 changes: 4 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": ["**/.env.*local"],
"globalDotEnv": [".env"],
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": [".nuxt/**", "!.nuxt/cache/**"]
"outputs": [".nuxt/**", "!.nuxt/cache/**"],
"dotEnv": [".env"]
},
"build-storybook": {
"dependsOn": ["^build-storybook"],
Expand All @@ -17,6 +19,7 @@
"dependsOn": ["^lint-fix"]
},
"dev": {
"dotEnv": [".env"],
"cache": false,
"persistent": true
}
Expand Down

0 comments on commit 079d9da

Please sign in to comment.