← ClaudeAtlas

bun-runtimelisted

Use when running, testing, or deploying projects with Bun, or migrating from Node. Covers the bun.lock vs bun.lockb version change, Bun.serve/Bun.file/bun:test APIs, key CLI flags, Node compatibility, and Vercel setup.
Mixard/fable-pack · ★ 1 · AI & Automation · score 74
Install: claude install-skill Mixard/fable-pack
# Bun Runtime All-in-one JS/TS runtime, package manager, bundler, and test runner. Built on JavaScriptCore (not V8), implemented in Zig. Runs `.ts` natively without a build step. ## Lockfile gotcha Current Bun writes a text lockfile `bun.lock`; older versions (pre-1.2) wrote binary `bun.lockb`. A repo may contain either — commit whichever the project uses. Newer Bun reads `bun.lockb` and migrates to `bun.lock`; older Bun cannot read `bun.lock`. Don't commit both. ## CLI ```bash bun install # replaces npm install bun install --frozen-lockfile # CI/deploys: fail instead of updating lockfile bun run dev # run package.json script bun src/index.ts # run a file directly (bun run also works) bun x cowsay hi # npx equivalent (also: bunx) bun run --env-file=.env dev # load env file explicitly (.env is auto-loaded by default) bun test # run tests; --watch for watch mode ``` ## Runtime APIs ```typescript // HTTP server Bun.serve({ port: 3000, fetch(req) { return new Response("Hello"); }, }); // Files (lazy — no I/O until read) const file = Bun.file("package.json"); const json = await file.json(); // also .text(), .arrayBuffer(), .stream() await Bun.write("out.txt", "content"); ``` Prefer Bun-native APIs over Node equivalents where they exist; they are faster. ## Testing (bun:test) Jest-like API, no config needed. Picks up `*.test.{ts,js,tsx,jsx}` and `*.spec.*`. ``