C.W.K.
Stream
Lesson 03 of 05 · published

매일 치는 Bun 명령

~12 min · bun, commands, workflow

Level 0초심자
0 XP0/55 lessons0/16 achievements
0/80 XP to next level80 XP to go0% complete

Bun 의 CLI 가 의도적으로 친숙 — 대부분 npm/pnpm 머슬메모리 transfer. 차이는 Bun 이 새 거 추가하는 곳.

bun add <pkg> 가 런타임 dep 추가, npm 보다 극적으로 빠름. bun add -d <pkg> 가 dev dep. bun remove <pkg> 가 제거. bun installbun.lock 에서 모든 거 install; bun install --frozen-lockfile 이 CI 모드.

bun run <script> 가 package.json 스크립트 실행 — 또는 Bun 빌트인 아닌 스크립트엔 run 생략 가능 (bun build 가 Bun 자체 bundler, 너 빌드 스크립트 아님). bun index.ts 가 TypeScript 파일 직접 실행. bun test 가 빌트인 test runner — Jest 호환 API, 극적으로 빠름.

bun build 가 bundler. bunx <tool> 가 Bun 의 npx. bun pm <subcommand> 가 패키지 매니저 admin 작업 (예: bun pm migrate — yarn.lock 또는 pnpm-lock.yaml 을 bun.lock 으로 변환). bun audit 가 보안 audit (v1.3 추가). bun outdated 가 최신 registry 버전보다 뒤진 거 표시.

Code

매일 Bun — npm 모양, 더 빠름·bash
# 추가 / 제거
bun add express
bun add -d vitest typescript
bun remove express

# Install
bun install
bun install --frozen-lockfile    # CI 모드

# 스크립트 실행
bun run build                    # 명시적
bun build                        # Bun 의 bundler — 다른 명령
bun test                         # 빌트인 test runner
bun dev                          # 'bun run dev' 의 shorthand

# TS 파일 직접 실행 — 컴파일 없음
bun index.ts
bun src/server.tsx
Migrate + audit·bash
# yarn 또는 pnpm 에서 Bun 으로 마이그레이션
bun pm migrate

# 뭐가 outdated?
bun outdated

# 보안 스캔
bun audit

# install 없이 도구 실행
bunx create-vite my-app
Bun 빌트인 bundler — 빠름, esbuild 급·bash
# TypeScript entry point bundle
bun build ./src/index.ts --outdir ./dist --minify

# 브라우저용 bundle
bun build ./src/index.tsx --outdir ./dist --target browser

# Watch 모드
bun build ./src/index.ts --outdir ./dist --watch

External links

Exercise

진짜 npm 프로젝트에서 'bun pm migrate' 돌리고 install time 측정: 'time bun install'. 이전 'time npm install' 과 비교. 숫자가 레슨 — 보통 내일 새 프로젝트에서 Bun 시도 정당화할 만큼 극적.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.