next.jsturborepo

TurboRepo, run only some workspaces


this is my structure of workspaces:

I want to be able to run "run dev:web-1" , or "run dev:web-2" or "run dev:web-3" in which always ALL the packages are available one or 2 of the services are included

If I run "yarn dev" right now, everything fires up and i actually had to set the --concurrency to a higher value and i don't want to be doing that.


Solution

  • Ok, so after a longer look into the documentation, i found the --filter flag can be set several times on the turbo run command. So, my solution was to add scripts to my main package.json

      "scripts": {
        "build": "turbo run build",
        "dev": "turbo run dev",
        "lint": "turbo run lint",
        "format": "prettier --write \"**/*.{ts,tsx,md}\"",
        "dev:web-1": "turbo run dev --filter=web-1 --filter=service-2 --filter=service-3",
        "dev:screen": "turbo run dev --filter=web-2 --filter=service-1"
      },