-
Notifications
You must be signed in to change notification settings - Fork 7
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
협업용 husky 설정 및 package.json app alias 설정 #281
base: main
Are you sure you want to change the base?
Conversation
Walkthrough이번 변경 사항은 pre-commit 훅을 강화하여 커밋 전 타입 검사와 린트 작업을 자동으로 수행하도록 합니다. 이를 위해 Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as 개발자
participant Husky as pre-commit 훅
participant Turbo as Turbo CLI
participant TS as 타입 체커 (tsc)
participant Lint as 린트 도구 (ESLint)
Dev->>Husky: 커밋 실행
Husky->>Turbo: "pnpm dlx turbo type-check" 실행
Turbo->>TS: 타입 체크 수행
TS-->>Turbo: 결과 반환
Husky->>Turbo: "pnpm dlx turbo lint-staged" 실행
Turbo->>Lint: staged 파일 린트 실행
Lint-->>Turbo: 결과 반환
Husky-->>Dev: 커밋 완료
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
워크스루이번 변경 사항은 커밋 전에 실행되는 체크 프로세스에 새로운 명령어들을 추가하는 작업을 포함합니다. 변경 내용
시퀀스 다이어그램sequenceDiagram
participant 개발자 as 개발자
participant Git as Git
participant Husky as .husky/pre-commit
participant TypeCheck as 타입 검사
participant LintStaged as 린트 스테이징
개발자->>Git: 커밋 시도
Git->>Husky: pre-commit 훅 실행
Husky->>TypeCheck: pnpm dlx turbo type-check 실행
TypeCheck-->>Husky: 타입 검사 결과 반환
Husky->>LintStaged: pnpm dlx turbo lint-staged 실행
LintStaged-->>Husky: 린트 결과 반환
Husky-->>Git: 훅 완료, 커밋 진행
Git-->>개발자: 커밋 성공 또는 오류 피드백
제안 리뷰어
시
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/web/package.json (1)
13-16
: 스크립트 중복을 개선할 수 있습니다.다음과 같은 개선 사항을 고려해주세요:
lint-staged
스크립트가lint:fix
와 거의 동일한 기능을 수행합니다. 중복을 피하기 위해 하나로 통합하는 것이 좋습니다.- 루트의 lint-staged 설정과 web 패키지의 lint-staged 스크립트가 서로 다른 동작을 수행할 수 있습니다. 일관성 있는 처리를 위해 설정을 통일하는 것이 좋습니다.
다음과 같이 수정을 제안드립니다:
- "lint-staged": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix", + "lint:staged": "lint:fix",
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
.husky/pre-commit
(1 hunks)apps/web/package.json
(2 hunks)package.json
(2 hunks)turbo.json
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- turbo.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Install Dependencies
🔇 Additional comments (2)
.husky/pre-commit (1)
1-2
: pre-commit 훅 설정이 적절합니다.타입 체크와 린트 검사가 커밋 전에 실행되도록 잘 구성되어 있습니다.
단, 다음 사항을 확인해 주시면 좋겠습니다:
- type-check가 lint-staged 이전에 실행되는 것이 의도된 순서인지 확인
- 각 명령어가 실패할 경우 커밋이 중단되는지 테스트
package.json (1)
12-14
: 앱별 명령어 별칭이 잘 설정되었습니다.web과 admin 패키지에 대한 명령어 별칭이 편리하게 구성되어 있습니다.
"lint-staged": { | ||
"src/**/*.{js,jsx,ts,tsx}": [ | ||
"eslint --cache --fix", | ||
"prettier --cache --write" | ||
] | ||
}, |
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.
🛠️ Refactor suggestion
lint-staged 설정을 검토해주세요.
현재 lint-staged 패턴이 src/**/*.{js,jsx,ts,tsx}
로 설정되어 있는데, 이는 루트 디렉토리의 src 폴더만을 대상으로 합니다. 모노레포 구조에서는 각 앱의 src 폴더를 포함하도록 패턴을 수정하는 것이 좋습니다.
다음과 같이 수정을 제안드립니다:
"lint-staged": {
- "src/**/*.{js,jsx,ts,tsx}": [
+ "{apps,packages}/**/src/**/*.{js,jsx,ts,tsx}": [
"eslint --cache --fix",
"prettier --cache --write"
]
},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"lint-staged": { | |
"src/**/*.{js,jsx,ts,tsx}": [ | |
"eslint --cache --fix", | |
"prettier --cache --write" | |
] | |
}, | |
"lint-staged": { | |
"{apps,packages}/**/src/**/*.{js,jsx,ts,tsx}": [ | |
"eslint --cache --fix", | |
"prettier --cache --write" | |
] | |
}, |
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.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
.husky/pre-commit
(1 hunks)apps/web/package.json
(2 hunks)package.json
(2 hunks)turbo.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Install Dependencies
🔇 Additional comments (5)
.husky/pre-commit (1)
1-2
: 훌륭한 pre-commit 훅 설정입니다!타입 체크와 린트 검사를 커밋 전에 실행하도록 설정하여 코드 품질을 보장하는 좋은 접근 방식입니다.
turbo.json (1)
23-28
: 새로운 태스크가 올바르게 구성되었습니다.type-check와 lint-staged 태스크가 각각의 의존성과 함께 적절하게 설정되었습니다.
package.json (2)
12-14
: 편리한 앱별 명령어 단축키가 추가되었습니다.web과 admin 패키지에 대한 단축 명령어가 추가되어 개발 생산성이 향상될 것으로 보입니다.
23-28
: lint-staged 설정이 적절합니다.ESLint와 Prettier를 캐시와 함께 사용하도록 설정되어 있어 효율적인 코드 품질 관리가 가능해 보입니다.
apps/web/package.json (1)
15-16
: 타입 체크 스크립트가 적절히 추가되었습니다.TypeScript 타입 체크를 위한 스크립트가 올바르게 구성되었습니다.
"NODE_ENV", | ||
"SLACK_ERROR_CHANNEL_WEBHOOK_URL" | ||
] | ||
"env": ["NODE_ENV", "SLACK_ERROR_CHANNEL_WEBHOOK_URL"] |
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.
환경 변수 보안 검토가 필요합니다.
SLACK_ERROR_CHANNEL_WEBHOOK_URL
과 같은 민감한 환경 변수가 dev 태스크에 노출되어 있습니다. 이러한 URL은 보안상 위험할 수 있습니다.
"lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix", | ||
"lint-staged": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix", |
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.
🛠️ Refactor suggestion
중복된 린트 스크립트를 정리해주세요.
lint:fix
와 lint-staged
스크립트가 동일한 명령을 수행하고 있습니다. 중복을 제거하고 하나의 스크립트만 유지하는 것이 좋겠습니다.
다음과 같이 수정하는 것을 제안합니다:
- "lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
- "lint-staged": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
+ "lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix", | |
"lint-staged": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix", | |
"lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix" |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.husky/pre-commit (1)
1-2
: 타입 체크와 린트 작업을 병렬로 실행하는 것을 고려해보세요.현재 타입 체크와 린트 작업이 순차적으로 실행되고 있습니다. 이를 병렬로 실행하면 커밋 속도를 개선할 수 있습니다.
다음과 같이 수정을 제안드립니다:
-pnpm dlx turbo type-check -pnpm dlx turbo lint-staged +pnpm dlx turbo type-check lint-staged --parallelapps/web/package.json (1)
12-13
: 중복된 린트 스크립트를 정리해주세요.
lint:fix
와lint-staged
스크립트가 동일한 기능을 수행하고 있습니다. 유지보수를 위해 하나로 통일하는 것이 좋습니다.다음과 같이 수정을 제안드립니다:
- "lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix", - "lint-staged": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix", + "lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix"그리고 lint-staged 설정에서 이 스크립트를 재사용할 수 있습니다:
{ "lint-staged": { "src/**/*.{js,jsx,ts,tsx}": "pnpm lint:fix" } }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
.husky/pre-commit
(1 hunks)apps/web/package.json
(2 hunks)package.json
(2 hunks)turbo.json
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- turbo.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build application
🔇 Additional comments (3)
package.json (2)
23-28
: lint-staged 설정을 검토해주세요.현재 lint-staged 패턴이
src/**/*.{js,jsx,ts,tsx}
로 설정되어 있는데, 이는 루트 디렉토리의 src 폴더만을 대상으로 합니다. 모노레포 구조에서는 각 앱의 src 폴더를 포함하도록 패턴을 수정하는 것이 좋습니다.
12-13
: workspace 명령어 추가에 대해 LGTM!workspace 명령어를 통해 각 앱 디렉토리로 이동하지 않고도 명령을 실행할 수 있어 편리해졌습니다.
apps/web/package.json (1)
16-16
: 타입 체크 스크립트 추가에 대해 LGTM!타입 체크 스크립트가 추가되어 타입 안정성을 보장하는데 도움이 될 것 같습니다.
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.
코멘트 확인 부탁드립니다~
"web": "pnpm -F @gitanimals/web", | ||
"admin": "pnpm -F @gitanimals/admin", |
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.
이 부분은 이미 dev:web
dev:admin
커멘드로 가능한 상태입니다!
저는 같은 역할을 한다면 turbo로 실행하는 기존 커멘드가 더 적합할 것 같다고 생각해요 👀 어떻게 생각하시나요?!
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.
말씀하신 dev:web
, dev:admin
의 경우 dev
script에 대해서만 적용이 가능합니다.
저의 경우 type-check
, lint fix
등의 커맨드는 항상 /apps/web/
내부로 터미널을 옮겨서 사용하는 게 불편한 방법이지 않나 생각했습니다.
추가로 turbo
커맨드를 사용하게 되면 모든 app이 같은 스크립트를 타는 것으로 알고 있는데 그렇다면 alias를 지정한 기능과는 다른 의도 아닌가 싶은데 제가 잘 이해한 게 맞을까요?
"globalEnv": [ | ||
"NODE_ENV" | ||
], | ||
"globalDependencies": [ | ||
".env", | ||
".env.*" | ||
], | ||
"globalEnv": ["NODE_ENV"], | ||
"globalDependencies": [".env", ".env.*"], |
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 설정이 다르게 되어있던 부분은 아닌지 확인 가능할까요?
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.
tsx 파일의 코드 레벨에서는 프로젝트 eslint 설정과 맞추는 데에 성공했는데 json은 잘 안 되더라고요🥲
line break 정도의 변경이어서 당장은 크리티컬하지 않다고 판단했고, 계속 방법 찾아보겠습니다.
💡 기능
🔎 기타
turbo.json
의 경우, 크게 변경사항이 없었음에도 저장 시에 formatting이 되어 전체가 reformat되었습니다.format on save
에 의해 변경되는 형식이 로컬과 프로젝트 설정 간 충돌이 있는 것 같아 해결방안을 찾고 있습니다.Summary by CodeRabbit
새로운 기능
작업 개선