-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(web, sds): Storybook & Chromatic 세팅 (#59)
* chore: apps/web storybook init * storybook: 기본 컴포넌트 제거 및 Home 스토리북 추가 * chore: sds storybook init * chore: storybook log ignore * chore: rebase 이후 storybook lock 파일 변경사항 적용 * chore: Home, Button Storybook 작성 css prop 안 먹힘 react not defined 문제 * fix: eslint 에러 수정 * fix: react not defined, css props 오류 해결 * chore: pnpm 8.15.6 버전 적용 * refactor: storybook control 파라미터 추가 * feat: FirstFeatureOfFirstDomainTestButton Storybook 생성 * refactor: Props 오타 수정 * refactor: Storybook 디렉토리명 변경 * fix: FirstFeatureOfFirstDomainTestButton 'use client' 추가 * refactor: FirstFeatureOfFirstDomainTestButton client Component 적용 * refactor: 불필요한 use client 제거 * chore: chromatic 설정 * chore: chromatic deploy yml 작성 * refactor: chromatic yml log * refactor: chromatic yml log-2 * refactor: chromatic yml log-3 * refactor: chromatic yml deploy * refactor: chromatic yml deploy-2 * refactor: chromatic yml deploy-3 * refactor: chromatic yml deploy-4 * refactor: chromatic yml deploy-5 * refactor: chromatic yml deploy-6 * chore: chromatic deployment PR Comment * chore: chromatic deployment PR Comment-2 * chore: chromatic deployment PR Comment-3 * chore: chromatic deployment PR Comment-finally * chore: chromatic deployment PR Comment new line * chore: storybook sds port 번호 변경
- Loading branch information
1 parent
f847c12
commit 38a5435
Showing
17 changed files
with
7,208 additions
and
839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: 'Chromatic Deployment' | ||
|
||
on: | ||
pull_request: | ||
branches: [main, develop] | ||
paths: | ||
- '**.stories.tsx' | ||
|
||
jobs: | ||
chromatic-deployment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 8 | ||
|
||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache Dependencies | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}-storybook | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: pnpm install | ||
|
||
- name: Publish Project packages/core/sds to Chromatic | ||
id: chromatic-sds | ||
uses: chromaui/action@latest | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_SDS }} | ||
workingDir: packages/core/sds | ||
onlyChanged: true | ||
externals: packages/core/sds/assets/** | ||
|
||
- name: Publish Project apps/web to Chromatic | ||
id: chromatic-web | ||
uses: chromaui/action@latest | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_WEB }} | ||
workingDir: apps/web | ||
onlyChanged: true | ||
externals: packages/web-domains/assets/** | ||
|
||
- name: Storybook Deployment PR Comment | ||
uses: thollander/actions-comment-pull-request@v1 | ||
if: ${{ github.event_name == 'pull_request' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
with: | ||
message: | | ||
📣 SDS Storybook Deployment: ${{ steps.chromatic-sds.outputs.storybookUrl }} | ||
📣 Web Storybook Deployment: ${{ steps.chromatic-web.outputs.storybookUrl }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ yarn-error.log* | |
# Misc | ||
.DS_Store | ||
*.pem | ||
|
||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { StorybookConfig } from '@storybook/nextjs'; | ||
|
||
import { dirname, join } from 'path'; | ||
|
||
function getAbsolutePath(value: string): any { | ||
return dirname(require.resolve(join(value, 'package.json'))); | ||
} | ||
const config: StorybookConfig = { | ||
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
getAbsolutePath('@storybook/addon-onboarding'), | ||
getAbsolutePath('@storybook/addon-links'), | ||
getAbsolutePath('@storybook/addon-essentials'), | ||
getAbsolutePath('@chromatic-com/storybook'), | ||
getAbsolutePath('@storybook/addon-interactions'), | ||
], | ||
framework: { | ||
name: getAbsolutePath('@storybook/nextjs'), | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
staticDirs: ['../public'], | ||
swc: () => ({ | ||
jsc: { | ||
parser: { | ||
syntax: 'typescript', | ||
tsx: true, | ||
}, | ||
transform: { | ||
react: { | ||
runtime: 'automatic', | ||
importSource: '@emotion/react', | ||
}, | ||
}, | ||
}, | ||
}), | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
apps/web/stories/FirstFeatureOfFirstDomainTestButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { FirstFeatureOfFirstDomainTestButton } from '@sambad/web-domains/first-domain'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta = { | ||
title: 'Components/FirstFeatureOfFirstDomainTestButton', | ||
component: FirstFeatureOfFirstDomainTestButton, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
children: { | ||
control: 'text', | ||
description: 'FirstFeatureOfFirstDomainTestButton 컴포넌트가 표시할 내용을 정의합니다.', | ||
}, | ||
}, | ||
} satisfies Meta<typeof FirstFeatureOfFirstDomainTestButton>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
children: 'Button', | ||
}, | ||
render: (args) => <FirstFeatureOfFirstDomainTestButton {...args} />, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5'; | ||
|
||
import { dirname, join } from 'path'; | ||
|
||
function getAbsolutePath(value: string): any { | ||
return dirname(require.resolve(join(value, 'package.json'))); | ||
} | ||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
getAbsolutePath('@storybook/addon-webpack5-compiler-swc'), | ||
getAbsolutePath('@storybook/addon-onboarding'), | ||
getAbsolutePath('@storybook/addon-links'), | ||
getAbsolutePath('@storybook/addon-essentials'), | ||
getAbsolutePath('@chromatic-com/storybook'), | ||
getAbsolutePath('@storybook/addon-interactions'), | ||
], | ||
framework: { | ||
name: getAbsolutePath('@storybook/react-webpack5'), | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
swc: () => ({ | ||
jsc: { | ||
parser: { | ||
syntax: 'typescript', | ||
tsx: true, | ||
}, | ||
transform: { | ||
react: { | ||
runtime: 'automatic', | ||
importSource: '@emotion/react', | ||
}, | ||
}, | ||
}, | ||
}), | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Button } from '../components/Button'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta = { | ||
title: 'Components/Button', | ||
component: Button, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
children: { | ||
control: 'text', | ||
description: 'Button 컴포넌트가 표시할 내용을 정의합니다.', | ||
}, | ||
appName: { | ||
control: 'text', | ||
description: 'Button 컴포넌트를 click시 표시할 alert 내용을 정의합니다.', | ||
}, | ||
className: { | ||
control: 'text', | ||
description: 'Button 컴포넌트의 className을 정의합니다.', | ||
}, | ||
}, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
children: 'Button', | ||
appName: 'undefined', | ||
className: 'undefined', | ||
}, | ||
render: (args) => <Button {...args} />, | ||
}; |
6 changes: 4 additions & 2 deletions
6
.../web-domains/src/first-domain/features/components/FirstFeatureOfFirstDomainTestButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export { FirstDomainExampleScreen } from './screens/FirstDomainExampleScreen'; | ||
export { FirstFeatureOfFirstDomainTestButton } from './features/components/FirstFeatureOfFirstDomainTestButton'; | ||
export type { FirstFeatureOfFirstDomainTestButtonProps } from './features/components/FirstFeatureOfFirstDomainTestButton'; |
Oops, something went wrong.