docs/zh-CN/skills/bun-runtime/SKILL.md
Bun 作为运行时、包管理器、打包器和测试运行器。何时选择 Bun 而非 Node、迁移注意事项以及 Vercel 支持。
npx skillsauth add niloykumarbarman/EVERYTHING-CLAUDE-CODE bun-runtimeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Bun 是一个快速的全能 JavaScript 运行时和工具集:运行时、包管理器、打包器和测试运行器。
在以下情况下使用:采用 Bun、从 Node 迁移、编写或调试 Bun 脚本/测试,或在 Vercel 或其他平台上配置 Bun。
bun install 比 npm/yarn 快得多。在当前 Bun 中,锁文件默认为 bun.lock(文本);旧版本使用 bun.lockb(二进制)。bun test,具有类似 Jest 的 API。从 Node 迁移:将 node script.js 替换为 bun run script.js 或 bun script.js。运行 bun install 代替 npm install;大多数包都能工作。使用 bun run 来执行 npm 脚本;使用 bun x 进行 npx 风格的临时运行。支持 Node 内置模块;在存在 Bun API 的地方优先使用它们以获得更好的性能。
Vercel:在项目设置中将运行时设置为 Bun。构建命令:bun run build 或 bun build ./src/index.ts --outdir=dist。安装命令:bun install --frozen-lockfile 用于可重复的部署。
# Install dependencies (creates/updates bun.lock or bun.lockb)
bun install
# Run a script or file
bun run dev
bun run src/index.ts
bun src/index.ts
bun run --env-file=.env dev
FOO=bar bun run script.ts
bun test
bun test --watch
// test/example.test.ts
import { expect, test } from "bun:test";
test("add", () => {
expect(1 + 2).toBe(3);
});
const file = Bun.file("package.json");
const json = await file.json();
Bun.serve({
port: 3000,
fetch(req) {
return new Response("Hello");
},
});
bun.lock 或 bun.lockb)以实现可重复的安装。bun run。对于 TypeScript,Bun 原生运行 .ts。tools
惯用的Kotlin模式、最佳实践和约定,用于构建健壮、高效且可维护的Kotlin应用程序,包括协程、空安全和DSL构建器。
development
Ktor 服务器模式,包括路由 DSL、插件、身份验证、Koin DI、kotlinx.serialization、WebSockets 和 testApplication 测试。
data-ai
JetBrains Exposed ORM 模式,包括 DSL 查询、DAO 模式、事务、HikariCP 连接池、Flyway 迁移和仓库模式。
tools
Kotlin协程与Flow在Android和KMP中的模式——结构化并发、Flow操作符、StateFlow、错误处理和测试。