Managing dependencies
Learn how to manage dependencies in your project.
As the package manager we chose pnpm.
Why pnpm?
It is a fast, disk space efficient package manager that uses hard links and symlinks to save one version of a module only ever once on a disk. It also has a great monorepo support. Of course, you can change it to use Bun, yarn or npm with minimal effort.
Install dependency
To install a package you need to decide whether you want to install it to the root of the monorepo or to a specific workspace. Installing it to the root makes it available to all packages, while installing it to a specific workspace makes it available only to that workspace.
To install a package globally, run:
To install a package to a specific workspace, run:
For example:
It will install motion
to the @turbostarter/ui
workspace.
Remove dependency
Removing a package is the same as installing but with the remove
command.
To remove a package globally, run:
To remove a package from a specific workspace, run:
Update a package
Updating is a bit easier since there is a nice way to update a package in all workspaces at once:
Semantic versioning
When you update a package, pnpm will respect the semantic versioning rules defined in the package.json
file. If you want to update a package to the latest version, you can use the --latest
flag.
Renovate bot
By default, TurboStarter comes with Renovate enabled. It is a tool that helps you manage your dependencies by automatically creating pull requests to update your dependencies to the latest versions. You can find its configuration in the .github/renovate.json
file. Learn more about it in the official docs.
When it creates a pull request, it is treated as a normal PR, so all tests and preview deployments will run. It is recommended to always preview and test the changes in the staging environment before merging the PR to the main branch to avoid breaking the application.
Renovate
renovatebot.com
Last updated on