# NPM์ ์ฌ์ฉํ๊ณ node ๋ฒ์ ์ 20.15.0๋ก ๊ณ ์ ํฉ๋๋ค.
`nvm`์ ํ์ฉํด๋ณด์ธ์!
# Branch Convention
ํต์ฌ์ด๋๋ `develop` , `main`, `epic/*` ๋ธ๋์น ๋ฑ์๋ ์ง์ ์ ์ผ๋ก commit, push๋ฑ์ ์งํํ ์ ์์ต๋๋ค.
(local husky, repository branch setting ๋ฑ ์์ ์ ํ๋์ ํ ์ ์๊ฒ ๊ฐ์ ํฉ๋๋ค.)
> `main` , `master`, `develop`, `feat/*`, `hotfix/*`, `epic/*`, `setting/*`, `fix/*`, `refactor/*` ๋ธ๋์น๋ค์ PR์ด ์คํ๋๋ฉด build ํ
์คํธ๋ฅผ ์งํํ๋ฉฐ ๋น๋์คํจ ์ PR์ ๋จธ์งํ ์ ์์ต๋๋ค.
## main / develop
์ ๋ธ๋์น๋ค์๊ฒ ๋จธ์ง๋ฅผ ์งํํ ๋๋ ๊น๋ํ Git ์ด๋ ฅ์ ์ํด ๊ผญ squash merge๊ฐ ๋ ์ ์๋๋ก ํฉ๋๋ค.
(PR์์ ๋จธ์ง๋ฒํผ์ ๋๋ฅด๊ธฐ ์ ์ ํ๋ฒ๋ ํ์ธํ๊ธฐ)
## epic
epic ๋ธ๋์น๋ ํฐ ๊ฐ๋์ ์
๋ฌด ํ์คํฌ๋ฅผ ๋ปํฉ๋๋ค. ex) 00 page ์์
/ ํ๋ก์ ํธ ์ ๋ฐ์ ๊ฑธ์น ๊ณตํต ์์
(๊ณต์ฉ ์ปดํฌ๋ํธ, ๊ณต์ฉ api ์ปจํธ๋กค๋ฌ ๋ฑ)
๊ทธ๋ ๊ธฐ ๋๋ฌธ์ epic๋ธ๋์น์์ ์ง์ ์ ์ผ๋ก ์์
์ ์งํํ๊ธฐ๋ณด๋ค๋ epic๋ธ๋์น์์ `feat/` feature ๋ธ๋์น, `refactor/` ๋ฆฌํฉํ ๋ง ๋ธ๋์น ๋ฑ์ ๋ง๋ค์ด์ ์์
์ ์งํํฉ๋๋ค.
**`epic/` ๋ธ๋์น์๋ ์ง์ ์ ์ผ๋ก commit, push๋ฑ์ ์งํํ ์ ์์ต๋๋ค.**
## feat
feature ๋ธ๋์น๋ ์์ ๊ฐ๋์ ์
๋ฌด ํ์คํฌ๋ฅผ ๋ปํฉ๋๋ค. ex) 00 page์ ํน์ ์ปดํฌ๋ํธ ์์
/ 00 page์ ํน์ ๋ชจ๋ ์์
/ ๊ณตํต ์ปดํฌ๋ํธ ์ค 00 ์ปดํฌ๋ํธ ์์
๋ฑ
๊ทธ๋ ๊ธฐ ๋๋ฌธ์ feature๋ธ๋์น๋ ๋ช
ํํ ๋ธ๋์น์ ๋ชฉ์ ์ ๋ง๋ ์์
๋ง์ ๊ฐ์ง๊ณ ์์ด์ผ ํ๋ฉฐ ์ฌ์ด์ฆ๋ ์์์ผ ํฉ๋๋ค
(ํ์๋ค์ด ๋ถ๋ด์์ด ๋ฆฌ๋ทฐํ ์ ์๊ฒ)
>๊ถ์ฅ๋๋ ์ฌ์ด์ฆ๋ file changes ๊ธฐ์ค์ผ๋ก 10๊ฐ ๋ฏธ๋ง์ ํ์ผ์ด ๋ณ๊ฒฝ๋์ด์ผ ํฉ๋๋ค
## merge
์ ๋ธ๋์น ์ปจ๋ฒค์
์ ๊ธฐ์ค์ผ๋ก ํ๋ฉด `epic`๋ธ๋์น๋ ์์ฑ๋ ์์ ์์๋ถํฐ ๊ฝค๋ ์ค๋์๊ฐ๋์ ์ด์์๋ ๋ธ๋์น๊ฐ ๋ฉ๋๋ค.
์ด๋ `epic`๋ธ๋์น๋ฅผ `develop`์ ๋จธ์งํ ๋ conflict๊ฐ ๋ ๊ฐ๋ฅ์ฑ๋ ๊ทธ๋งํผ ๋๋ค๋ ์ด์ผ๊ธฐ๊ฐ ๋ฉ๋๋ค.
๋๋ฌธ์ ๊ทธ๋ฌํ ๋ณํฉ ์ํ์์์ ์์ ํ๊ฒ ๋ณํฉ์ ์งํํ๊ธฐ ์ํด **`merge/*`** ๋ธ๋์น๋ฅผ ์์ฑํ๋๊ฑธ ์ถ์ฒ๋๋ฆฝ๋๋ค.
1. `merge/` ๋ธ๋์น ๋ `epic/` ๋ธ๋์น๋ก ๋ถํฐ ์์ฑํ๋ฉฐ ์์ฑํ ์ฆ์ `develop`์ pull๋ฐ์ต๋๋ค.
> epic/main-page -> merge/main-page ์์ฑ
> merge/main-page ๋ธ๋์น๋ก ์ด๋ํ๊ณ `develop` ๋ธ๋์น๋ฅผ pull ๋ฐ๊ธฐ
2. `develop`์ pull ๋ฐ๋ ์๊ฐ `merge/` ๋ธ๋์น๋ `epic/`์ ๋ณ๊ฒฝ์ฌํญ๊ณผ `develop`์ ๋ณ๊ฒฝ์ฌํญ์ ํจ๊ป ๊ฐ์ง๊ฒ ๋ฉ๋๋ค.
3. ๋์ ํ๋ฅ ๋ก conflict๊ฐ ๋ฐ์ํ ํ๋ ์ ํด๊ฒฐํด์ฃผ์ธ์
4. conflict๋ฅผ ํด๊ฒฐํ๊ณ ๋๋ฉด `merge/` ๋ธ๋์น๋ฅผ `epic/` ๋ธ๋์น์ mergeํ ์ ์๊ฒ PR์ ์์ฑํฉ๋๋ค.
> merge/main-page -> epic/main-page PR ์์ฑ
> epic/main-page ์ merge/main-page ๋ณํฉ
5. PR์ ๋จธ์งํ๊ณ ๋๋ฉด `develop`๋ธ๋์น์ ๋ค๋ฅธ ๋ณ๊ฒฝ์ฌํญ์ด push๋๊ธฐ ์ ๊น์ง๋ `epic/`๋ `develop` ๋ธ๋์น์ ์์ ํ๊ฒ mergeํ ์ ์๋ ์ํ๊ฐ ๋ฉ๋๋ค.
6. `epic/` ๋ธ๋์น๋ฅผ `develop/` ๋ธ๋์น์ mergeํ ์ ์๋ PR์ ์์ฑํฉ๋๋ค.
7. PR์์ conflict๊ฐ ๋ฐ์ํ์ง ์๋๊ฒ์ด ํ์ธ๋๋ฉด ํด๋น PR์ ๋จธ์ง์ํต๋๋ค.
## ์ฃผ์์ฌํญ
์์์ ์ ์ํ `main` , `master`, `develop`, `feat/*`, `hotfix/*`, `epic/*`, `setting/*`, `fix/*`, `refactor/` ๋ธ๋์น ์ธ์ ๋ค๋ฅธ ํ์์ ๋ธ๋์น ์์ฑ์ ๊ธ์งํฉ๋๋ค.
# PR
๋ชจ๋ ๋ธ๋์น์ ๋ณํฉ๊ณผ์ ์์ PR์ด ํ์ํฉ๋๋ค.
PR๋ฅผ ๋ณํฉํ๋๋ฐ์๋ ๋ช๊ฐ์ง ๊ท์น์ด ์กด์ฌํฉ๋๋ค.
1. PR์ด ์ฌ๋ผ์ฌ ์ build test๋ฅผ ์งํํจ. `build`๊ฐ ์คํจํ๋ค๋ฉด PR์ ๋จธ์ง ํ ์ ์์
2. PR์ ๋ฌด์กฐ๊ฑด 1๋ช
์ด์์ reviwer์๊ฒ `approve`๋ฅผ ๋ฐ์์ผํจ ๊ทธ๋ ์ง ์์ผ๋ฉด PR์ ๋จธ์ง ํ ์ ์์
3. PR์๋ ๊ผญ label์ ๋ถํ์ผ ํจ
4. PR์ Assignee ๋ฐ Reviewer ์ง์ ์ด ํ์์
5. PR์ ์ ๋ชฉ์ `[Epic] OO` ์ํฝ, `[Feat] OO` ํผ์ณ, `[Fix] OO` ๋ฒ๊ทธ ์์ , `[Refactor] OO` ๊ฐ์ ์ ๊ฐ์ convention์ ๊ผญ ์ง์ผ์ผ ํจ
## Label
ํ์ฌ ๋ ํฌ์งํ ๋ฆฌ์ ์กด์ฌํ๋ ๋ชจ๋ `label`์ ์ญ์ ํ๊ณ
์๋์ Label๋ก ์ธํ
ํ๋๊ฑธ ๊ถ์ฅํฉ๋๋ค.
### Label ๋ชฉ๋ก
```tsx
{ name: "Priority: High ๐ฅ", description: '์ฐ์ ์์ ๋์', color: "F9D0C4" },
{ name: "Priority: Low ๐ข", description: '์ฐ์ ์์ ๋ฎ์', color: "C2E0C6" },
{ name: "Priority: Medium :bookmark:", description: '์ฐ์ ์์ ๋ณดํต', color: "FEF2C0" },
{ name: "Type: Doc :memo:", description: '๋ฌธ์ ์ถ๊ฐ / ์์ ', color: "0075ca" },
{ name: "Type: Bug :bug:", description: '๋ฒ๊ทธ', color: "d73a4a" },
{ name: "Type: Epic :rocket:", description: 'ํฐ ๋จ์์ ๋ธ๋์น', color: "051C35" },
{ name: "Type: Feature :sparkles:", description: '์ ๊ท ๊ธฐ๋ฅ', color: "AB5D19" },
{ name: "Type: Improve UX :arrow_up:", description: 'UX ๊ฐ์ ', color: "2CE151" },
{ name: "Type: Merge :truck:", description: '๋จธ์ง', color: "4A7A8F" },
{ name: "Type: Refactor :recycle:", description: '๋ฆฌํฉํ ๋ง', color: "027B6B" }
๋จผ์ Priority ๋ผ๋ฒจ์ ํ์์ ์ผ๋ก ์ค์ ํด์ผํฉ๋๋ค.
๋ํ ํ์๋ค์ Priority: High ๐ฅ PR์ด ์ฌ๋ผ์๋ค๋ ์๋ฆผ์ ๋ฐ์ผ๋ฉด ํ๋ ์์
์ ์ต๋ํ ๋น ๋ฅด๊ฒ ๋๋ง์น๊ณ , ํด๋น PR์ ๋ํ ๋ฆฌ๋ทฐ๋ฅผ ์งํํด์ผํฉ๋๋ค.
๋ธ๋์น์ ๋ฐ๋ผ Feature Improve UX Refactor Merge Epic Bug๋ฑ์ ํ์
์ ๊ผญ ์ง์ ํด์ฃผ์ธ์
husky๋ local git hook ์ฌ์ฉ์ ๋์์ฃผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค. ํ์ฌ ํ๋ก์ ํธ์๋ ํฌ๊ฒ 2๊ฐ์ง ๊ท์ง์ด ์กด์ฌํฉ๋๋ค.
pre-commit.yaml ํ์ผ์ commit์ ๋จ๊ธฐ๊ธฐ ์ scipt๋ฅผ ์ ์ํฉ๋๋ค.
ํ ํ๋ก์ ํธ์์๋ npm run lint ๋ฅผ ํตํด lint๋ฅผ ์คํ์ํค๊ณ ๋ง์ฝ ์คํจ ์ commit์ด ๋จ์ง ๋ชปํ๊ฒ ํฉ๋๋ค.
๋ํ
current_branch=$(git branch --show-current)
restricted_branches="^(main|master|develop|epic/.+)$"
if [[ $current_branch =~ $restricted_branches ]]; then
echo ":construction: You are on a restricted branch: $current_branch."
echo "Commits to this branch are not allowed via pre-commit hook."
exit 1
fi์ ํตํด main|master|develop|epic/ ๋ธ๋์น์์์ commit์ ํ์งํ๊ณ , ํด๋น ๋ธ๋์น์์ commit์ ๋จ๊ธธ ์ ์๊ฒ ํฉ๋๋ค.
pre-push.yaml ํ์ผ์ pushํ๊ธฐ ์ scipt๋ฅผ ์ ์ํฉ๋๋ค.
current_branch=$(git branch --show-current)
restricted_branches="^(main|master|develop|epic/.+)$"
if [[ $current_branch =~ $restricted_branches ]]; then
echo ":construction: You are on a restricted branch: $current_branch."
echo "Commits to this branch are not allowed via pre-commit hook."
exit 1
fi์ ํตํด main|master|develop|epic/ ๋ธ๋์น์์์ push๋ฅผ ํ์งํ๊ณ , ํด๋น ๋ธ๋์น์์ push๋ฅผ ํ ์ ์๊ฒ ํฉ๋๋ค.
ํด๋น ํ๋ก์ ํธ๋ Next.js page router, Tanstack Query, query-key-factory, axios, qs, react-hook-form, zod, tailwind, typescript ๋ฑ์ด ์ค์น๋์ด ์์ต๋๋ค.
์ฌ์ฉํ์ง ์์ผ์ ๋ ์ข์ง๋ง ๋๋ถ๋ถ ํ์ ์์ ๊ต์ฅํ ๋ง์ด, ํ์ค์ ์ผ๋ก ์ฌ์ฉํ๋ ์ ์ ๋ค์ด๋ ์ฌ์ฉํ์๋ ๋ฐฉํฅ์ ์ข ๋ ์ถ์ฒ๋๋ฆฝ๋๋ค.