-
Notifications
You must be signed in to change notification settings - Fork 1
Chore/#1 storybook 및 chromatic 배포 설정 #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c88bde4
chore: pre-commit에서 lint-staged 대신 pnpm lint 사용하도록 변경하고 관련 설정 제거
leeleeleeleejun 6cb9f7f
chore: Storybook 초기 구성 및 chromatic 배포 설정
leeleeleeleejun 4f19015
chore: Chromatic 배포용 pnpm·Node.js 셋업 액션 추가
leeleeleeleejun 53ff76f
chore: Chromatic 배포 워크플로에 pnpm 및 Node.js 설정 수정
leeleeleeleejun 4017c63
chore: Chromatic 배포 워크플로 types에 synchronize 추가
leeleeleeleejun d8d2df1
chore: action.yml에서 pnpm 버전 설정 제거
leeleeleeleejun 87512a2
chore: action.yml에서 Node.js 버전을 22.17.0으로 업데이트
leeleeleeleejun 63f736f
chore: 스토리북 스크립트 및 출력 설정 수정
leeleeleeleejun 6079499
chore: deploy-chromatic.yml에 buildScriptName 및 onlyChanged 설정 추가
leeleeleeleejun adb7ef0
chore: packages/ui/public 폴더 생성
leeleeleeleejun eeb4fb3
chore: update actions-comment-pull-request to v2 in deploy-chromatic.yml
leeleeleeleejun 0d261ff
chore: deploy-chromatic.yml에 pull-requests 권한 추가
leeleeleeleejun 6ebc322
chore: deploy-chromatic.yml에 contents 권한 추가
leeleeleeleejun 40e04fe
chore: deploy-chromatic.yml에 autoAcceptChanges 설정 추가
leeleeleeleejun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,11 @@ | ||
| name: setup pnpm & node | ||
| description: setup pnpm & node | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - uses: pnpm/action-setup@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22.17.0 | ||
| cache: 'pnpm' | ||
| cache-dependency-path: 'pnpm-lock.yaml' |
This file contains hidden or 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,56 @@ | ||
| name: 'Deploy Chromatic' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize] | ||
| branches: | ||
| - main | ||
| - develop | ||
| - feat/** | ||
| paths: | ||
| - '**.stories.tsx' | ||
| - '**.stories.ts' | ||
| - '**.mdx' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| chromatic-deployment: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| WORKDIR: . | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js and pnpm | ||
| uses: ./.github/actions/pnpm-setup-node | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Publish Chromatic | ||
| id: chromatic | ||
| uses: chromaui/action@latest | ||
| with: | ||
| workingDir: apps/storybook | ||
| buildScriptName: build | ||
| autoAcceptChanges: true | ||
| onlyChanged: true | ||
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Comment PR with Storybook URL | ||
| uses: thollander/actions-comment-pull-request@v2 | ||
| with: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| message: '🚀storybook: ${{ steps.chromatic.outputs.storybookUrl }}' | ||
This file contains hidden or 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,44 @@ | ||
| # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
| /.pnp | ||
| .pnp.* | ||
| .yarn/* | ||
| !.yarn/patches | ||
| !.yarn/plugins | ||
| !.yarn/releases | ||
| !.yarn/versions | ||
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| # next.js | ||
| /.next/ | ||
| /out/ | ||
|
|
||
| # production | ||
| /build | ||
|
|
||
| # misc | ||
| .DS_Store | ||
| *.pem | ||
|
|
||
| # debug | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| .pnpm-debug.log* | ||
|
|
||
| # env files (can opt-in for committing if needed) | ||
| .env* | ||
|
|
||
| # vercel | ||
| .vercel | ||
|
|
||
| # typescript | ||
| *.tsbuildinfo | ||
| next-env.d.ts | ||
|
|
||
| *storybook.log | ||
| storybook-static |
This file contains hidden or 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,24 @@ | ||
| import type { StorybookConfig } from '@storybook/nextjs' | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: [ | ||
| '../stories/**/*.mdx', | ||
| '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)', | ||
| // '../../../packages/ui/src/**/*.stories.@(js|jsx|mjs|ts|tsx)', | ||
| ], | ||
| addons: [ | ||
| '@chromatic-com/storybook', | ||
| '@storybook/addon-docs', | ||
| '@storybook/addon-a11y', | ||
| ], | ||
| framework: { | ||
| name: '@storybook/nextjs', | ||
| options: {}, | ||
| }, | ||
| staticDirs: [ | ||
| '../../../packages/ui/public', // UI 컴포넌트용 리소스 | ||
| '../public', // Storybook 전용 리소스 | ||
| ], | ||
| } | ||
|
|
||
| export default config |
This file contains hidden or 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/nextjs' | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| controls: { | ||
| matchers: { | ||
| color: /(background|color)$/i, | ||
| date: /Date$/i, | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default preview; |
This file contains hidden or 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,18 @@ | ||
| import storybook from 'eslint-plugin-storybook' | ||
| import tseslint from 'typescript-eslint' | ||
|
|
||
| export default [ | ||
| // TypeScript 기본 설정 | ||
| ...tseslint.configs.recommended, | ||
|
|
||
| // Storybook 설정 | ||
| ...storybook.configs['flat/recommended'], | ||
|
|
||
| // 모든 TypeScript/JavaScript 파일에 적용 | ||
| { | ||
| files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx}'], | ||
| languageOptions: { | ||
| parser: tseslint.parser, | ||
| }, | ||
| }, | ||
| ] |
This file contains hidden or 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 @@ | ||
| { | ||
| "name": "storybook", | ||
| "version": "0.1.0", | ||
| "type": "module", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "storybook dev -p 6006", | ||
| "build": "storybook build" | ||
| }, | ||
| "dependencies": { | ||
| "@repo/ui": "workspace:^" | ||
| }, | ||
| "devDependencies": { | ||
| "@repo/eslint-config": "workspace:*", | ||
| "@repo/tailwind-config": "workspace:*", | ||
| "@repo/typescript-config": "workspace:*", | ||
| "@chromatic-com/storybook": "^4.1.0", | ||
| "@eslint/eslintrc": "^3", | ||
| "@storybook/addon-a11y": "^9.1.0", | ||
| "@storybook/addon-docs": "^9.1.0", | ||
| "@storybook/nextjs": "^9.1.0", | ||
| "@tailwindcss/postcss": "^4", | ||
| "@types/node": "^20", | ||
| "@types/react": "^19", | ||
| "@types/react-dom": "^19", | ||
| "@typescript-eslint/eslint-plugin": "^8.38.0", | ||
| "@typescript-eslint/parser": "^8.38.0", | ||
| "chromatic": "^13.1.3", | ||
| "eslint": "^9.32.0", | ||
| "eslint-config-next": "15.4.5", | ||
| "eslint-plugin-react": "^7.37.4", | ||
| "eslint-plugin-storybook": "^9.1.0", | ||
| "storybook": "^9.1.0", | ||
| "tailwindcss": "^4", | ||
| "typescript": "^5.8.2", | ||
| "typescript-eslint": "^8.37.0" | ||
| } | ||
| } | ||
|
|
||
|
|
This file contains hidden or 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,5 @@ | ||
| const config = { | ||
| plugins: ["@tailwindcss/postcss"], | ||
| }; | ||
|
|
||
| export default config; |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,54 @@ | ||
| import type { Meta, StoryObj } from '@storybook/nextjs'; | ||
|
|
||
| import { fn } from 'storybook/test'; | ||
|
|
||
| import { Button } from './Button'; | ||
|
|
||
| // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | ||
| const meta = { | ||
| title: 'Example/Button', | ||
| component: Button, | ||
| parameters: { | ||
| // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | ||
| layout: 'centered', | ||
| }, | ||
| // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
| tags: ['autodocs'], | ||
| // More on argTypes: https://storybook.js.org/docs/api/argtypes | ||
| argTypes: { | ||
| backgroundColor: { control: 'color' }, | ||
| }, | ||
| // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args | ||
| args: { onClick: fn() }, | ||
| } satisfies Meta<typeof Button>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
| export const Primary: Story = { | ||
| args: { | ||
| primary: true, | ||
| label: 'Button', | ||
| }, | ||
| }; | ||
|
|
||
| export const Secondary: Story = { | ||
| args: { | ||
| label: 'Button', | ||
| }, | ||
| }; | ||
|
|
||
| export const Large: Story = { | ||
| args: { | ||
| size: 'large', | ||
| label: 'Button', | ||
| }, | ||
| }; | ||
|
|
||
| export const Small: Story = { | ||
| args: { | ||
| size: 'small', | ||
| label: 'Button', | ||
| }, | ||
| }; |
This file contains hidden or 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,39 @@ | ||
| import './button.css'; | ||
|
|
||
| export interface ButtonProps { | ||
| /** Is this the principal call to action on the page? */ | ||
| primary?: boolean; | ||
| /** What background color to use */ | ||
| backgroundColor?: string; | ||
| /** How large should the button be? */ | ||
| size?: 'small' | 'medium' | 'large'; | ||
| /** Button contents */ | ||
| label: string; | ||
| /** Optional click handler */ | ||
| onClick?: () => void; | ||
| } | ||
|
|
||
| /** Primary UI component for user interaction */ | ||
| export const Button = ({ | ||
| primary = false, | ||
| size = 'medium', | ||
| backgroundColor, | ||
| label, | ||
| ...props | ||
| }: ButtonProps) => { | ||
| const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary'; | ||
| return ( | ||
| <button | ||
| type="button" | ||
| className={['storybook-button', `storybook-button--${size}`, mode].join(' ')} | ||
| {...props} | ||
| > | ||
| {label} | ||
| <style jsx>{` | ||
| button { | ||
| background-color: ${backgroundColor}; | ||
| } | ||
| `}</style> | ||
leeleeleeleejun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </button> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.