diff --git a/README.md b/README.md index 465390d765..b7ba35323c 100644 --- a/README.md +++ b/README.md @@ -186,189 +186,189 @@ bun upgrade --canary ## Guides - Binary - - [Convert an ArrayBuffer to an array of numbers](https://bun.sh/guides/binary/arraybuffer-to-array) - - [Convert an ArrayBuffer to a Blob](https://bun.sh/guides/binary/arraybuffer-to-blob) - - [Convert an ArrayBuffer to a Buffer](https://bun.sh/guides/binary/arraybuffer-to-buffer) - - [Convert an ArrayBuffer to a string](https://bun.sh/guides/binary/arraybuffer-to-string) - - [Convert an ArrayBuffer to a Uint8Array](https://bun.sh/guides/binary/arraybuffer-to-typedarray) - - [Convert a Blob to an ArrayBuffer](https://bun.sh/guides/binary/blob-to-arraybuffer) - [Convert a Blob to a DataView](https://bun.sh/guides/binary/blob-to-dataview) - [Convert a Blob to a ReadableStream](https://bun.sh/guides/binary/blob-to-stream) - [Convert a Blob to a string](https://bun.sh/guides/binary/blob-to-string) - [Convert a Blob to a Uint8Array](https://bun.sh/guides/binary/blob-to-typedarray) - - [Convert a Buffer to an ArrayBuffer](https://bun.sh/guides/binary/buffer-to-arraybuffer) + - [Convert a Blob to an ArrayBuffer](https://bun.sh/guides/binary/blob-to-arraybuffer) - [Convert a Buffer to a blob](https://bun.sh/guides/binary/buffer-to-blob) - [Convert a Buffer to a ReadableStream](https://bun.sh/guides/binary/buffer-to-readablestream) - [Convert a Buffer to a string](https://bun.sh/guides/binary/buffer-to-string) - [Convert a Buffer to a Uint8Array](https://bun.sh/guides/binary/buffer-to-typedarray) + - [Convert a Buffer to an ArrayBuffer](https://bun.sh/guides/binary/buffer-to-arraybuffer) - [Convert a DataView to a string](https://bun.sh/guides/binary/dataview-to-string) - - [Convert a Uint8Array to an ArrayBuffer](https://bun.sh/guides/binary/typedarray-to-arraybuffer) - [Convert a Uint8Array to a Blob](https://bun.sh/guides/binary/typedarray-to-blob) - [Convert a Uint8Array to a Buffer](https://bun.sh/guides/binary/typedarray-to-buffer) - [Convert a Uint8Array to a DataView](https://bun.sh/guides/binary/typedarray-to-dataview) - [Convert a Uint8Array to a ReadableStream](https://bun.sh/guides/binary/typedarray-to-readablestream) - [Convert a Uint8Array to a string](https://bun.sh/guides/binary/typedarray-to-string) + - [Convert a Uint8Array to an ArrayBuffer](https://bun.sh/guides/binary/typedarray-to-arraybuffer) + - [Convert an ArrayBuffer to a Blob](https://bun.sh/guides/binary/arraybuffer-to-blob) + - [Convert an ArrayBuffer to a Buffer](https://bun.sh/guides/binary/arraybuffer-to-buffer) + - [Convert an ArrayBuffer to a string](https://bun.sh/guides/binary/arraybuffer-to-string) + - [Convert an ArrayBuffer to a Uint8Array](https://bun.sh/guides/binary/arraybuffer-to-typedarray) + - [Convert an ArrayBuffer to an array of numbers](https://bun.sh/guides/binary/arraybuffer-to-array) - Ecosystem + - [Build a frontend using Vite and Bun](https://bun.sh/guides/ecosystem/vite) - [Build an app with Astro and Bun](https://bun.sh/guides/ecosystem/astro) - - [Create a Discord bot](https://bun.sh/guides/ecosystem/discordjs) - - [Containerize a Bun application with Docker](https://bun.sh/guides/ecosystem/docker) - - [Use Drizzle ORM with Bun](https://bun.sh/guides/ecosystem/drizzle) - - [Use EdgeDB with Bun](https://bun.sh/guides/ecosystem/edgedb) + - [Build an app with Next.js and Bun](https://bun.sh/guides/ecosystem/nextjs) + - [Build an app with Nuxt and Bun](https://bun.sh/guides/ecosystem/nuxt) + - [Build an app with Qwik and Bun](https://bun.sh/guides/ecosystem/qwik) + - [Build an app with Remix and Bun](https://bun.sh/guides/ecosystem/remix) + - [Build an app with SolidStart and Bun](https://bun.sh/guides/ecosystem/solidstart) + - [Build an app with SvelteKit and Bun](https://bun.sh/guides/ecosystem/sveltekit) - [Build an HTTP server using Elysia and Bun](https://bun.sh/guides/ecosystem/elysia) - [Build an HTTP server using Express and Bun](https://bun.sh/guides/ecosystem/express) - [Build an HTTP server using Hono and Bun](https://bun.sh/guides/ecosystem/hono) - - [Read and write data to MongoDB using Mongoose and Bun](https://bun.sh/guides/ecosystem/mongoose) - - [Use Neon's Serverless Postgres with Bun](https://bun.sh/guides/ecosystem/neon-serverless-postgres) - - [Build an app with Next.js and Bun](https://bun.sh/guides/ecosystem/nextjs) - - [Build an app with Nuxt and Bun](https://bun.sh/guides/ecosystem/nuxt) - - [Run Bun as a daemon with PM2](https://bun.sh/guides/ecosystem/pm2) - - [Use Prisma with Bun](https://bun.sh/guides/ecosystem/prisma) - - [Build an app with Qwik and Bun](https://bun.sh/guides/ecosystem/qwik) - - [Use React and JSX](https://bun.sh/guides/ecosystem/react) - - [Build an app with Remix and Bun](https://bun.sh/guides/ecosystem/remix) - - [Build an app with SolidStart and Bun](https://bun.sh/guides/ecosystem/solidstart) - - [Server-side render (SSR) a React component](https://bun.sh/guides/ecosystem/ssr-react) - [Build an HTTP server using StricJS and Bun](https://bun.sh/guides/ecosystem/stric) - - [Build an app with SvelteKit and Bun](https://bun.sh/guides/ecosystem/sveltekit) + - [Containerize a Bun application with Docker](https://bun.sh/guides/ecosystem/docker) + - [Create a Discord bot](https://bun.sh/guides/ecosystem/discordjs) + - [Read and write data to MongoDB using Mongoose and Bun](https://bun.sh/guides/ecosystem/mongoose) + - [Run Bun as a daemon with PM2](https://bun.sh/guides/ecosystem/pm2) - [Run Bun as a daemon with systemd](https://bun.sh/guides/ecosystem/systemd) - - [Build a frontend using Vite and Bun](https://bun.sh/guides/ecosystem/vite) + - [Server-side render (SSR) a React component](https://bun.sh/guides/ecosystem/ssr-react) + - [Use Drizzle ORM with Bun](https://bun.sh/guides/ecosystem/drizzle) + - [Use EdgeDB with Bun](https://bun.sh/guides/ecosystem/edgedb) + - [Use Neon's Serverless Postgres with Bun](https://bun.sh/guides/ecosystem/neon-serverless-postgres) + - [Use Prisma with Bun](https://bun.sh/guides/ecosystem/prisma) + - [Use React and JSX](https://bun.sh/guides/ecosystem/react) - HTTP + - [Common HTTP server usage](https://bun.sh/guides/http/server) + - [Configure TLS on an HTTP server](https://bun.sh/guides/http/tls) - [fetch with unix domain sockets in Bun](https://bun.sh/guides/http/fetch-unix) - - [Send an HTTP request using fetch](https://bun.sh/guides/http/fetch) - - [Upload files via HTTP using FormData](https://bun.sh/guides/http/file-uploads) - [Hot reload an HTTP server](https://bun.sh/guides/http/hot) - [Proxy HTTP requests using fetch()](https://bun.sh/guides/http/proxy) - - [Common HTTP server usage](https://bun.sh/guides/http/server) - - [Write a simple HTTP server](https://bun.sh/guides/http/simple) + - [Send an HTTP request using fetch](https://bun.sh/guides/http/fetch) - [Stream a file as an HTTP Response](https://bun.sh/guides/http/stream-file) - [Streaming HTTP Server with Async Iterators](https://bun.sh/guides/http/stream-iterator) - [Streaming HTTP Server with Node.js Streams](https://bun.sh/guides/http/stream-node-streams-in-bun) - - [Configure TLS on an HTTP server](https://bun.sh/guides/http/tls) + - [Upload files via HTTP using FormData](https://bun.sh/guides/http/file-uploads) + - [Write a simple HTTP server](https://bun.sh/guides/http/simple) - Install + - [Add a dependency](https://bun.sh/guides/install/add) - [Add a development dependency](https://bun.sh/guides/install/add-dev) - [Add a Git dependency](https://bun.sh/guides/install/add-git) - - [Add an optional dependency](https://bun.sh/guides/install/add-optional) - [Add a peer dependency](https://bun.sh/guides/install/add-peer) - [Add a tarball dependency](https://bun.sh/guides/install/add-tarball) - - [Add a dependency](https://bun.sh/guides/install/add) - - [Using bun install with an Azure Artifacts npm registry](https://bun.sh/guides/install/azure-artifacts) - - [Install dependencies with Bun in GitHub Actions](https://bun.sh/guides/install/cicd) - - [Override the default npm registry for bun install](https://bun.sh/guides/install/custom-registry) - - [Configure git to diff Bun's lockb lockfile](https://bun.sh/guides/install/git-diff-bun-lockfile) - - [Using bun install with Artifactory](https://bun.sh/guides/install/jfrog-artifactory) - - [Install a package under a different name](https://bun.sh/guides/install/npm-alias) - - [Configure a private registry for an organization scope with bun install](https://bun.sh/guides/install/registry-scope) - [Add a trusted dependency](https://bun.sh/guides/install/trusted) + - [Add an optional dependency](https://bun.sh/guides/install/add-optional) + - [Configure a private registry for an organization scope with bun install](https://bun.sh/guides/install/registry-scope) + - [Configure git to diff Bun's lockb lockfile](https://bun.sh/guides/install/git-diff-bun-lockfile) - [Configuring a monorepo using workspaces](https://bun.sh/guides/install/workspaces) - [Generate a human-readable lockfile](https://bun.sh/guides/install/yarnlock) + - [Install a package under a different name](https://bun.sh/guides/install/npm-alias) + - [Install dependencies with Bun in GitHub Actions](https://bun.sh/guides/install/cicd) + - [Override the default npm registry for bun install](https://bun.sh/guides/install/custom-registry) + - [Using bun install with an Azure Artifacts npm registry](https://bun.sh/guides/install/azure-artifacts) + - [Using bun install with Artifactory](https://bun.sh/guides/install/jfrog-artifactory) - Process - - [Parse command-line arguments](https://bun.sh/guides/process/argv) - - [Listen for CTRL+C](https://bun.sh/guides/process/ctrl-c) - - [Spawn a child process and communicate using IPC](https://bun.sh/guides/process/ipc) - [Get the process uptime in nanoseconds](https://bun.sh/guides/process/nanoseconds) + - [Listen for CTRL+C](https://bun.sh/guides/process/ctrl-c) - [Listen to OS signals](https://bun.sh/guides/process/os-signals) + - [Parse command-line arguments](https://bun.sh/guides/process/argv) + - [Read from stdin](https://bun.sh/guides/process/stdin) - [Read stderr from a child process](https://bun.sh/guides/process/spawn-stderr) - [Read stdout from a child process](https://bun.sh/guides/process/spawn-stdout) - [Spawn a child process](https://bun.sh/guides/process/spawn) - - [Read from stdin](https://bun.sh/guides/process/stdin) + - [Spawn a child process and communicate using IPC](https://bun.sh/guides/process/ipc) - Read file - - [Read a file to an ArrayBuffer](https://bun.sh/guides/read-file/arraybuffer) - - [Read a file to a Buffer](https://bun.sh/guides/read-file/buffer) - [Check if a file exists](https://bun.sh/guides/read-file/exists) - - [Read a JSON file](https://bun.sh/guides/read-file/json) - [Get the MIME type of a file](https://bun.sh/guides/read-file/mime) - [Read a file as a ReadableStream](https://bun.sh/guides/read-file/stream) - [Read a file as a string](https://bun.sh/guides/read-file/string) + - [Read a file to a Buffer](https://bun.sh/guides/read-file/buffer) - [Read a file to a Uint8Array](https://bun.sh/guides/read-file/uint8array) + - [Read a file to an ArrayBuffer](https://bun.sh/guides/read-file/arraybuffer) + - [Read a JSON file](https://bun.sh/guides/read-file/json) - [Watch a directory for changes](https://bun.sh/guides/read-file/watch) - Runtime - - [Install and run Bun in GitHub Actions](https://bun.sh/guides/runtime/cicd) - - [Define and replace static globals & constants](https://bun.sh/guides/runtime/define-constant) - - [Import HTML file as text](https://bun.sh/guides/runtime/import-html) - - [Import a JSON file](https://bun.sh/guides/runtime/import-json) - - [Import a TOML file](https://bun.sh/guides/runtime/import-toml) - - [Read environment variables](https://bun.sh/guides/runtime/read-env) - - [Set environment variables](https://bun.sh/guides/runtime/set-env) - - [Run a Shell Command](https://bun.sh/guides/runtime/shell) - - [Set a time zone in Bun](https://bun.sh/guides/runtime/timezone) - - [Re-map import paths](https://bun.sh/guides/runtime/tsconfig-paths) - - [Install TypeScript declarations for Bun](https://bun.sh/guides/runtime/typescript) - [Debugging Bun with the VS Code extension](https://bun.sh/guides/runtime/vscode-debugger) - [Debugging Bun with the web debugger](https://bun.sh/guides/runtime/web-debugger) + - [Define and replace static globals & constants](https://bun.sh/guides/runtime/define-constant) + - [Import a JSON file](https://bun.sh/guides/runtime/import-json) + - [Import a TOML file](https://bun.sh/guides/runtime/import-toml) + - [Import HTML file as text](https://bun.sh/guides/runtime/import-html) + - [Install and run Bun in GitHub Actions](https://bun.sh/guides/runtime/cicd) + - [Install TypeScript declarations for Bun](https://bun.sh/guides/runtime/typescript) + - [Re-map import paths](https://bun.sh/guides/runtime/tsconfig-paths) + - [Read environment variables](https://bun.sh/guides/runtime/read-env) + - [Run a Shell Command](https://bun.sh/guides/runtime/shell) + - [Set a time zone in Bun](https://bun.sh/guides/runtime/timezone) + - [Set environment variables](https://bun.sh/guides/runtime/set-env) - Streams - - [Convert a Node.js Readable to an ArrayBuffer](https://bun.sh/guides/streams/node-readable-to-arraybuffer) - [Convert a Node.js Readable to a Blob](https://bun.sh/guides/streams/node-readable-to-blob) - - [Convert a Node.js Readable to JSON](https://bun.sh/guides/streams/node-readable-to-json) - [Convert a Node.js Readable to a string](https://bun.sh/guides/streams/node-readable-to-string) - - [Convert a ReadableStream to an array of chunks](https://bun.sh/guides/streams/to-array) - - [Convert a ReadableStream to an ArrayBuffer](https://bun.sh/guides/streams/to-arraybuffer) + - [Convert a Node.js Readable to an ArrayBuffer](https://bun.sh/guides/streams/node-readable-to-arraybuffer) + - [Convert a Node.js Readable to JSON](https://bun.sh/guides/streams/node-readable-to-json) - [Convert a ReadableStream to a Blob](https://bun.sh/guides/streams/to-blob) - [Convert a ReadableStream to a Buffer](https://bun.sh/guides/streams/to-buffer) - - [Convert a ReadableStream to JSON](https://bun.sh/guides/streams/to-json) - [Convert a ReadableStream to a string](https://bun.sh/guides/streams/to-string) - [Convert a ReadableStream to a Uint8Array](https://bun.sh/guides/streams/to-typedarray) + - [Convert a ReadableStream to an array of chunks](https://bun.sh/guides/streams/to-array) + - [Convert a ReadableStream to an ArrayBuffer](https://bun.sh/guides/streams/to-arraybuffer) + - [Convert a ReadableStream to JSON](https://bun.sh/guides/streams/to-json) - Test - [Bail early with the Bun test runner](https://bun.sh/guides/test/bail) - - [Set a code coverage threshold with the Bun test runner](https://bun.sh/guides/test/coverage-threshold) - [Generate code coverage reports with the Bun test runner](https://bun.sh/guides/test/coverage) - - [Write browser DOM tests with Bun and happy-dom](https://bun.sh/guides/test/happy-dom) + - [Mark a test as a "todo" with the Bun test runner](https://bun.sh/guides/test/todo-tests) - [Migrate from Jest to Bun's test runner](https://bun.sh/guides/test/migrate-from-jest) - - [Set the system time in Bun's test runner](https://bun.sh/guides/test/mock-clock) - [Mock functions in `bun test`](https://bun.sh/guides/test/mock-functions) - [Re-run tests multiple times with the Bun test runner](https://bun.sh/guides/test/rerun-each) - - [Run your tests with the Bun test runner](https://bun.sh/guides/test/run-tests) - - [Skip tests with the Bun test runner](https://bun.sh/guides/test/skip-tests) - - [Use snapshot testing in `bun test`](https://bun.sh/guides/test/snapshot) - - [Spy on methods in `bun test`](https://bun.sh/guides/test/spy-on) - - [Set a per-test timeout with the Bun test runner](https://bun.sh/guides/test/timeout) - - [Mark a test as a "todo" with the Bun test runner](https://bun.sh/guides/test/todo-tests) - - [Update snapshots in `bun test`](https://bun.sh/guides/test/update-snapshots) - [Run tests in watch mode with Bun](https://bun.sh/guides/test/watch-mode) + - [Run your tests with the Bun test runner](https://bun.sh/guides/test/run-tests) + - [Set a code coverage threshold with the Bun test runner](https://bun.sh/guides/test/coverage-threshold) + - [Set a per-test timeout with the Bun test runner](https://bun.sh/guides/test/timeout) + - [Set the system time in Bun's test runner](https://bun.sh/guides/test/mock-clock) + - [Skip tests with the Bun test runner](https://bun.sh/guides/test/skip-tests) + - [Spy on methods in `bun test`](https://bun.sh/guides/test/spy-on) + - [Update snapshots in `bun test`](https://bun.sh/guides/test/update-snapshots) + - [Use snapshot testing in `bun test`](https://bun.sh/guides/test/snapshot) + - [Write browser DOM tests with Bun and happy-dom](https://bun.sh/guides/test/happy-dom) - Util - - [Encode and decode base64 strings](https://bun.sh/guides/util/base64) + - [Check if the current file is the entrypoint](https://bun.sh/guides/util/entrypoint) - [Check if two objects are deeply equal](https://bun.sh/guides/util/deep-equals) - [Compress and decompress data with DEFLATE](https://bun.sh/guides/util/deflate) - - [Detect when code is executed with Bun](https://bun.sh/guides/util/detect-bun) - - [Check if the current file is the entrypoint](https://bun.sh/guides/util/entrypoint) - - [Escape an HTML string](https://bun.sh/guides/util/escape-html) - - [Convert a file URL to an absolute path](https://bun.sh/guides/util/file-url-to-path) - [Compress and decompress data with gzip](https://bun.sh/guides/util/gzip) - - [Hash a password](https://bun.sh/guides/util/hash-a-password) - - [Get the directory of the current file](https://bun.sh/guides/util/import-meta-dir) - - [Get the file name of the current file](https://bun.sh/guides/util/import-meta-file) + - [Convert a file URL to an absolute path](https://bun.sh/guides/util/file-url-to-path) + - [Convert an absolute path to a file URL](https://bun.sh/guides/util/path-to-file-url) + - [Detect when code is executed with Bun](https://bun.sh/guides/util/detect-bun) + - [Encode and decode base64 strings](https://bun.sh/guides/util/base64) + - [Escape an HTML string](https://bun.sh/guides/util/escape-html) - [Get the absolute path of the current file](https://bun.sh/guides/util/import-meta-path) - [Get the absolute path to the current entrypoint](https://bun.sh/guides/util/main) - - [Convert an absolute path to a file URL](https://bun.sh/guides/util/path-to-file-url) - - [Sleep for a fixed number of milliseconds](https://bun.sh/guides/util/sleep) - [Get the current Bun version](https://bun.sh/guides/util/version) + - [Get the directory of the current file](https://bun.sh/guides/util/import-meta-dir) + - [Get the file name of the current file](https://bun.sh/guides/util/import-meta-file) - [Get the path to an executable bin file](https://bun.sh/guides/util/which-path-to-executable-bin) + - [Hash a password](https://bun.sh/guides/util/hash-a-password) + - [Sleep for a fixed number of milliseconds](https://bun.sh/guides/util/sleep) - WebSocket - - [Enable compression for WebSocket messages](https://bun.sh/guides/websocket/compression) - - [Set per-socket contextual data on a WebSocket](https://bun.sh/guides/websocket/context) - [Build a publish-subscribe WebSocket server](https://bun.sh/guides/websocket/pubsub) - [Build a simple WebSocket server](https://bun.sh/guides/websocket/simple) + - [Enable compression for WebSocket messages](https://bun.sh/guides/websocket/compression) + - [Set per-socket contextual data on a WebSocket](https://bun.sh/guides/websocket/context) - Write file - [Append content to a file](https://bun.sh/guides/write-file/append) - - [Write a string to a file](https://bun.sh/guides/write-file/basic) - - [Write a Blob to a file](https://bun.sh/guides/write-file/blob) - - [Write a file to stdout](https://bun.sh/guides/write-file/cat) - [Copy a file to another location](https://bun.sh/guides/write-file/file-cp) - - [Write a file incrementally](https://bun.sh/guides/write-file/filesink) - - [Write a Response to a file](https://bun.sh/guides/write-file/response) - - [Write to stdout](https://bun.sh/guides/write-file/stdout) - - [Write a ReadableStream to a file](https://bun.sh/guides/write-file/stream) - [Delete a file](https://bun.sh/guides/write-file/unlink) + - [Write a Blob to a file](https://bun.sh/guides/write-file/blob) + - [Write a file incrementally](https://bun.sh/guides/write-file/filesink) + - [Write a file to stdout](https://bun.sh/guides/write-file/cat) + - [Write a ReadableStream to a file](https://bun.sh/guides/write-file/stream) + - [Write a Response to a file](https://bun.sh/guides/write-file/response) + - [Write a string to a file](https://bun.sh/guides/write-file/basic) + - [Write to stdout](https://bun.sh/guides/write-file/stdout) ## Contributing diff --git a/scripts/nav2readme.ts b/scripts/nav2readme.ts index 36de605e43..4beeabb107 100644 --- a/scripts/nav2readme.ts +++ b/scripts/nav2readme.ts @@ -11,6 +11,7 @@ import path from "path"; function getQuickLinks() { let md = ""; + // This ordering is intentional for (const item of nav.items) { if (item.type === "divider") { md += "\n" + `- ${item.title}` + "\n"; @@ -47,7 +48,20 @@ async function getGuides() { const files = await Promise.all(promises); md += "## Guides " + "\n"; - files.sort((a, b) => a.file.localeCompare(b.file)); + // The guides ordering is not as intentional + // They should be grouped by category + // and then by name within the category + files.sort((a, b) => { + const aDir = path.basename(path.dirname(a.file)).toLowerCase(); + const bDir = path.basename(path.dirname(b.file)).toLowerCase(); + let cmp = aDir.localeCompare(bDir); + if (cmp !== 0) { + return cmp; + } + + return a.name.localeCompare(b.name); + }); + let prevDirname = ""; for (const { name, file } of files) { const dirname = path.basename(path.dirname(file));