From 404b90badc5856a74c06d04062c850003e28fed5 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Mon, 31 Jul 2023 12:20:23 -0700 Subject: Add ecosystem guides (#3847) * Add ecosystem guides * Update titles * Rename stric * Add unlink and fetch guides * Add formdata guide * Tweak title * Moar --- docs/guides/install/add.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 docs/guides/install/add.md (limited to 'docs/guides/install/add.md') 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. -- cgit v1.2.3