Skip to content

Commit

Permalink
chore: 스토리북 및 테스트 환경 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
brgndyy committed Jul 20, 2024
1 parent e51ea99 commit 524b992
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/front_storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Chromatic"

on:
pull_request:
branches:
- main

jobs:
chromatic:
name: Run Chromatic
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20.15.1
- name: Install dependencies
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment.
run: npm ci
- name: Run Chromatic
uses: chromaui/action@latest
with:
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ node_modules
.DS_Store
dist
settings.json

*storybook.log
38 changes: 38 additions & 0 deletions frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { StorybookConfig } from '@storybook/react-webpack5';
const path = require('path');

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-webpack5-compiler-swc',
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
'@storybook/addon-themes'
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
swc: () => ({
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
}),
webpackFinal: async (config) => {
if (config.resolve) {
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, '../src'),
};
}
return config;
},
};
export default config;
27 changes: 27 additions & 0 deletions frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Preview } from '@storybook/react';
import GlobalStyle from '../src/styles/GlobalStyle';
import React from 'react';
import { GlobalLayout } from '../src/styles/GlobalLayout';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
layout: 'centered',
},
};

export const decorators = [
(Story) => (
<GlobalLayout>
<GlobalStyle />
<Story />
</GlobalLayout>
),
];

export default preview;

0 comments on commit 524b992

Please sign in to comment.