aboutsummaryrefslogtreecommitdiff
path: root/docs/cli/link.md
diff options
context:
space:
mode:
authorGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-14 12:58:30 -0700
committerGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-10-14 12:58:30 -0700
commitf9add8b6bea4df3cdbd56a21f17e4cab1a854e4e (patch)
tree8e5306104d81c67b771181337bba02cd9ec39453 /docs/cli/link.md
parent81a1a58d66c598ea35c42453d0ba4c6341a940fc (diff)
parent9b5e66453b0879ed77b71dcdbe50e4efa184261e (diff)
downloadbun-sdl.tar.gz
bun-sdl.tar.zst
bun-sdl.zip
Merge branch 'main' into sdlsdl
Diffstat (limited to 'docs/cli/link.md')
-rw-r--r--docs/cli/link.md46
1 files changed, 46 insertions, 0 deletions
diff --git a/docs/cli/link.md b/docs/cli/link.md
new file mode 100644
index 000000000..9adc73765
--- /dev/null
+++ b/docs/cli/link.md
@@ -0,0 +1,46 @@
+Use `bun link` in a local directory to register the current package as a "linkable" package.
+
+```bash
+$ cd /path/to/cool-pkg
+$ cat package.json
+{
+ "name": "cool-pkg",
+ "version": "1.0.0"
+}
+$ bun link
+bun link v1.x (7416672e)
+Success! Registered "cool-pkg"
+
+To use cool-pkg in a project, run:
+ bun link cool-pkg
+
+Or add it in dependencies in your package.json file:
+ "cool-pkg": "link:cool-pkg"
+```
+
+This package can now be "linked" into other projects using `bun link cool-pkg`. This will create a symlink in the `node_modules` directory of the target project, pointing to the local directory.
+
+```bash
+$ cd /path/to/my-app
+$ bun link cool-pkg
+```
+
+In addition, the `--save` flag can be used to add `cool-pkg` to the `dependencies` field of your app's package.json with a special version specifier that tells Bun to load from the registered local directory instead of installing from `npm`:
+
+```json-diff
+ {
+ "name": "my-app",
+ "version": "1.0.0",
+ "dependencies": {
++ "cool-pkg": "link:cool-pkg"
+ }
+ }
+```
+
+To _unregister_ a local package, navigate to the package's root directory and run `bun unlink`.
+
+```bash
+$ cd /path/to/cool-pkg
+$ bun unlink
+bun unlink v1.x (7416672e)
+```