feat: whyrating - initial project from turbostarter boilerplate
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
---
|
||||
title: Managing dependencies
|
||||
description: Learn how to manage dependencies in your project.
|
||||
url: /docs/web/installation/dependencies
|
||||
---
|
||||
|
||||
# Managing dependencies
|
||||
|
||||
As the package manager we chose [pnpm](https://pnpm.io/).
|
||||
|
||||
<Callout title="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](https://pnpm.io/workspaces). Of course, you can change it to use [Bun](https://bunpkg.com), [yarn](https://yarnpkg.com) or [npm](https://www.npmjs.com) with minimal effort.
|
||||
</Callout>
|
||||
|
||||
## 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:
|
||||
|
||||
```bash
|
||||
pnpm add -w <package-name>
|
||||
```
|
||||
|
||||
To install a package to a specific workspace, run:
|
||||
|
||||
```bash
|
||||
pnpm add --filter <workspace-name> <package-name>
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
pnpm add --filter @turbostarter/ui motion
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
pnpm remove -w <package-name>
|
||||
```
|
||||
|
||||
To remove a package from a specific workspace, run:
|
||||
|
||||
```bash
|
||||
pnpm remove --filter <workspace-name> <package-name>
|
||||
```
|
||||
|
||||
## Update a package
|
||||
|
||||
Updating is a bit easier since there is a nice way to update a package in all workspaces at once:
|
||||
|
||||
```bash
|
||||
pnpm update -r <package-name>
|
||||
```
|
||||
|
||||
<Callout title="Semantic versioning">
|
||||
When you update a package, pnpm will respect the [semantic versioning](https://docs.npmjs.com/about-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.
|
||||
</Callout>
|
||||
|
||||
## Renovate bot
|
||||
|
||||
By default, TurboStarter comes with [Renovate](https://www.npmjs.com/package/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](https://docs.renovatebot.com/configuration-options/).
|
||||
|
||||
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.**
|
||||
|
||||
<Card href="https://docs.renovatebot.com" title="Renovate" description="renovatebot.com" />
|
||||
Reference in New Issue
Block a user