diff options
author | 2023-07-31 12:20:23 -0700 | |
---|---|---|
committer | 2023-07-31 12:20:23 -0700 | |
commit | 404b90badc5856a74c06d04062c850003e28fed5 (patch) | |
tree | 7954623cf4a792db612d0bb229a227c2ff1e9fd8 /docs/guides/install/add.md | |
parent | 67599f97adc77141331a5f4fc39e4d058dc70b2a (diff) | |
download | bun-404b90badc5856a74c06d04062c850003e28fed5.tar.gz bun-404b90badc5856a74c06d04062c850003e28fed5.tar.zst bun-404b90badc5856a74c06d04062c850003e28fed5.zip |
Add ecosystem guides (#3847)
* Add ecosystem guides
* Update titles
* Rename stric
* Add unlink and fetch guides
* Add formdata guide
* Tweak title
* Moar
Diffstat (limited to 'docs/guides/install/add.md')
-rw-r--r-- | docs/guides/install/add.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/guides/install/add.md b/docs/guides/install/add.md new file mode 100644 index 000000000..dfb88e5e4 --- /dev/null +++ b/docs/guides/install/add.md @@ -0,0 +1,42 @@ +--- +name: Add a dependency +--- + +To add an npm package as a dependency, use `bun add`. + +```sh +$ 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-diff +{ + "dependencies": { ++ "zod": "^3.0.0" + } +} +``` + +--- + +To "pin" to the `latest` 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 +$ bun add zod --exact +``` + +--- + +To specify an exact version or a tag: + +```sh +$ bun add zod@3.0.0 +$ bun add zod@next +``` + +--- + +See [Docs > Package manager](/docs/cli/install) for complete documentation of Bun's package manager. |