옵션
집집 Skill 개발자 도구 bun-runtime

bun-runtime

affaan-m/ECC affaan-m/ECC

Bun을 자바스크립트 런타임, 패키지 관리자, 번들러 및 테스트 실행기로 사용하는 방법에 대한 지침을 제공하며, 여기에는 Node.js에서 마이그레이션하는 방법과 Vercel 배포 방법도 포함됩니다.

...모든 것을 확장하십시오
0
업데이트 된 시간 2026년 10월 1일

Bun 런타임

Bun은 런타임, 패키지 관리자, 번들러, 테스트 실행기를 모두 갖춘 빠르고 포괄적인 자바스크립트 런타임 및 툴킷입니다.

사용 시나리오

  • 다음의 경우 Bun을 권장합니다: 새로운 JS/TS 프로젝트, 설치/실행 속도가 중요한 스크립트, Bun 런타임을 사용하는 Vercel 배포, 그리고 단일 툴체인(실행 + 설치 + 테스트 + 빌드)을 원할 때.
  • 다음과 같은 경우에는 Node를 사용하는 것이 좋습니다: 생태계와의 최대 호환성이 필요한 경우, Node를 전제로 하는 레거시 툴을 사용하는 경우, 또는 의존성 라이브러리에 Bun 관련 알려진 문제가 있는 경우.

다음과 같은 경우에 사용하세요: Bun을 도입할 때, Node에서 마이그레이션할 때, Bun 스크립트/테스트를 작성하거나 디버깅할 때, Vercel 또는 기타 플랫폼에서 Bun을 구성할 때.

작동 원리

  • 런타임: Node와 호환되는 드롭인 런타임(JavaScriptCore 기반으로 구축, Zig로 구현).
  • 패키지 관리자: bun install npm/yarn보다 훨씬 빠릅니다. 현재 Bun에서는 기본적으로 bun.lock 현재 Bun에서는 기본적으로 (텍스트) 형식이며, 이전 버전에서는 bun.lockb (바이너리)를 사용했습니다.
  • 번들러: 앱 및 라이브러리를 위한 내장 번들러 및 트랜스파일러.
  • 테스트 실행기: bun test Jest와 유사한 API를 제공합니다.

Node에서 마이그레이션: node script.js 다음으로 bun run script.js 또는 bun script.js로 대체하십시오. bun install 를 실행하십시오 npm install를 실행하십시오; 대부분의 패키지가 작동합니다. npm 스크립트의 경우 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);
});

런타임 API

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 네이티브로 실행됩니다.
  • 의존성을 최신 상태로 유지하세요. Bun과 관련 생태계는 빠르게 발전하고 있습니다.
GitHub에서 보기
---
name: bun-runtime
description: Provides guidance on using Bun as a JavaScript runtime, package manager, bundler, and test runner, including migration from Node.js and Vercel deployment.
---

# Bun Runtime

Bun is a fast all-in-one JavaScript runtime and toolkit: runtime, package manager, bundler, and test runner.

## When to Use

- **Prefer Bun** for: new JS/TS projects, scripts where install/run speed matters, Vercel deployments with Bun runtime, and when you want a single toolchain (run + install + test + build).
- **Prefer Node** for: maximum ecosystem compatibility, legacy tooling that assumes Node, or when a dependency has known Bun issues.

Use when: adopting Bun, migrating from Node, writing or debugging Bun scripts/tests, or configuring Bun on Vercel or other platforms.

## How It Works

- **Runtime**: Drop-in Node-compatible runtime (built on JavaScriptCore, implemented in Zig).
- **Package manager**: `bun install` is significantly faster than npm/yarn. Lockfile is `bun.lock` (text) by default in current Bun; older versions used `bun.lockb` (binary).
- **Bundler**: Built-in bundler and transpiler for apps and libraries.
- **Test runner**: Built-in `bun test` with Jest-like API.

**Migration from Node**: Replace `node script.js` with `bun run script.js` or `bun script.js`. Run `bun install` in place of `npm install`; most packages work. Use `bun run` for npm scripts; `bun x` for npx-style one-off runs. Node built-ins are supported; prefer Bun APIs where they exist for better performance.

**Vercel**: Set runtime to Bun in project settings. Build: `bun run build` or `bun build ./src/index.ts --outdir=dist`. Install: `bun install --frozen-lockfile` for reproducible deploys.

## Examples

### Run and install

```bash
# 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
```

### Scripts and env

```bash
bun run --env-file=.env dev
FOO=bar bun run script.ts
```

### Testing

```bash
bun test
bun test --watch
```

```typescript
// test/example.test.ts
import { expect, test } from "bun:test";

test("add", () => {
  expect(1 + 2).toBe(3);
});
```

### Runtime API

```typescript
const file = Bun.file("package.json");
const json = await file.json();

Bun.serve({
  port: 3000,
  fetch(req) {
    return new Response("Hello");
  },
});
```

## Best Practices

- Commit the lockfile (`bun.lock` or `bun.lockb`) for reproducible installs.
- Prefer `bun run` for scripts. For TypeScript, Bun runs `.ts` natively.
- Keep dependencies up to date; Bun and the ecosystem evolve quickly.

모든 파일

1개 파일

bun-runtime 설치

스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.

ZIP 다운로드

저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.

git clone https://github.com/affaan-m/ECC/tree/main/skills/bun-runtime # Copy SKILL.md to your .claude/skills/ directory

복사 복사
빠른 설정: 스킬 폴더를 .claude/skills/로 복사하세요. Claude가 해당 스킬을 자동으로 감지하여 사용할 것입니다.
저장소 affaan-m/ECC

관련 스킬

algorithmic-art
업데이트 된 시간 2026년 8월 27일
systematic-debugging
업데이트 된 시간 2026년 9월 3일
tech-debt-tracker
업데이트 된 시간 2026년 8월 29일
continual-learning
업데이트 된 시간 2026년 9월 10일
OR