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

chore: Yarn berry 설정 #163

Merged
merged 20 commits into from Aug 29, 2021

Conversation

greatSumini
Copy link
Member

@greatSumini greatSumini commented Aug 28, 2021

Description

묵을만큼 묵은 이슈죠 9번이라니 ㅎㅎ; 무서워서 미루고 있었는데, 막상 해보니 생각보다 간단하네요 😄
기존에 1분 이상 걸리던 CI가 이제 30~40초 내외에 끝납니다. 우왕~ 🥳

작업 내용은 다음과 같습니다.

  1. Yarn berry, Plug'n'Play를 도입했습니다.
  2. Zero install로 설정해봤습니다. (근데 install 해야함)
  3. CI workflow가 yarn을 사용하도록 변경했습니다. 이제 12.x, 14.x에 대해서만 수행합니다.
  4. CONTRIBUTING의 내용을 yarn을 사용하도록 업데이트 했습니다. vscode 설정 관련 내용도 추가했습니다.

아래는 저와 같이 yarn berry가 생소한 분들을 위한 짤막한 소개들입니다.

  1. Yarn berry가 뭔가요? 왜 쓰나요?
    Yarn berry는 v2 이상의 yarn을 부르는 이름입니다! .pnp.cjs 파일을 이용해 의존성의 위치를 정확히 기록하기 때문에 기존 node_modules의 많은 문제들을 해결할 수 있습니다. (거대한 크기+긴 탐색시간, 외부환경과의 의존, 긴 설치시간, 의존성 끌어올리기, 변경에 대한 검증, ... )
  2. Zero install이 뭔가요?
    .yarn/cachenode_modules보다 훨씬 가볍기 때문에 의존성 파일들을 전부 Git에 올릴 수 있습니다. 이를 Zero install이라 합니다. 이러면 git clone시에 의존성을 새로 설치하지 않아도 됩니다. 개꿀이죠!
  3. 위에서 install 해야한다면서요. Zero install인데 왜 install 해야되나요??
    기기 환경에 종속적인 빌드 결과물(패키지)들은 .yarn/unplugged 디렉토리에 저장되며, 이들은 .gitignore에 포함되어 clone시 생성되지 않습니다. 따라서 여기 포함된 패키지들을 사용하는 기능은 install 하지 않으면 작동하지 않습니다. (e.g. yarn build는 작동하지만 yarn lint는 작동하지 않습니다 ㅋㅋ ㅠ)
  4. 그럼 뭐하러 Zero install 쓰나요? 의미 없는거 아닌가요?
    .yarn/unplugged에 들어가는 패키지가 훨씬 많기 때문에 install을 하더라도 기존보다 훨씬 빠릅니다. 제 기준 현재 6s 980ms 소요되네요! (기존 npm 사용시 49초)

조약한 실력으로 세팅해본 Yarn berry입니다 ㅎㅎ ㅠ 조금이라도 이상한 부분은 피드백 부탁드립니다~! 궁금한 점도 환영입니다!

Refs

Help Wanted 👀

Zero install인데 install이 필요하다는 점이 쪼금 찜찜합니다 ㅎㅎ ㅠ

Related Issues

resolve #9
fix #

Checklist ✋

  • PR 타이틀을 {PR type}: {PR title}로 맞췄습니다. (type 예시: feat | fix | BREAKING CHANGE | chore | ci | docs | style | refactor | perf | test) (참고: conventional commits)
  • 모든 변경점들을 확인했으며 적절히 설명했습니다.
  • 빌드와 테스트가 정상적으로 수행됨을 확인했습니다. (npm run build, npm run test)
  • 깃헙 이슈를 연결하겠습니다. (커밋에 resolve #이슈넘버 적거나 PR생성 후 Linked Issue 추가)

@greatSumini greatSumini added 📖 documentation Improvements or additions to documentation enhancement New feature or request labels Aug 28, 2021
@greatSumini greatSumini self-assigned this Aug 28, 2021
@greatSumini greatSumini added this to In progress in RAP(React-Analytics-Provider) via automation Aug 28, 2021
@greatSumini greatSumini changed the title chore: Yarn berry chore: Yarn berry 설정 Aug 28, 2021
@greatSumini greatSumini requested review from jhlee910609 and milooy and removed request for jhlee910609 August 28, 2021 18:48
- 퍼포먼스가 30초 vs 2초로 너무 파멸적으로 차이나기 때문에 배제했습니다.
@greatSumini greatSumini linked an issue Aug 28, 2021 that may be closed by this pull request
@sensecodevalue
Copy link
Contributor

sensecodevalue commented Aug 28, 2021

@greatSumini
정말 좋은것 같습니다! 정말 새롭고 정말 유용하다고 생각합니다!
이번에 codecov 적용하면서 계속 테스트해보면서 ci 기다리는게 생각 보다 시간이 쌓이니까 많더라구요!

24분전이라...제가 이번에 codecov를 추가하면 npm으로 진행했습니다. ㅠ 이게 먼저 머지 되길!!!!

Copy link
Contributor

@jhlee910609 jhlee910609 left a comment

Choose a reason for hiding this comment

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

@greatSumini LGTM 👍 추가적으로 위 PR이 merge 되면 별도로 저희가 yarn berry pnp가 잘 동작하도록 하기 위해 해야할 일들이 있다면 같이 알려주시면 좋을 것 같아요!

@@ -0,0 +1,5 @@
plugins:
Copy link
Contributor

Choose a reason for hiding this comment

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

@greatSumini nodeLinker 설정 기본 모드가 pnp 인가요? 개인 프로젝트에 적용했을때는 명시했어야 했는 것 같은데(제가 잘 몰라서 그런 걸 수도 있어여 ㅠㅠ), 명시적으로 안해도 잘 돌아가보네요. 👀
https://yarnpkg.com/configuration/yarnrc#nodeLinker

Copy link
Member Author

Choose a reason for hiding this comment

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

넵 기본값이 pnp입니다 ㅎㅎ

Copy link
Contributor

Choose a reason for hiding this comment

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

@greatSumini 옷, 그렇군요. 답변 감사합니다 :)

@greatSumini
Copy link
Member Author

@jhlee910609 리뷰 감사합니다 ㅎㅎ 더 설정할 것은 없는데, 지금 열려있는 PR들 중 추가로 패키지를 설치한 것이 있다면 충돌이 조금 일어날 수 있겠네요 ㅋㅋ ㅠ

Copy link
Member

@milooy milooy left a comment

Choose a reason for hiding this comment

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

넘깔끔! 정석!
감사합니다 ㅋㅋ
빌드시간 줄어서 설레네요
더 많이 줄것같았는데 🤔ㅎㅎ 지켜봐요!

--

컨플릭 해결 후 바로 머지 고고

@greatSumini greatSumini merged commit 6e972ca into EveryAnalytics:main Aug 29, 2021
RAP(React-Analytics-Provider) automation moved this from In progress to Done Aug 29, 2021
@greatSumini greatSumini deleted the chore/9/set-yarn-berry branch August 29, 2021 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

package-lock.json 정리 Yarn berry
4 participants