Learn more about how to leverage the default features of npm workspaces to help you manage your monorepo project while also checking out some of the new npm cli features.
workspaces Getting Started Using npm workspaces features Running scripts Installing new packages Managing workspaces properties Cutting releases of a workspace Executing package scripts What to be looking forward to
managing nested packages from a single top-level package Centralizes installation of all dependencies to a single node_modules folder Uses only a single package-lock.json file What is it? ` ` ` `
report & manage issues Single lint, build, test & release processes Eases coordination of changes across packages Eases development environment setup, troubleshooting Advantages
a monorepo, containing multiple workspaces with different web services and dev tooling. Monorepo App ├── slides │ Workspace that contains the source │ for this slide presentation. ├──────── Slidev ├── user-sync service │ Workspace that has a service that │ listens to an endpoint and stores │ user data received to the db. ├──────── Fastify ├──────── Prisma ├──────── Tap (tests) ├── webapp service │ Workspace with a service that │ serves the UI to render the user list. ├──────── Next.js ├──────── Tailwind CSS ├──────── Prisma └──────── Jest (tests)
By workspace path: The workspace argument can go anywhere: It’s possible to run scripts in the context of a workspace: $ npm -w workspace-a run dev $ npm -w @myscope/workspace-a run dev $ npm -w ./workspace-a run dev $ npm run dev -w ./workspace-a