This repo uses Turborepo as a monorepo management tool
See Turborepo documentation for more details.
For the most part, the way you interact with NPM and a monorepo is the same as with a normal repo. The following commands remain the same, but will execute the corresponding task for all monorepo apps/packages (ie: workspaces) that have a task with the same name.
Read more about workspaces here
To install all apps and packages, run the following command from the root of the project:
npm ci
To build all apps and packages, run the following command from the root of the project:
npm run build
To run in development mode for all apps and packages, run the following command from the root of the project:
npm run dev
To run tests for all apps and packages, run the following command from the root of the project:
npm run test
To run linters for all apps and packages, run the following command from the root of the project:
npm run lint
To only run the task for one app/package, run the following command from the root of the project:
npm run dev --workspace <workspace>
The same pattern (--workspace <workspace>
) can be used for build
, test
, and lint
.
Dependencies are still managed in each app's package.json file. Within the context of a monorepo, you do need to make sure to target the appropriate workspace when you add/remove/update dependencies.
Use the following commands to add/remove/update dependencies within each app/package's context:
npm install <package> --workspace <workspace>
Example:
npm install react --workspace apps/ui
npm uninstall <package> --workspace <workspace>
Example:
npm uninstall react --workspace apps/ui
npm update <package> --workspace <workspace>
Example:
npm update react --workspace apps/ui