Skip to content

Commit

Permalink
feat: Storybook 세팅 및 storybook ci yml 파일 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
suhwan2004 committed Oct 11, 2024
1 parent 3b3c8ec commit da1fa24
Show file tree
Hide file tree
Showing 11 changed files with 23,458 additions and 5,289 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"extends": ["next/core-web-vitals", "next/typescript", "prettier"]
"extends": [
"next/core-web-vitals",
"next/typescript",
"prettier",
"plugin:storybook/recommended"
]
}
33 changes: 33 additions & 0 deletions .github/workflows/storybook-test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: storybook-test-and-deploy

on: push

jobs:
ui-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install node modules
run: pnpm install

- name: Lint
run: pnpm lint

- name: deploy storybook&chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: "main"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

*storybook.log
/storybook-static
*.log
27 changes: 27 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { StorybookConfig } from '@storybook/nextjs';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
'@storybook/addon-viewport',
'@storybook/addon-designs',
{
name: '@storybook/addon-storysource',
options: {
loaderOptions: {
injectStoryParameters: false,
},
},
},
],
framework: {
name: '@storybook/nextjs',
options: {},
},
};
export default config;
26 changes: 26 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Preview } from '@storybook/react';
import { INITIAL_VIEWPORTS, MINIMAL_VIEWPORTS } from '@storybook/addon-viewport';
import '../app/globals.css';
// import {initialize, mswLoader} from "msw-storybook-addon"
// initialize()

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
viewport: {
viewports: {
...INITIAL_VIEWPORTS,
...MINIMAL_VIEWPORTS,
},
defaultViewport: 'iphone14promax',
},
},
// loaders : [mswLoader]
};

export default preview;
5 changes: 5 additions & 0 deletions chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"onlyChanged": true,
"projectId": "Project:670940cc682aa6d10aa4f523",
"zip": true
}
Loading

0 comments on commit da1fa24

Please sign in to comment.