Skip to content
cccskills
FreePublished on GitHub

bun-runtime

ランタイム、パッケージマネージャー、バンドラー、テストランナーとしてのBun。Bun vs Nodeの選択基準、マイグレーションノート、Vercelサポート。

The English summary is being prepared. Showing the original description.

Works withVercel
See how to install

Files included (1)

  • SKILL.md3.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Bunランタイム

Bunは高速なオールインワンJavaScriptランタイムおよびツールキットです:ランタイム、パッケージマネージャー、バンドラー、テストランナー。

使用タイミング

  • Bunを選ぶ場合: 新しいJS/TSプロジェクト、インストール/実行速度が重要なスクリプト、Bunランタイムを使用するVercelデプロイ、単一のツールチェーン(実行 + インストール + テスト + ビルド)が必要な場合。
  • Nodeを選ぶ場合: 最大限のエコシステム互換性、Nodeを前提としたレガシーツール、依存関係にBunの既知の問題がある場合。

Bunの導入、Nodeからのマイグレーション、Bunスクリプト/テストの作成やデバッグ、Vercelやその他のプラットフォームでのBun設定を行う際に使用してください。

動作の仕組み

  • ランタイム: Node互換のドロップインランタイム(JavaScriptCore上に構築、Zigで実装)。
  • パッケージマネージャー: bun installはnpm/yarnより大幅に高速。ロックファイルは現在のBunではデフォルトでbun.lock(テキスト)、古いバージョンではbun.lockb(バイナリ)。
  • バンドラー: アプリとライブラリ向けの組み込みバンドラーおよびトランスパイラー。
  • テストランナー: Jest風APIを持つ組み込みbun test。

Nodeからのマイグレーション: node script.jsをbun run script.jsまたはbun script.jsに置き換えます。npm installの代わりにbun installを実行、ほとんどのパッケージは動作します。npmスクリプトにはbun run、npxスタイルのワンオフ実行にはbun xを使用します。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とエコシステムは急速に進化している。

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

コーディングエージェント(Claude Code、Aider、Codexなど)のカスタムタスクによる直接比較。合格率、コスト、時間、一貫性メトリクスを測定

The English summary is being prepared. Showing the original description.

hage-oyaji/everything-claude-code-jp-local3Updated Mar 29, 2026

AIエージェントのアクションスペース、ツール定義、オブザベーションフォーマットを設計・最適化し、タスク完了率を向上させる

The English summary is being prepared. Showing the original description.

hage-oyaji/everything-claude-code-jp-local3Updated Mar 29, 2026

評価ファーストの実行、分解、コスト考慮型モデルルーティングによるエージェンティックエンジニアとしての運用

The English summary is being prepared. Showing the original description.

hage-oyaji/everything-claude-code-jp-local3Updated Mar 29, 2026

AIエージェントが実装出力の大部分を生成するチームのためのエンジニアリング運用モデル

The English summary is being prepared. Showing the original description.

hage-oyaji/everything-claude-code-jp-local3Updated Mar 29, 2026

AI支援開発のためのリグレッションテスト戦略。データベース依存なしのサンドボックスモードAPIテスト、自動バグチェックワークフロー、同一モデルがコードの作成とレビューを行う際のAIの盲点を検出するパターン。

The English summary is being prepared. Showing the original description.

hage-oyaji/everything-claude-code-jp-local3Updated Mar 29, 2026

AndroidおよびKotlin Multiplatformプロジェクトのためのクリーンアーキテクチャパターン — モジュール構成、依存関係ルール、UseCase、Repository、データレイヤーパターン

The English summary is being prepared. Showing the original description.

hage-oyaji/everything-claude-code-jp-local3Updated Mar 29, 2026

See all skills by hage-oyaji

Report a problem with this skill