C.W.K.
Stream
Lesson 05 of 05 · published

Yarn Wisdom

~9 min · yarn, wisdom, production

Level 0초심자
0 XP0/55 lessons0/16 achievements
0/80 XP to next level80 XP to go0% complete

Yarn Berry 가 이 quest 에서 가장 opinionated 한 패키지 매니저. 이 룰들이 의견 productive 하게 유지, obstructive 안 되게.

Berry 가볍게 고르지 마. 팀 작고, toolchain 빠르게 변하고, monorepo 나 zero-installs 필요 없으면 npm 또는 pnpm 이 더 친근. Berry 의 승은 안정, 큰 프로젝트에서 누적.

PnP 결정 미리. PnP 에 commit (IDE SDK 셋업, bundler 설정, 마찰 받아들이기) 또는 day one 부터 nodeLinker: node-modules 설정. 프로젝트 중간 전환 고통.

Zero-installs 채택하면 Git LFS 설정. .yarn/cache/ 디렉토리 빠르게 자람 — Git 의 일반 저장이 풍선처럼 부풀어. .yarn/cache/**/*.zip 에 Git LFS 사용해서 repo cloneable 유지.

Constraints 가 정비 슈퍼파워. 세 팀의 monorepo 가지고 모든 PR 이 약간 다른 버전의 공유 dep 도입하는 날, constraints 가 살림. 그 날 후 아니라 전에 셋업.

새 프로젝트에 Yarn Classic 쓰지 마. Maintenance-only 가 보안 패치만 의미 — 새 기능 없음, ecosystem 투자 없음. 새 프로젝트: Berry.

Code

zero-installs + Git LFS 용 .gitattributes·text
# .gitattributes
.yarn/cache/**/*.zip filter=lfs diff=lfs merge=lfs -text

# 그 다음 repo 에 LFS 활성화:
#   git lfs install
#   git lfs track ".yarn/cache/**/*.zip"
#   git add .gitattributes
#   git commit -m "chore: lfs for yarn cache"

External links

Exercise

기존 프로젝트에 Berry 고려한다면 프로젝트가 의존하는 도구 다섯 개 나열 (bundler, IDE, type-checker, linter, test runner). 각각 PnP 지원되는지 체크. 셋 이상 안 되면 'nodeLinker: node-modules' 사용 계획. 미리 알면 toolchain 과 나중에 싸우는 것보다 나아.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.