Turbo
Turborepo is a command-line tool developed by Vercel that simplifies the management of monorepos. It allows you to create, manage and deploy multiple packages in a single repository with ease.
Turborepo uses a combination of Yarn Workspaces and Git to handle monorepos. It allows us to install dependencies for all packages in a single command and provides a simple way to update package dependencies across entire repositories. At Figuro, we use Yarn Workspaces to manage our monorepos, allowing us to manage multiple packages with a single yarn.lock
file and avoid duplicating dependencies.
Installing turbo
To use TurboRepo with Yarn Workspaces, we need to install it globally:
yarn global add vercel-turbo-repo
Then, we can navigate to our monorepo root directory and initialize it with TurboRepo:
turbo repo init
This will create a .turbo
directory with a configuration file where we can specify which packages we want to include in TurboRepo.
Using turbo
Once we have configured TurboRepo, we can use it to run commands across all packages in parallel. For example, to install dependencies for all packages, we can run:
turbo yarn
This will run yarn install
in all packages simultaneously, significantly reducing the time it takes to install dependencies.
We can also run other commands, such as building or testing, using TurboRepo. For example, to build all packages, we can run:
turbo yarn build
This will run yarn build
in all packages in parallel.
Overall, TurboRepo with Yarn Workspaces is a powerful combination that helps us speed up our development process and improve our productivity.