-
Notifications
You must be signed in to change notification settings - Fork 1
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
스토리북 및 크로마틱 자동 배포 워크플로우 추가 셋업 #11
Changes from all commits
f4acfeb
2a3c3cd
6ca1224
1e8734f
89d045e
7092e4d
313a252
7e3a5d5
2f0c826
ad23469
7f58620
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @froggy1014 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# .github/workflows/chromatic.yml | ||
name: "Chromatic Deployment" | ||
run-name: Storybook deployment by ${{ github.actor }} | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
paths: | ||
- "**.stories.tsx" | ||
|
||
jobs: | ||
chromatic: | ||
name: Run Chromatic Deployment | ||
# Operating System | ||
runs-on: ubuntu-latest | ||
outputs: | ||
status: ${{ job.status }} | ||
|
||
# Job steps | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
version: 9 | ||
run_install: false | ||
|
||
- name: Set up Node.js version | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
cache: "pnpm" | ||
cache-dependency-path: "**/pnpm-lock.yaml" | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run Chromatic | ||
id: chromatic | ||
uses: chromaui/action@latest | ||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
buildScriptName: build-storybook | ||
onlyChanged: true | ||
|
||
- name: comment PR | ||
uses: thollander/actions-comment-pull-request@v1 | ||
if: ${{ github.event_name == 'pull_request' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
message: "💅 ## storybook-URL - ${{ steps.chromatic.outputs.storybookUrl }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { StorybookConfig } from "@storybook/nextjs"; | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-onboarding", | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
"@storybook/addon-interactions", | ||
], | ||
framework: { | ||
name: "@storybook/nextjs", | ||
options: {}, | ||
}, | ||
staticDirs: ["../public"], | ||
|
||
typescript: { | ||
reactDocgen: "react-docgen-typescript", | ||
}, | ||
}; | ||
export default config; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Preview } from "@storybook/react"; | ||
import "../src/styles/globals.css"; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
Comment on lines
+4
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제가 emotion으로만 스토리북을 구상 해봤어서 그런데 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrapper Component가 추가된다면 어떤 경우인지 혹시 알려주실 수 있나요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Root.tsx 생각하시면 이해하기 편해요~ const ThemeWrapper = ({ children }) => (
<ThemeProvider theme={theme}>
<Global styles={global} />
{children}
</ThemeProvider>
)
export const decorators = [(renderStory) => <ThemeWrapper>{renderStory()}</ThemeWrapper>] 스토리북에서도 Root 단에 필요한 로직이나 스타일링이 있다면 preview를 JSX 문법으로 활용할 수 있다는 의미였어요! |
||
|
||
export default preview; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,13 @@ | |
"lint": "next lint", | ||
"prepare": "husky", | ||
"cz": "cz", | ||
"formatting": "prettier --write '**/*.{ts,tsx}' && eslint --fix ." | ||
"formatting": "prettier --write '**/*.{ts,tsx}' && eslint --fix .", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3 사소하지만 prettier를 format, lint를 lint 스크립트로 분리하는 것도 추천드려요! 추가로 next lint 스크립트도 사용하지 않는다면 제거하거나 eslint로 오버라이딩 하면 좋겠네요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 호오...! 반영하겠습니다 감사합니다. |
||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"dependencies": { | ||
"@radix-ui/react-navigation-menu": "^1.2.0", | ||
"@radix-ui/themes": "^3.1.1", | ||
"@tanstack/react-query": "^5.50.1", | ||
"@tanstack/react-query-devtools": "^5.50.1", | ||
"clsx": "^2.1.1", | ||
|
@@ -26,6 +29,15 @@ | |
"zustand": "^4.5.4" | ||
}, | ||
"devDependencies": { | ||
"@chromatic-com/storybook": "^1.6.1", | ||
"@storybook/addon-essentials": "^8.2.6", | ||
"@storybook/addon-interactions": "^8.2.6", | ||
"@storybook/addon-links": "^8.2.6", | ||
"@storybook/addon-onboarding": "^8.2.6", | ||
"@storybook/blocks": "^8.2.6", | ||
"@storybook/nextjs": "^8.2.6", | ||
"@storybook/react": "^8.2.6", | ||
"@storybook/test": "^8.2.6", | ||
"@t3-oss/env-nextjs": "^0.10.1", | ||
"@tanstack/eslint-plugin-query": "^5.50.1", | ||
"@types/node": "^20", | ||
|
@@ -35,6 +47,7 @@ | |
"@typescript-eslint/eslint-plugin": "^7.16.0", | ||
"@typescript-eslint/parser": "^7.16.0", | ||
"autoprefixer": "^10.4.19", | ||
"chromatic": "^11.5.6", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"cz-customizable": "^7.1.0", | ||
"eslint": "^8.57.0", | ||
|
@@ -44,12 +57,14 @@ | |
"eslint-plugin-react": "^7.34.3", | ||
"eslint-plugin-react-hooks": "^4.6.2", | ||
"eslint-plugin-simple-import-sort": "^12.1.1", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"eslint-plugin-tailwindcss": "^3.17.4", | ||
"eslint-plugin-unused-imports": "^3.2.0", | ||
"husky": "^9.0.11", | ||
"jiti": "^1.21.6", | ||
"postcss": "^8", | ||
"prettier": "^3.3.2", | ||
"storybook": "^8.2.6", | ||
"tailwindcss": "^3.4.6", | ||
"typescript": "^5" | ||
}, | ||
|
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.
필수 애드온은 잘 정의되어 있네요!
이외 config 코드도 이견 없습니다~