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 framer-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 to 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.
Last updated on