bun
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBun
Bun
Node.js 대신 Bun을 기본 런타임으로 사용.
替换Node.js使用Bun作为默认运行时。
설치
安装
bash
curl -fsSL https://bun.sh/install | bashbash
curl -fsSL https://bun.sh/install | bash명령어 매핑
命令映射
| Node.js / npm | Bun |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| Node.js / npm | Bun |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
프로젝트 초기화
项目初始化
bash
undefinedbash
undefined새 프로젝트
新项目
bun init
bun init
템플릿 사용
使用模板
bun create next-app my-app
bun create vite my-app
undefinedbun create next-app my-app
bun create vite my-app
undefined패키지 관리
包管理
bash
undefinedbash
undefined설치 (bun.lockb 생성)
安装(生成bun.lockb)
bun install
bun install
의존성 추가
添加依赖
bun add express zod
bun add -d typescript @types/node # devDependencies
bun add express zod
bun add -d typescript @types/node # devDependencies
삭제
删除
bun remove lodash
> lockfile: `bun.lockb` (바이너리). `.gitignore`에 추가하지 않음.bun remove lodash
> lockfile: `bun.lockb`(二进制文件)。无需添加到`.gitignore`中。스크립트 실행
脚本执行
bash
undefinedbash
undefinedpackage.json scripts
package.json中的脚本
bun run dev
bun run build
bun run dev
bun run build
파일 직접 실행 (TypeScript 지원)
直接执行文件(支持TypeScript)
bun index.ts
bun src/server.ts
bun index.ts
bun src/server.ts
단축 (run 생략 가능)
简写(可省略run)
bun dev
undefinedbun dev
undefinedGitHub Actions
GitHub Actions
yaml
- uses: oven-sh/setup-bun@v{N} # 최신 버전 확인: gh api repos/oven-sh/setup-bun/releases/latest --jq '.tag_name'
- run: bun install
- run: bun testyaml
- uses: oven-sh/setup-bun@v{N} # 查看最新版本: gh api repos/oven-sh/setup-bun/releases/latest --jq '.tag_name'
- run: bun install
- run: bun test