-
Notifications
You must be signed in to change notification settings - Fork 0
storybook / chromatic 배포 #6
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
13 commits
Select commit
Hold shift + click to select a range
1338ecc
chore: 스토리북 설치
hongggyelim bc5de48
chore: 크로매틱 배포
hongggyelim 0e43aa3
chore: node, pnpm version 관리
jongjunpark 41847c4
docs: version 관리 readme에 작성
jongjunpark f4f2a00
chore: husky, lint-staged 설치 및 설정
jongjunpark 2459f9d
feat: husky로 precommit 셋업
jongjunpark 925d479
feat: chromatic deploy gitaction 추가
jongjunpark e458c66
chore: storybook yml 수정
jongjunpark 01573d2
chore: test를 위해 path 제거
jongjunpark 8e84b02
feat: storybook에 필요한것만 남기고 다 변경, vite로 변경
jongjunpark b0562b1
chore: lint 잘못 설정된 것 수정
jongjunpark d136bf4
chore: root에 storybook 명령어 추가
jongjunpark 7fab52a
chore: storybook 예제 추가
jongjunpark 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,46 @@ | ||
| name: 'storybook Chromatic 배포' | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - set/storybook | ||
| # - main # 메인 브랜치에 푸시될 때 실행 | ||
| # paths: | ||
| # - 'apps/storybook/**' | ||
|
|
||
| jobs: | ||
| storybook-deploy: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./ | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: 9.10.0 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| cache: "pnpm" | ||
| cache-dependency-path: "pnpm-lock.yaml" | ||
| node-version-file: ".nvmrc" | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build Storybook | ||
| run: pnpm --filter storybook build-storybook | ||
|
|
||
| - name: publish to chromatic | ||
| id: chromatic | ||
| continue-on-error: true | ||
| uses: chromaui/action@v1 | ||
| with: | ||
| projectToken: ${{ secrets.CHROMATIC_TOKEN }} | ||
| onlyChanged: true | ||
| externals: apps/** | ||
| workingDir: apps/storybook |
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 |
|---|---|---|
|
|
@@ -36,3 +36,6 @@ yarn-error.log* | |
| # Misc | ||
| .DS_Store | ||
| *.pem | ||
|
|
||
| # storybook | ||
| 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,5 @@ | ||
| # lockfile check | ||
| (git add **/package.json pnpm-lock.yaml && pnpm install --frozen-lockfile > /dev/null) || (echo "\nMFE - lockfile 이 최신이 아닙니다. 'pnpm install'로 lockfile 을 업데이트 해주세요\n" && exit 1) | ||
|
|
||
| # lint check | ||
| npx lint-staged || (echo "\n MFE - lint에 맞게 코드를 수정해주세요.\n" && exit 1) |
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 @@ | ||
| 20.16.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 |
|---|---|---|
| @@ -1,84 +1,72 @@ | ||
| # Turborepo starter | ||
| # Date Project (가제) | ||
|
|
||
| This Turborepo starter is maintained by the Turborepo core team. | ||
| ## 개발 환경 설정 | ||
|
|
||
| ## Using this example | ||
| ### Node.js 버전 관리 | ||
|
|
||
| Run the following command: | ||
| 이 프로젝트는 Node.js 버전 관리를 위해 `.nvmrc` 파일을 사용합니다. 현재 프로젝트는 Node.js 20.16.0 버전을 사용합니다. | ||
|
|
||
| ```sh | ||
| npx create-turbo@latest | ||
| ``` | ||
|
|
||
| ## What's inside? | ||
|
|
||
| This Turborepo includes the following packages/apps: | ||
|
|
||
| ### Apps and Packages | ||
| nvm(Node Version Manager)이 설치되어 있다면 다음 명령어로 올바른 Node.js 버전을 설정할 수 있습니다: | ||
|
|
||
| - `docs`: a [Next.js](https://nextjs.org/) app | ||
| - `web`: another [Next.js](https://nextjs.org/) app | ||
| - `@repo/ui`: a stub React component library shared by both `web` and `docs` applications | ||
| - `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`) | ||
| - `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo | ||
| ```bash | ||
| nvm use | ||
| ``` | ||
|
|
||
| Each package/app is 100% [TypeScript](https://www.typescriptlang.org/). | ||
| nvm이 설치되어 있지 않다면 [nvm 설치 가이드](https://github.com/nvm-sh/nvm#installing-and-updating)를 참조하세요. | ||
|
|
||
| ### Utilities | ||
| ### pnpm 패키지 관리 | ||
|
|
||
| This Turborepo has some additional tools already setup for you: | ||
| 이 프로젝트는 패키지 관리를 위해 pnpm을 사용하며, package.json의 `packageManager` 필드를 통해 pnpm 버전(9.10.0)을 관리합니다. Node.js 18 이상에서 제공되는 corepack을 사용하면 별도의 pnpm 설치 없이 프로젝트에 맞는 버전을 자동으로 사용할 수 있습니다. | ||
|
|
||
| - [TypeScript](https://www.typescriptlang.org/) for static type checking | ||
| - [ESLint](https://eslint.org/) for code linting | ||
| - [Prettier](https://prettier.io) for code formatting | ||
| corepack 활성화: | ||
|
|
||
| ### Build | ||
| ```bash | ||
| corepack enable | ||
| ``` | ||
|
|
||
| To build all apps and packages, run the following command: | ||
| corepack을 활성화하면 package.json의 `packageManager` 필드에 지정된 pnpm 버전(9.10.0)이 자동으로 사용됩니다. 수동으로 설정하려면: | ||
|
|
||
| ``` | ||
| cd my-turborepo | ||
| pnpm build | ||
| ```bash | ||
| corepack prepare [email protected] --activate | ||
| ``` | ||
|
|
||
| ### Develop | ||
| ### Git 훅 설정 | ||
|
|
||
| To develop all apps and packages, run the following command: | ||
| 이 프로젝트는 husky를 사용하여 Git 훅을 관리하고, lint-staged를 통해 커밋 전 코드 품질 검사를 수행합니다. | ||
|
|
||
| ``` | ||
| cd my-turborepo | ||
| pnpm dev | ||
| - **pre-commit**: 커밋 전에 변경된 파일에 대해 린트 및 포맷 검사를 수행합니다. | ||
|
|
||
| ```bash | ||
| # Git 훅이 설정되지 않은 경우 실행 | ||
| pnpm prepare | ||
| ``` | ||
|
|
||
| ### Remote Caching | ||
| lint-staged 설정은 다음과 같습니다: | ||
|
|
||
| > [!TIP] | ||
| > Vercel Remote Cache is free for all plans. Get started today at [vercel.com](https://vercel.com/signup?/signup?utm_source=remote-cache-sdk&utm_campaign=free_remote_cache). | ||
| - JavaScript/TypeScript 파일: ESLint 및 Prettier 적용 | ||
| - JSON/CSS/MD 파일: Prettier 적용 | ||
|
|
||
| Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines. | ||
| ### 프로젝트 설정 | ||
|
|
||
| By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup?utm_source=turborepo-examples), then enter the following commands: | ||
| 의존성 설치: | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| ``` | ||
| cd my-turborepo | ||
| npx turbo login | ||
| ``` | ||
|
|
||
| This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview). | ||
|
|
||
| Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo: | ||
| 개발 서버 실행: | ||
|
|
||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
| npx turbo link | ||
| ``` | ||
|
|
||
| ## Useful Links | ||
| ## 모노레포 구조 | ||
|
|
||
| 이 프로젝트는 Turborepo를 사용한 모노레포로 구성되어 있으며, pnpm workspace를 통해 패키지를 관리합니다. 주요 디렉토리 구조는 다음과 같습니다: | ||
|
|
||
| Learn more about the power of Turborepo: | ||
| - `apps/`: 애플리케이션 코드가 있는 디렉토리 | ||
| - `storybook/`: 컴포넌트 문서화를 위한 스토리북 | ||
| - 기타 애플리케이션 | ||
| - `packages/`: 공유 패키지가 있는 디렉토리 | ||
|
|
||
| - [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks) | ||
| - [Caching](https://turbo.build/repo/docs/core-concepts/caching) | ||
| - [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) | ||
| - [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering) | ||
| - [Configuration Options](https://turbo.build/repo/docs/reference/configuration) | ||
| - [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference) | ||
| ## 기타 정보 |
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,23 @@ | ||
| import type { StorybookConfig } from "@storybook/react-vite"; | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ["../../../packages/ui/src/**/*.stories.@(js|jsx|ts|tsx)"], | ||
| addons: [ | ||
| "@storybook/addon-links", | ||
| "@storybook/addon-essentials", | ||
| "@storybook/addon-interactions", | ||
| ], | ||
| framework: { | ||
| name: "@storybook/react-vite", | ||
| options: {}, | ||
| }, | ||
| typescript: { | ||
| reactDocgen: "react-docgen", | ||
| skipCompiler: true, | ||
| }, | ||
| docs: { | ||
| autodocs: true, | ||
| }, | ||
| }; | ||
|
|
||
| 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/react' | ||
|
|
||
| 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,35 @@ | ||
| { | ||
| "name": "storybook", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "storybook dev -p 6006", | ||
| "build-storybook": "storybook build" | ||
| }, | ||
| "dependencies": { | ||
| "react": "^19", | ||
| "react-dom": "^19" | ||
| }, | ||
| "devDependencies": { | ||
| "@chromatic-com/storybook": "3.2.5", | ||
| "@storybook/addon-essentials": "8.6.4", | ||
| "@storybook/addon-interactions": "8.6.4", | ||
| "@storybook/addon-links": "8.6.4", | ||
| "@storybook/blocks": "8.6.4", | ||
| "@storybook/core-common": "8.6.4", | ||
| "@storybook/manager-api": "8.6.4", | ||
| "@storybook/preview-api": "^8.3.3", | ||
| "@storybook/react": "8.6.4", | ||
| "@storybook/react-vite": "8.6.4", | ||
| "@storybook/theming": "8.6.4", | ||
| "@types/node": "^20", | ||
| "@types/react": "^19", | ||
| "@types/react-dom": "^19", | ||
| "@vitejs/plugin-react-swc": "^3.8.0", | ||
| "chromatic": "^11.27.0", | ||
| "postcss": "^8", | ||
| "storybook": "8.6.4", | ||
| "typescript": "^5", | ||
| "vite": "^6.2.1" | ||
| } | ||
| } |
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,21 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "lib": ["dom", "dom.iterable", "esnext"], | ||
| "allowJs": true, | ||
| "skipLibCheck": true, | ||
| "strict": true, | ||
| "noEmit": true, | ||
| "esModuleInterop": true, | ||
| "module": "esnext", | ||
| "moduleResolution": "bundler", | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "jsx": "preserve", | ||
| "incremental": true, | ||
| "paths": { | ||
| "@/*": ["./src/*"] | ||
| } | ||
| }, | ||
| "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], | ||
| "exclude": ["node_modules"] | ||
| } |
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,7 @@ | ||
| import react from "@vitejs/plugin-react-swc"; | ||
| import { defineConfig } from "vite"; | ||
|
|
||
| // https://vitejs.dev/config/ | ||
| export default defineConfig({ | ||
| plugins: [react()], | ||
| }); |
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
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
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,35 @@ | ||
| .btn-primary { | ||
| background-color: #3b82f6; | ||
| color: white; | ||
| padding: 0.5rem 1rem; | ||
| border-radius: 0.375rem; | ||
| font-weight: 500; | ||
| transition: background-color 0.2s; | ||
| } | ||
|
|
||
| .btn-primary:hover { | ||
| background-color: #2563eb; | ||
| } | ||
|
|
||
| .btn-secondary { | ||
| background-color: #6b7280; | ||
| color: white; | ||
| padding: 0.5rem 1rem; | ||
| border-radius: 0.375rem; | ||
| font-weight: 500; | ||
| transition: background-color 0.2s; | ||
| } | ||
|
|
||
| .btn-secondary:hover { | ||
| background-color: #4b5563; | ||
| } | ||
|
|
||
| .btn-large { | ||
| padding: 0.75rem 1.5rem; | ||
| font-size: 1.125rem; | ||
| } | ||
|
|
||
| .btn-small { | ||
| padding: 0.25rem 0.5rem; | ||
| font-size: 0.875rem; | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거버전은 왜낮춘거야?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint-plugin-storybook에서 타입스크립트 버전 호환 이슈로 ..
typescript@">=4.8.4 <5.8.0