ローカルでのセットアップ・開発・デバッグ・テスト方針。
- Bun (>= 1.2):
curl -fsSL https://bun.sh/install | bash - Git
- (推奨)
bunx skillsで Agent Skills を更新可能
rg (ripgrep) があれば検索が高速。なくてもよい。
git clone git@github.com:ido-bata/ido-bata.github.io.git
cd ido-bata.github.io
bun install| コマンド | 用途 |
|---|---|
bun run dev |
ローカル開発 (http://localhost:3000) |
bun run build |
本番ビルド (./out に静的書き出し) |
bun run lint |
ESLint |
bun run typecheck |
TypeScript 型チェック |
bun run format |
Prettier で一括整形 |
bun run format:check |
CI 用: 整形済みかを検査 |
bun run test |
テスト実行(test:unit + test:e2e) |
bun run test:unit |
Vitest(happy-dom, React Testing Library) |
bun run test:e2e |
Playwright(Chromium, tests/e2e/**) |
bun run test:e2e:install |
Playwright ブラウザ初期化(Chromium + 依存) |
- Issue を確認 / 作成する
release-x-y-zから branch を切る:git checkout -b <issue-number> release-x-y-z- 実装し、
bun run lint && bun run typecheck && bun run buildがローカルで green になることを確認 - 最初の意味のある commit 後に Draft PR を作る
- レビュー後に Ready 化し、
release-x-y-zへマージ - sprint の最後に
release-x-y-z→mainの release PR で統合
bun run test は test:unit と test:e2e を順に実行する。
- 環境:
happy-dom(vitest.config.ts) - 配置:
src/**/*.{test,spec}.{ts,tsx}(実装と隣接) - React コンポーネントは
@testing-library/reactを使用 - 1 つの Example:
src/app/page.test.tsx - ウォッチモード:
bun run test:unit:watch
- ブラウザ: Chromium のみ(依存・実行時間のバランスを優先)
- 配置:
tests/e2e/**/*.spec.ts - 設定:
playwright.config.ts - 静的書き出し(
./out)が成果物。webServerは設定せず、spec 側で配信を前提にする。- ローカル例:
bun run build && (npx http-server out -p 4173 &) && bun run test:e2e - デプロイ済 preview を指す場合:
PLAYWRIGHT_BASE_URL=https://ido-bata.github.io bun run test:e2e
- ローカル例:
- 初回のみブラウザを取得:
bun run test:e2e:install(CI でも実行する想定)
.github/workflows/ci.ymlのqualityジョブにbun run test:unitを追加する- Playwright の CI 実行はバンドルサイズ・実行時間の都合で optional。別 Issue で判断する
- 対象領域を明確にし、過剰なテストを追加しない
- CI (
ci.yml) のqualityジョブへ組み込み docs/development.mdを同じ PR で更新
rm -rf .next out node_modules/.cache
bun install
bun run buildnext-env.d.ts を再生成:
rm next-env.d.ts
bun run dev # 数秒起動して停止docs/troubleshooting.md#pages-deploy-failed を参照。
- Prettier が整形の single source of truth
- ESLint は静的解析と import 規則
bun run formatを commit 前に一度通す
- 必要性・最終更新・メンテナ・ライセンス・脆弱性を確認
bun add <pkg>(dev に限る) またはbun add <pkg>(runtime)bun.lockをコミットpackage.jsonの変更と理由を PR description に書く