aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-07-31 13:57:17 -0700
committerGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-07-31 13:57:17 -0700
commit90991da908b0725802db63d9fd8d5b4de1eb21a5 (patch)
treebb1e71bce28124e63944b0a47722ed925aa35687
parent404b90badc5856a74c06d04062c850003e28fed5 (diff)
downloadbun-90991da908b0725802db63d9fd8d5b4de1eb21a5.tar.gz
bun-90991da908b0725802db63d9fd8d5b4de1eb21a5.tar.zst
bun-90991da908b0725802db63d9fd8d5b4de1eb21a5.zip
Update titles, add Workspaces guide
-rwxr-xr-xbun.lockbbin73269 -> 73269 bytes
-rw-r--r--docs/guides/ecosystem/elysia.md2
-rw-r--r--docs/guides/ecosystem/express.md2
-rw-r--r--docs/guides/ecosystem/hono.md2
-rw-r--r--docs/guides/ecosystem/mongoose.md2
-rw-r--r--docs/guides/ecosystem/stric.md2
-rw-r--r--docs/guides/ecosystem/vite.md2
-rw-r--r--docs/guides/install/workspaces.md68
-rw-r--r--docs/guides/util/base64.md15
9 files changed, 89 insertions, 6 deletions
diff --git a/bun.lockb b/bun.lockb
index ac7b5dac5..19dd97bbd 100755
--- a/bun.lockb
+++ b/bun.lockb
Binary files differ
diff --git a/docs/guides/ecosystem/elysia.md b/docs/guides/ecosystem/elysia.md
index b0231ff95..ae1a8e37b 100644
--- a/docs/guides/ecosystem/elysia.md
+++ b/docs/guides/ecosystem/elysia.md
@@ -1,5 +1,5 @@
---
-name: Build an HTTP server using Elysia
+name: Build an HTTP server using Elysia and Bun
---
[Elysia](https://elysiajs.com) is a Bun-first performance focused web framework that takes full advantage of Bun's HTTP, file system, and hot reloading APIs. Get started with `bun create`.
diff --git a/docs/guides/ecosystem/express.md b/docs/guides/ecosystem/express.md
index 55bd468bd..211e117c4 100644
--- a/docs/guides/ecosystem/express.md
+++ b/docs/guides/ecosystem/express.md
@@ -1,5 +1,5 @@
---
-name: Build an HTTP server using Express
+name: Build an HTTP server using Express and Bun
---
Express and other major Node.js HTTP libraries should work out of the box. Bun implements the [`node:http`](https://nodejs.org/api/http.html) and [`node:https`](https://nodejs.org/api/https.html) modules that these libraries rely on.
diff --git a/docs/guides/ecosystem/hono.md b/docs/guides/ecosystem/hono.md
index f0497da1f..6d928a655 100644
--- a/docs/guides/ecosystem/hono.md
+++ b/docs/guides/ecosystem/hono.md
@@ -1,5 +1,5 @@
---
-name: Build an HTTP server using Hono
+name: Build an HTTP server using Hono and Bun
---
[Hono](https://github.com/honojs/hono) is a lightweight ultrafast web framework designed for the edge.
diff --git a/docs/guides/ecosystem/mongoose.md b/docs/guides/ecosystem/mongoose.md
index 406d2e77e..bfcb957cc 100644
--- a/docs/guides/ecosystem/mongoose.md
+++ b/docs/guides/ecosystem/mongoose.md
@@ -1,5 +1,5 @@
---
-name: Read and write data to MongoDB using Mongoose
+name: Read and write data to MongoDB using Mongoose and Bun
---
MongoDB and Mongoose work out of the box with Bun. This guide assumes you've already installed MongoDB and are running it as background process/service on your development machine. Follow [this guide](https://www.mongodb.com/docs/manual/installation/) for details.
diff --git a/docs/guides/ecosystem/stric.md b/docs/guides/ecosystem/stric.md
index 309a85709..102bd339f 100644
--- a/docs/guides/ecosystem/stric.md
+++ b/docs/guides/ecosystem/stric.md
@@ -1,5 +1,5 @@
---
-name: Build an HTTP server using StricJS
+name: Build an HTTP server using StricJS and Bun
---
[StricJS](https://github.com/bunsvr) is a minimalist, fast web framework for Bun. Use `bun init` to create an empty project.
diff --git a/docs/guides/ecosystem/vite.md b/docs/guides/ecosystem/vite.md
index 62c116e02..857e11aae 100644
--- a/docs/guides/ecosystem/vite.md
+++ b/docs/guides/ecosystem/vite.md
@@ -1,5 +1,5 @@
---
-name: Build a frontend using Vite
+name: Build a frontend using Vite and Bun
---
{% callout %}
diff --git a/docs/guides/install/workspaces.md b/docs/guides/install/workspaces.md
new file mode 100644
index 000000000..7c359b285
--- /dev/null
+++ b/docs/guides/install/workspaces.md
@@ -0,0 +1,68 @@
+---
+name: Configuring a monorepo using workspaces
+---
+
+Bun's package manager supports npm `"workspaces"`. This allows you to split a codebase into multiple distinct "packages" that live in the same repository, can depend on each other, and (when possible) share a `node_modules` directory.
+
+---
+
+The root `package.json` should not contain any `"dependencies"`, `"devDependencies"`, etc. Each individual package should be self-contained and declare its own dependencies. Similarly, it's conventional to declare `"private": true` to avoid accidentally publishing the root package to `npm`.
+
+```json#package.json
+{
+ "name": "my-monorepo",
+ "private": true,
+ "workspaces": [
+ "packages/*"
+ ]
+}
+```
+
+---
+
+It's common to place all packages in a `packages` directory. The `"workspaces"` field in package.json supports glob patterns, so you can use `packages/*` to indicate that each subdirectory of `packages` should be considered separate _package_ (also known as a workspace).
+
+```txt
+.
+├── package.json
+├── node_modules
+└── packages
+ ├── stuff-a
+ │ └── package.json
+ └── stuff-b
+ └── package.json
+```
+
+---
+
+To add one workspace as a dependency of another, modify its `package.json`. Here were adding `stuff-a` as a dependency of `stuff-b`.
+
+```json#packages/stuff-b/package.json
+{
+ "name": "stuff-b",
+ "dependencies": {
++ "stuff-a": "*"
+ }
+}
+```
+
+---
+
+Once added, run `bun install` from the project root to install dependencies for all workspaces.
+
+```sh
+$ bun install
+```
+
+---
+
+To add npm dependencies to a particular workspace, just `cd` to the appropriate directory and run `bun add` commands as you would normally. Bun will detect that you are in a workspace and hoist the dependency as needed.
+
+```sh
+$ cd packages/stuff-a
+$ bun add zod
+```
+
+---
+
+See [Docs > Package manager](/docs/cli/install) for complete documentation of Bun's package manager.
diff --git a/docs/guides/util/base64.md b/docs/guides/util/base64.md
new file mode 100644
index 000000000..06003f062
--- /dev/null
+++ b/docs/guides/util/base64.md
@@ -0,0 +1,15 @@
+---
+name: Encode and decode base64 strings
+---
+
+Bun implements the Web-standard [`atob`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/atob) and [`btoa`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa) functions for encoding and decoding base64 strings.
+
+```ts
+const data = "hello world";
+const encoded = btoa(data); // => "aGVsbG8gd29ybGQ="
+const decoded = atob(encoded); // => "hello world"
+```
+
+---
+
+See [Docs > API > Hashing](/docs/api/hashing#bun-password) for complete documentation.