Replace old docs with new docs repo (#24201)

This commit is contained in:
Lydia Hallie
2025-11-05 11:14:21 -08:00
committed by GitHub
parent 550522e99b
commit 1606a9f24e
407 changed files with 21970 additions and 17527 deletions

View File

@@ -0,0 +1,44 @@
---
title: Add a dependency
sidebarTitle: Add a dependency
mode: center
---
To add an npm package as a dependency, use `bun add`.
```sh terminal icon="terminal"
bun add zod
```
---
This will add the package to `dependencies` in `package.json`. By default, the `^` range specifier will be used, to indicate that any future minor or patch versions are acceptable.
```json package.json icon="file-json"
{
"dependencies": {
"zod": "^3.0.0" // [!code ++]
}
}
```
---
To "pin" to an exact version of the package, use `--exact`. This will add the package to `dependencies` without the `^`, pinning your project to the exact version you installed.
```sh terminal icon="terminal"
bun add zod --exact
```
---
To specify an exact version or a tag:
```sh terminal icon="terminal"
bun add zod@3.0.0
bun add zod@next
```
---
See [Docs > Package manager](https://bun.com/docs/cli/install) for complete documentation of Bun's package manager.