-
Notifications
You must be signed in to change notification settings - Fork 1
Setting(project): GitHub Actions CI (lint/build) 설정 #13
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
Changes from 11 commits
a62d43d
85aa785
3125dc0
85b8327
1466817
b3d18d5
85b2bb2
f165f2f
b4ecf59
ce7c41f
8770489
369b43d
7e93f78
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,52 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| name: ci | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - develop | ||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - develop | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| lint: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Extract Node.js version from package.json | ||||||||||||||||||||||||||||||||||||||||||||||||||
| id: get_node_version | ||||||||||||||||||||||||||||||||||||||||||||||||||
| run: echo "version=$(jq -r '.engines.node' package.json)" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| node-version: ${{ steps.get_node_version.outputs.version }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+26
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. 🛠️ Refactor suggestion 엔진 필드(engines.node)가 범위(>=, ^, ~ 등)일 때 setup-node가 실패할 수 있습니다 package.json의 engines.node가 범위 표현이면 actions/setup-node가 버전을 해석하지 못해 잡이 바로 실패합니다. .nvmrc가 있으면 우선 사용하고, 없거나 범위면 lts/*로 폴백하도록 보강하는 편이 안전합니다. 다음과 같이 step 스크립트를 보강해 주세요. - - name: Extract Node.js version from package.json
- id: get_node_version
- run: echo "version=$(jq -r '.engines.node' package.json)" >> $GITHUB_OUTPUT
+ - name: Extract Node.js version (prefer .nvmrc, fallback to engines.node or lts/*)
+ id: get_node_version
+ run: |
+ version=""
+ if [ -f .nvmrc ]; then
+ version="$(cat .nvmrc)"
+ else
+ version="$(jq -r '.engines.node // empty' package.json)"
+ fi
+ if [ -z "$version" ] || [[ "$version" =~ [><=\^~] ]]; then
+ version="lts/*"
+ fi
+ echo "version=$version" >> "$GITHUB_OUTPUT"추가로 setup-node가 같은 값을 사용합니다(아래 캐시 제안과 함께 반영 권장). 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Pnpm | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: pnpm/action-setup@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: pnpm install --frozen-lockfile | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run ESLint | ||||||||||||||||||||||||||||||||||||||||||||||||||
| run: pnpm run lint | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Extract Node.js version from package.json | ||||||||||||||||||||||||||||||||||||||||||||||||||
| id: get_node_version | ||||||||||||||||||||||||||||||||||||||||||||||||||
| run: echo "version=$(jq -r '.engines.node' package.json)" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| node-version: ${{ steps.get_node_version.outputs.version }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+40
to
+47
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. 🛠️ Refactor suggestion build 잡도 Node 버전 추출 로직 동일 이슈 lint 잡과 동일하게 build 잡에서도 engines.node가 범위면 실패할 수 있습니다. 동일한 폴백 로직을 적용해 주세요. - - name: Extract Node.js version from package.json
- id: get_node_version
- run: echo "version=$(jq -r '.engines.node' package.json)" >> $GITHUB_OUTPUT
+ - name: Extract Node.js version (prefer .nvmrc, fallback to engines.node or lts/*)
+ id: get_node_version
+ run: |
+ version=""
+ if [ -f .nvmrc ]; then
+ version="$(cat .nvmrc)"
+ else
+ version="$(jq -r '.engines.node // empty' package.json)"
+ fi
+ if [ -z "$version" ] || [[ "$version" =~ [><=\^~] ]]; then
+ version="lts/*"
+ fi
+ echo "version=$version" >> "$GITHUB_OUTPUT"그리고 setup-node에도 캐시 옵션을 함께 추가하는 것을 권장합니다(아래 diff). 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Pnpm | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: pnpm/action-setup@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: pnpm install --frozen-lockfile | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: pnpm run build | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| @import '@pinback/tailwind-config/shared-styles.css'; | ||
| @import '@pinback/design-system/styles'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import config from '@pinback/eslint-config/react-internal'; | ||
| import reactRefresh from 'eslint-plugin-react-refresh'; | ||
|
|
||
| /** @type {import("eslint").Linter.Config} */ | ||
| export default [...config, reactRefresh.configs.vite]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,10 +13,15 @@ | |
| "dependencies": { | ||
| "@pivanov/vite-plugin-svg-sprite": "^3.1.3", | ||
| "@tanstack/react-query": "^5.85.3", | ||
| "react": "^18.3.1", | ||
| "react-dom": "^18.3.1" | ||
| "react": "^19.1.1", | ||
| "react-dom": "^19.1.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@eslint/js": "^9.33.0", | ||
| "@pinback/eslint-config": "workspace:*", | ||
| "@pinback/typescript-config": "workspace:*", | ||
| "@pinback/tailwind-config": "workspace:*", | ||
| "@pinback/design-system": "workspace:*", | ||
|
||
| "@crxjs/vite-plugin": "^2.2.0", | ||
| "@tailwindcss/vite": "^4.1.12", | ||
| "@types/chrome": "^0.0.273", | ||
|
|
@@ -25,10 +30,11 @@ | |
| "@vitejs/plugin-react": "^4.3.1", | ||
|
||
| "@vitejs/plugin-react-swc": "^4.0.0", | ||
| "autoprefixer": "^10.4.21", | ||
| "eslint": "^9.9.0", | ||
| "eslint": "^9.33.0", | ||
| "eslint-plugin-react-hooks": "^5.2.0", | ||
| "eslint-plugin-react-refresh": "^0.4.20", | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "eslint-plugin-jsx-a11y": "^6.9.0", | ||
| "eslint-plugin-react": "^7.35.0", | ||
| "postcss": "^8.5.6", | ||
| "prettier": "^3.3.3", | ||
| "prettier-plugin-tailwindcss": "^0.6.8", | ||
| "tailwindcss": "^4.1.12", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @import '@pinback/tailwind-config/shared-styles.css'; | ||
| @import '@pinback/design-system/styles'; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| @import '@pinback/tailwind-config/shared-styles.css'; | ||
| @import '@pinback/design-system/styles'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { config } from "@pinback/eslint-config/react-internal"; | ||
| import config from '@pinback/eslint-config/react-internal'; | ||
|
|
||
| /** @type {import("eslint").Linter.Config} */ | ||
| export default config; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| { | ||
| "name": "@pinback/design-system", | ||
| "version": "0.0.0", | ||
| "type": "module", | ||
| "private": true, | ||
| "exports": { | ||
| "./ui": "./src/components/index.ts", | ||
|
|
@@ -18,12 +19,17 @@ | |
| "@pinback/eslint-config": "workspace:*", | ||
| "@pinback/tailwind-config": "workspace:*", | ||
| "@pinback/typescript-config": "workspace:*", | ||
| "@tailwindcss/vite": "^4.1.11", | ||
| "@vitejs/plugin-react": "^4.5.2", | ||
| "@turbo/gen": "^2.5.0", | ||
| "@types/node": "^22.15.3", | ||
| "@types/react": "19.1.0", | ||
| "@types/react-dom": "19.1.1", | ||
| "eslint": "^9.33.0", | ||
| "tailwindcss": "^4.1.12", | ||
| "typescript": "5.9.2" | ||
| "typescript": "5.9.2", | ||
| "typescript-eslint": "^8.39.1", | ||
| "vite": "^7.1.2" | ||
|
Comment on lines
+30
to
+32
Collaborator
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. 이것도 질문인데
Member
Author
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.
그래서 해당 문제를 해결하려면
Collaborator
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. 아티클 읽어보겠습니다! 레퍼런스 감사합니다 |
||
| }, | ||
|
||
| "dependencies": { | ||
| "@radix-ui/react-slot": "^1.2.3", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import tailwindcss from '@tailwindcss/vite'; | ||
| import react from '@vitejs/plugin-react'; | ||
| import path from 'path'; | ||
| import { defineConfig } from 'vite'; | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [react(), tailwindcss()], | ||
| resolve: { | ||
| alias: { | ||
| '@': path.resolve(__dirname, 'src'), | ||
| '@utils': path.resolve(__dirname, './src/utils'), | ||
|
Comment on lines
+10
to
+11
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. ESM에서 __dirname은 정의되지 않음 — Vite 실행 시 ReferenceError 현재 파일은 ESM(패키지 type: module)인데 적용 제안: import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import path from 'path';
+import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@utils': path.resolve(__dirname, './src/utils'),
},
},🤖 Prompt for AI Agents |
||
| }, | ||
|
Comment on lines
+10
to
+12
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. ESM 환경에서 __dirname 미정의로 인한 런타임 에러 발생 — fileURLToPath로 교체 필요 package.json에 "type": "module"이 설정되어 있어 이 설정 파일은 ESM으로 해석됩니다. ESM 스코프에서는 __dirname이 정의되지 않으므로 현재 alias 설정에서 런타임 에러가 발생합니다. 아래와 같이 수정해 주세요: -import path from 'path';
+import { fileURLToPath, URL } from 'node:url';
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
- '@': path.resolve(__dirname, 'src'),
- '@utils': path.resolve(__dirname, './src/utils'),
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
+ '@utils': fileURLToPath(new URL('./src/utils', import.meta.url)),
},
},검증 스크립트: #!/bin/bash
# __dirname 사용 여부 점검
rg -n "__dirname\b" packages/design-system/vite.config.ts || echo "OK: __dirname not used"🤖 Prompt for AI Agents |
||
| }, | ||
| build: { | ||
| lib: { | ||
| entry: 'src/components/index.ts', | ||
| name: 'DesignSystem', | ||
| fileName: (format) => `design-system.${format}.js`, | ||
| }, | ||
| rollupOptions: { | ||
| external: ['react', 'react-dom'], | ||
| output: { | ||
| globals: { | ||
| react: 'React', | ||
| 'react-dom': 'ReactDOM', | ||
| }, | ||
| }, | ||
|
Comment on lines
+20
to
+27
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. 🛠️ Refactor suggestion react/jsx-runtime도 external로 지정 권장 ESM/라이브러리 빌드에서 JSX 런타임이 번들에 끌려 들어오는 것을 방지하려면 'react/jsx-runtime'를 함께 external 처리하는 것이 안전합니다. rollupOptions: {
- external: ['react', 'react-dom'],
+ external: ['react', 'react-dom', 'react/jsx-runtime'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
},
},🤖 Prompt for AI Agents |
||
| }, | ||
| }, | ||
| }); | ||
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.
just 질문 사항인디! 이거 Node.js 키워드가 있는데, 혹시 이거는 어떤 것 때문에 쓰는 걸까요!
Uh oh!
There was an error while loading. Please reload this page.
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.
해당 도구들이 모두 Node.js 환경에서 실행되는 프로그램이기 때문입니다!
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.
아핫..!!?