모노레포의 실행, 버전, 배포 관리를 쉽게하고싶다면 Lerna를 사용해보자
현우
- 라이브러리
- 프론트엔드
npx lerna init1234567{
"name": "my-monorepo",
"workspaces": ["packages/*"],
"devDependencies": {
"lerna": "^9.0.0"
}
}123456789{
"version": "independent",
"npmClient": "pnpm",
"command": {
"version": {
"conventionalCommits": true
}
}
}12345{
"scripts": {
"build": "tsc -p tsconfig.json"
}
}npx lerna run buildnpx lerna run test --scope @my-organization/ui // 특정 패키지
npx lerna run build --since 브랜치명 // 변경된 패키지만 (브랜치명을 생략하면 가장 최근 Git 태그 기준으로)@my-organization/ui > 1.4.0
@my-organization/utils > 1.4.0
@my-organization/api-client > 1.4.0@my-organization/ui > 1.1.0
@my-organization/utils > 1.2.2
@my-organization/api-client > 1.4.0npx lerna version // 버전 변경 시작
npx lerna publish // NPM 라이브러리 배포12345678{
"scripts": {
"build": "pnpm -r run build",
"build:changed": "lerna run build --since",
"changed": "lerna changed",
"version:changed": "lerna version --conventional-commits"
}
}