[JavaScript] Tools for Monorepo

2024-01-23 hit count image

Let's see what tools are needed to use Monorepo in a project developed in JavaScript.

Outline

In this blog post, I will introduce the tools needed to use Monorepo in a project developed in JavaScript.

Blog Series

This blog is a series. You can check other blog posts through the following links.

How to start Monorepo

There are two ways to start Monorepo.

  • Using a package manager
  • Using a tool for Monorepo

In this blog post, I will introduce the package manager and the Monorepo tool to support Monorepo in a JavaScript project.

Package Manager

To configure Monorepo in a JavaScript project, you can use a package manager that supports Monorepo. The package managers that support Monorepo are pnpm, yarn, and npm.

Package managers that support Monorepo have the following characteristics.

기능pnpmyarnnpm
Support workspace
Isolated node_modules✅(default)
Hoisted node_modules✅(default)
Peer auto install
Plug’n’Play✅(default)
Zero-Installs
dependent patches
NodeJS version management
Lockfile✅(pnpm-lock.yaml)✅(yarn.lock)✅(package-lock.json)
Overwrite support✅(resolution)
Content-addressable repository
Dynamic package execution✅(pnpm dlx)✅(yarn dlx)✅(npx)
Listing licenses✅(pnpm licenses list)✅(Via a plugin)

Monorepo Tool

You can configure Monorepo with the Workspace feature provided by the package manager, but using a tool for Monorepo makes it easier to configure Monorepo. Also, using the Cache feature provided by the Monorepo tool, you can perform Build or CI faster.

There are Lerna, Nx, and Turborepo tools for Monorepo in JavaScript projects.

Lerna

Lerna is developed and managed as open source. It was acquired by Nx because it was difficult to manage with only the open source community.

Currently, you can use Lerna as it is, but since it has been incorporated into Nx, it is not certain whether Nx will support Lerna as much as their tool, so if you plan to use Lerna, consider using Nx or watching the trend a little more.

Nx

Nx is developed and provided by a company called Narwhal Technologies Inc.. This company provides tools and services related to the Angular framework. Nx was developed by a company that develops tools related to the Angular framework, so Nx was originally developed as a monorepo management tool for Angular applications. Currently, Nx also supports other frameworks such as React.

If you are going to develop a project with Angular framework, Nx is a great choice. Of course, Nx can be a good choice in other frameworks, but Nx developed around the Angular framework and the company that develops tools focused on Angular developed Nx, so it will perform better in the Angular framework.

The frameworks supported by Nx can be found through the following link.

Turborepo

Turborepo was developed by Jared Palmer, but in 2021, Vercel that develops and operates NextJS acquired it.

If you are going to develop a project with NextJS or React, Turborepo is a great choice. Especially, if you use NextJS, using Turborepo developed and managed by the same company will be better than using other tools.

The frameworks supported by Turborepo can be found through the following link.

Completed

In this blog post, I introduced the tools needed to use Monorepo in a project developed in JavaScript. You can configure Monorepo with the features provided by the package manager, but using a tool for Monorepo makes it easier to configure Monorepo and use various features.

If you are planning to configure a project as Monorepo, please consider introducing a tool for Monorepo in addition to the features of the package manager.

Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!

App promotion

You can use the applications that are created by this blog writer Deku.
Deku created the applications with Flutter.

If you have interested, please try to download them for free.

Posts