Firebase Emulator Suite 起動・停止・管理コマンド群 - ローカル開発環境をサポート

version
2.0.0
GitHub stars
5

Install

/plugin install firebase-emulator@no-problem-plugins

Run it inside Claude Code after adding the marketplace with /plugin marketplace add no-problem-dev/claude-code-plugins.

Contents

Discovered from source

Skills 2

Firebase Emulator 操作

Firebase Emulator Suite の起動・停止・状態確認を行う。 スクリプトによるポート管理・PID 管理を使用。

起動

${CLAUDE_PLUGIN_ROOT}/scripts/emulator-start.sh

Firebase Emulator をバックグラウンドで起動する。

  • Firebase ディレクトリを自動検出
  • プロジェクト ID を自動取得
  • ポートの競合を事前チェック
  • 起動後、UI URL とログ場所を表示

起動後の確認

http://localhost:4000  (Emulator UI)

停止

${CLAUDE_PLUGIN_ROOT}/scripts/emulator-stop.sh

全エミュレーターサービスのポートプロセスを終了する。

使用タイミング

  • 開発終了時
  • ポートを解放したい時
  • エミュレーターを再起動したい時

状態確認

${CLAUDE_PLUGIN_ROOT}/scripts/emulator-status.sh

各サービスのポート稼働状況を確認する。

表示内容

  • Firestore / Auth / Storage / UI の起動状態
  • 使用中のポート
  • 稼働サービス数(X/4)

環境変数

変数説明デフォルト
FIREBASE_DIRFirebase ディレクトリ自動検出
FIREBASE_PROJECT_IDプロジェクト ID自動検出
EMULATOR_PORT_FIRESTOREFirestore ポート8090
EMULATOR_PORT_AUTHAuth ポート9099
EMULATOR_PORT_STORAGEStorage ポート9199
EMULATOR_PORT_UIUI ポート4000

前提条件

  • Firebase CLI がインストールされている(npm install -g firebase-tools)
  • firebase.json が存在する

Firebase Emulator ワークフロー(v2.0)

Firebase Emulator Suite のローカル開発環境管理ワークフロー。

スキル

スキル用途使いどころ
emulator-control起動・停止・状態確認「エミュレーター起動」「停止」「状態」

推奨ワークフロー

開発開始 → emulator-control(起動)
    ↓
iOS / Backend 開発
    ↓
開発終了 → emulator-control(停止)

環境変数

変数説明デフォルト
FIREBASE_PROJECT_IDプロジェクトID自動検出
EMULATOR_PORT_FIRESTOREFirestore ポート8090
EMULATOR_PORT_AUTHAuth ポート9099
EMULATOR_PORT_STORAGEStorage ポート9199
EMULATOR_PORT_UIUI ポート4000

ディレクトリ検出

以下の順序で Firebase 設定を検出:

  1. 環境変数 FIREBASE_DIR
  2. カレントディレクトリの firebase.json
  3. firebase/ サブディレクトリ

Emulator UI

起動後、ブラウザで確認:

http://localhost:4000

アプリからの接続

iOS (Swift)

let settings = Firestore.firestore().settings
settings.host = "localhost:8090"
settings.isSSLEnabled = false
Firestore.firestore().settings = settings

Go Backend

os.Setenv("FIRESTORE_EMULATOR_HOST", "localhost:8090")
os.Setenv("FIREBASE_AUTH_EMULATOR_HOST", "localhost:9099")

よくある問題

ポートが既に使用中

Port 8090 is already in use

対処: 既存のプロセスを終了

lsof -ti :8090 | xargs kill -9

firebase.json が見つからない

Error: No Firebase project directory found

対処: firebase init でプロジェクトを初期化

Sponsors

Details

Marketplace
no-problem-dev/claude-code-plugins
Source
plugins/firebase-emulator
Category
Development

More from no-problem-dev/claude-code-plugins

All 9