Post

[Lerna] 모노레포 프로젝트 만들기

모노레포란?

Lerna 실행해보기

lerna example 브랜치에서 프로젝트를 clone한다.

root 경로에서 yarn 명령어로 모듈을 인스톨한다.

example 패키지 구조는 아래와 같으며, remixapp 패키지는 header, footer 패키지를 의존한다.

1
2
3
4
packages/
ㄴheader
ㄴfooter
ㄴremixapp

npx lerna run dev --scope= 뒤에 실행하고 싶은 패키지명을 붙여 서버를 실행한다.

1
npx lerna run dev --scope=remixapp

버전 업데이트

작업한 내용을 커밋한 후, lerna version 명령어로 패키지의 버전을 업데이트 할 수 있다.

1
2
3
4
5
{
  "$schema": "node_modules/lerna/schemas/lerna-schema.json",
  "version": "independent",
  "useWorkspaces": true
}

패키지마다 개별로 버전을 업데이트 하고 싶다면 루트 경로의 lerna.json 파일에서 "version": "independent"로 설정한다.

참고사이트

모노리포 개발 가이드
Version and Publish
Commands

This post is licensed under CC BY 4.0 by the author.