Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pnpm dlx turbo type-check
pnpm dlx turbo lint-staged
6 changes: 4 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"start": "next start",
"lint": "next lint",
"lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
"lint-staged": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
Comment on lines 12 to +13
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

중복된 린트 스크립트를 정리해주세요.

lint:fixlint-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.

Suggested change
"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"

"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@egjs/flicking-plugins": "^4.7.1",
Expand Down Expand Up @@ -81,4 +83,4 @@
"storybook": "^8.0.9",
"typescript": "*"
}
}
}
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@
"dev:web": "turbo dev --filter=@gitanimals/web",
"dev:admin": "turbo dev --filter=@gitanimals/admin",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"web": "pnpm -F @gitanimals/web",
"admin": "pnpm -F @gitanimals/admin",
Comment on lines +12 to +13
Copy link
Member

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로 실행하는 기존 커멘드가 더 적합할 것 같다고 생각해요 👀 어떻게 생각하시나요?!

Copy link
Member Author

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를 지정한 기능과는 다른 의도 아닌가 싶은데 제가 잘 이해한 게 맞을까요?

"prepare": "husky"
},
"devDependencies": {
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "*",
"turbo": "^2.0.4",
"typescript": "*"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": [
"eslint --cache --fix",
"prettier --cache --write"
]
},
Comment on lines +23 to +28
Copy link

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.

Suggested change
"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"
]
},

"resolutions": {
"typescript": "^5.4.5",
"react": "^18",
Expand All @@ -29,4 +40,4 @@
"node": ">=18",
"pnpm": ">=9.0.0"
}
}
}
Loading
Loading