Skip to content

Latest commit

 

History

History
106 lines (68 loc) · 2.37 KB

MANAGE_REPOSITORY.md

File metadata and controls

106 lines (68 loc) · 2.37 KB

Manage Repository

Project Stack

Project Setup

To work with this repository you'll need to install yarn and lerna globally on your machine.

Installing yarn:

brew install yarn

Installing lerna:

yarn global add lerna

Commands

Bootstrap Project

To link all packages together and install all dependencies, you should use

lerna bootstrap

This will:

  • Install all external dependencies
  • Symlink together all the Lerna packages that are dependencies of each other.
  • Run prepublish in all bootstrapped packages.

With the help of yarn workspaces, any external dependency will be installed in the root and linked to all packages instead of installed in every package on it's own.

Adding workspace dependencies

yarn workspace <workspace_name> <command>

This will run the chosen Yarn command in the selected workspace.

Example:

yarn workspace @maf/b2b add @testing-library/react -D

This will add @testing-library/react as devDependency in your packages/b2b/package.json.

This command can be used to run any script you'd like on a specific workspace: test, dist and every script defined in the workspace package.json.

Adding root devDependencies

yarn add @babel/cli -DW

This will install @babel/cli as a devDependency on the monorepo root. the -D is for devDependency, the -W is to install in the root.

Running scripts on all workspaces

To run scripts on all workspaces, we use lerna.
All you need to do is run lerna run and the script you want.

This command will run the test script defined in every workspace

lerna run test

Running scripts on workspaces changed

lerna run test --since master

This will run test script defined in the workspaces that changed from master branch.

Print all changes in workspaces

lerna diff

This will print all the changes from master by commits.

Print which packages have been changed in workspace

lerna changed

This will print all packages changed from master by name.