Moving to a Mono Repository | Building an NPM Package with TypeScript

Switching to a monorepo with NPM workspaces

Floriel
Full Human

--

Monorepo is a term that commonly refers to a repository containing multiple packages or applications. Instead of having a system of one repo/package, we can be tedious to work with when they are closely related, and you can work inside one repository.

In the JavaScript and TypeScript world, a few solutions exist to manage mono repositories. Package managers such as NPM and Yarn implemented their workspace features, and specialized tools exist to make mono repositories work better. Below is a list of a few solutions with brief descriptions from their websites:

Lerna

Lerna is a tool that optimizes the workflow around managing multi-package repositories with git and npm.

Lerna can also reduce the time and space requirements for numerous copies of packages in development and build environments — normally a downside of dividing a project into many separate NPM packages.

nx

Nx builds a project graph by analyzing your workspace, which it then uses to only rebuild what is necessary and to never run the same computation twice. Nx also helps establish structured code sharingand ownership management to keep…

--

--

Floriel
Full Human

Software Engineer and author of PurgeCSS — Writing articles about web development regularly