Jakub notes • engineering

Monorepo

Yarn Workspaces

Control from the root

I control all the workspaces from the root of the project.

yarn cli lint --fix
yarn web build
yarn ui storybook

package.json in the root of the project should have all the workspaces in scripts.

{
  "name": "myproject",
  "scripts": {
    "cli": "yarn workspace @myproject/cli",
    "web": "yarn workspace @myproject/web",
    "ui": "yarn workspace @myproject/ui"
  }
}

That creates a shortcut to all scripts defined in workspaces.

{
  "name": "@myproject/ui",
  "scripts": {
    "lint": "eslint .",
    "storybook": "start-storybook -p 6007"
  }
}