Lerna(๐Ÿ‰)๋กœ ๋ชจ๋…ธ๋ ˆํฌ ํ•ด๋ณด๋Ÿฌ๋‚˜?

Lerna๋กœ mono-repo ๋งŒ๋“ค์–ด๋ณด๊ธฐ

Jung Han
Jung Han
Sep 1, 2019 ยท 17 min read
Image for post
Image for post

์‹œ์ž‘ํ•˜๊ธฐ ์ „์—

Mono-Repo์™€ Multi-Repo?

Image for post
Image for post
์‚ฌ์ „์  ์˜๋ฏธ

Mono-Repo์˜ ์žฅ์ ์ด์ž Multi-Repo์˜ ๋‹จ์ 

Image for post
Image for post
babel ์ €์žฅ์†Œ์ž…๋‹ˆ๋‹ค. eslint๋‚˜ travis, flow ๋“ฑ ์—ฌ๋Ÿฌ ์„ค์ •์„ ๋ฃจํŠธ์— ๋‘๊ณ  ๊ณต์œ ํ•˜๋ฉฐ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Image for post
Image for post
babel์˜ ํŒจํ‚ค์ง€ ๋ชจ๋“ˆํ™”์ž…๋‹ˆ๋‹ค. babel์˜ ํŒจํ‚ค์ง€๋Š” ์•ฝ 150๊ฐœ ์ •๋„ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.
// โ€ฆ ๋‹ค๋ฅธ ๋ชจ๋“ˆ import
import * as babel from โ€œ@babel/coreโ€;
export function transform(
filename: string,
code: string,
opts: Object,
): Promise<Object> {
opts = {
โ€ฆopts,
caller: CALLER,
filename,
};
return new Promise((resolve, reject) => {
babel.transform(code, opts, (err, result) => {
if (err) reject(err);
else resolve(result);
});
});
}
Image for post
Image for post

TOAST UI Grid๋Š” ์ง€๊ธˆ ์–ด๋–ป๊ฒŒ ํ•˜๊ณ ์žˆ๋‚˜?

Image for post
Image for post
toast ui grid ๊ด€๋ จ ๋ ˆํฌ๋“ค

Lerna ๋ž€?

Image for post
Image for post
Lerna์˜ ํžˆ๋“œ๋ผ. Lerna์˜ ์ƒ์ง•์ž…๋‹ˆ๋‹ค. ๐Ÿ‰

Lerna๋กœ ๋ฌด์—‡์„ ํ•  ์ˆ˜ ์žˆ๋‚˜?

$ lerna init
$ lerna init โ€” independent
$ lerna version 1.0.1 # explicit
$ lerna version patch # semver keyword
$ lerna version # select from prompt(s)
$ lerna diff [package]
$ lerna bootstrap
$ lerna run <script>
$ lerna run test
$ lerna run build
# my-component ํŒจํ‚ค์ง€๋งŒ test
$ lerna run โ€” scope my-component test
$ lerna publish
$ lerna clean
$ lerna link convert
Image for post
Image for post
lerna link convert ์ „ package.json
Image for post
Image for post
lerna link convert ํ›„ package.json

Mono-Repo ์ ์šฉ ํ•ด๋ณด๊ธฐ

๋…๋ฆฝ๋ฒ„์ „

$ lerna init โ€” independent
{
โ€œpackagesโ€: [
โ€œpackages/*โ€
],
โ€œversionโ€: โ€œindependentโ€
}
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
bower.json

ํ†ตํ•ฉ๋ฒ„์ „

{
โ€œpackagesโ€: [
โ€œpackages/*โ€
],
โ€œversionโ€: โ€œ0.0.0โ€
}
Image for post
Image for post
Image for post
Image for post
๋‹จ์ผ ๋ฒ„์ „ ๋ฆด๋ฆฌ์ฆˆ ๋…ธํŠธ
Image for post
Image for post

yarn workspace๋ฅผ ํ†ตํ•œ code sharing

{
โ€œpackagesโ€: [
โ€œpackages/*โ€
],
โ€œversionโ€: โ€œ0.0.0โ€,
โ€œnpmClientโ€: โ€œyarnโ€,
โ€œuseWorkspacesโ€: true
}
{
โ€œworkspacesโ€: [
โ€œpackages/*โ€
]
}
Image for post
Image for post
root ๊ฒฝ๋กœ์˜ node_modules์— ์ •๋ฆฌ๋œ ์˜์กด๋“ค

์˜คํ”ˆ์†Œ์Šค๋“ค์˜ ๋ฒ„์ „ ์ •์ฑ…

babel/babel

Image for post
Image for post
babel-noe์˜ ๋ฒ„์ „์ด ์‘ฅ!
Image for post
Image for post
babel์˜ ๋ฆด๋ฆฌ์ฆˆ๋…ธํŠธ

facebook/react

Image for post
Image for post

facebook/jest

Image for post
Image for post
์•„๋ฌด๊ฒƒ๋„ ์ž‘์„ฑ๋˜์ง€ ์•Š์•˜๋‹ค.

airbnb/enzyme

Image for post
Image for post
independent๋ฅผ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ ์ „ํ˜•์ ์ธ ํ˜•ํƒœ
Image for post
Image for post
๊ณต์‹ ์‚ฌ์ดํŠธ์˜ Change Log

๊ฐ€๋Šฅํ•œ ๋ฒ„์ „ ์ •์ฑ…์„ ์ •๋ฆฌํ•ด๋ณด๋ฉด?

Image for post
Image for post
๊ทธ๋ฆผ์€ Application์— ๋ž˜ํผ๋ฅผ ์ ์šฉํ–ˆ์„ ๋•Œ์˜ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค. ๊ฐ๊ฐ์„ ํŒจํ‚ค์ง€๋กœ ๋ด์ฃผ์‹œ๋ฉด ์ดํ•ดํ•˜๊ธฐ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Jung-han

๐ŸคŸ์˜คํ”ˆ์†Œ์Šค ๊ฐœ๋ฐœํ•˜๊ณ  ์žˆ๋Š” FE ๊ฐœ๋ฐœ์ž

Jung Han

Written by

Jung Han

๊ฐœ์ธ์šฉ ๋ธ”๋กœ๊ทธ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ข‹์€ ๊ฐœ๋ฐœ์ž๊ฐ€ ๊ฟˆ์ž…๋‹ˆ๋‹ค. > https://www.notion.so/Han-Jung-c43f4bcd2b3f4b3d85b93aee41c5e098

Jung-han

Jung-han

๐ŸคŸ์˜คํ”ˆ์†Œ์Šค ๊ฐœ๋ฐœํ•˜๊ณ  ์žˆ๋Š” FE ๊ฐœ๋ฐœ์ž

Jung Han

Written by

Jung Han

๊ฐœ์ธ์šฉ ๋ธ”๋กœ๊ทธ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ข‹์€ ๊ฐœ๋ฐœ์ž๊ฐ€ ๊ฟˆ์ž…๋‹ˆ๋‹ค. > https://www.notion.so/Han-Jung-c43f4bcd2b3f4b3d85b93aee41c5e098

Jung-han

Jung-han

๐ŸคŸ์˜คํ”ˆ์†Œ์Šค ๊ฐœ๋ฐœํ•˜๊ณ  ์žˆ๋Š” FE ๊ฐœ๋ฐœ์ž

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and youโ€™ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer โ€” welcome home. Itโ€™s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store