Skip to content
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

⚙️ storybook 파이프라인 구축 #4

Merged
merged 14 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
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"
]
}
7 changes: 6 additions & 1 deletion .github/workflows/install-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ jobs:
run: pnpm lint

- name: Unit & Integration test
run: pnpm test
run: pnpm test

storybook-deployment:
needs: install-and-test
uses: ./.github/workflows/storybook-deployment.yml
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/storybook-deployment.yml
BangDori marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: storybook-deployment

on:
workflow_call:

jobs:
storybook-deployment:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- 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: deploy storybook on chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
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/**/*.stories.@(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',
BangDori marked this conversation as resolved.
Show resolved Hide resolved
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()
BangDori marked this conversation as resolved.
Show resolved Hide resolved

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