핵심 요약
18개 패키지 모노레포의 풀 빌드 12분 → 47초. PNPM 9 workspace + Turborepo 3 remote cache + 의존 그래프 정리. 캐시 hit율 92%, CI 비용 -71%. 6개월 운영 사후.
1. workspace 구조
# pnpm-workspace.yaml
packages:
- 'apps/*'
- 'packages/*'
- 'tools/*'
catalog:
react: ^19.0.0
typescript: ^6.0.0
catalog 기능으로 의존성 버전 중앙 관리 — 18개 패키지 동기화 자동.
2. Turbo 파이프라인 — dependsOn 정확히
{
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"],
"cache": true
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"]
}
}
}
3. Remote Cache — Vercel·자체 호스팅
Vercel Remote Cache 사용 — 팀원 누구라도 동일 input 재실행 시 즉시 hit. CI에서도 같이 공유. 자체 호스팅(Turborepo Remote Cache 서버)은 비용 0, 운영 부담 있음.
4. 실측
| 시나리오 | 시간 | |
|---|---|---|
| cold(remote miss) | 12m 04s | |
| warm(local hit) | 3.1s | |
| CI 평균(remote hit 92%) | 47s | |
| 단일 패키지 변경 후 affected | 18s |
5. 함정
- cache key 불안정 — env 변수 자동 포함 안 됨, globalEnv 명시
- outputs 누락 — dist/ 빠뜨리면 다음 stage에서 못 찾음
- PNPM hoisted — node-linker 정책 워크스페이스별로 다르면 자주 의존 깨짐
- CI cache 권한 — Vercel token이 PR-fork에서 안 됨, public-key sign 정책

댓글 0