コンテンツにジャンプ

CLI オンボーディング ガイド

The Capgo CLI provides an interactive onboarding that sets up live updates for your Capacitor app. You’ll:

  1. ✅ Capgoにアプリケーションを登録する
  2. 🔌 アップデート プラグインをインストールおよび設定する
  3. 🚀 最初のライブ更新をデプロイする
  4. 📱 デバイス上でアップデートをテストする

予想時間: 10-20分(インターネット接続速度とビルド時間に基づいて変わります)

API キーとともにオンボーディングコマンドを実行してください:

ターミナル画面
npx @capgo/cli@latest init [APIKEY]

welcome メッセージが表示されます:

Capgo onboarding 🛫

13 のインタラクティブ ステップで CLI が導きます:

セットアップフェーズ (ステップ 1-6):

  • 開発環境 (Xcode/Android Studio) を確認する
  • Capgo にアプリを追加し、生産チャネルを作成する
  • Capacitor の @capgo/capacitor-updater プラグイン
  • code をアプリに必要なものをインジェクトする
  • オプションで、端末間の暗号化を有効にする
  • テスト用のプラットフォームを選択 (iOS または Android)

テストフェーズ (ステップ 7-12):

  • アプリをビルドし、デバイス/シミュレータで実行する
  • code の可視化された変更 (自動または手動)
  • Capgo への更新されたバンドルをアップロードする
  • デバイス上でリアルタイムに更新が表示されます。

完了 (ステップ 13):

  • あなたのアプリはライブ更新に準備できました! 🎉

13ステップの導入プロセス

「13ステップの導入プロセス」

ステップ 1: 必要な環境を確認する

「ステップ 1: 必要な環境を確認する」

CLIは開発環境を確認し、必要なツールがインストールされているかを確認します。

確認されるもの:

  • Xcode (macOSのみ) - iOS開発用
  • Android SDK - Android 開発用

可能な結果:

両方の環境が見つかりました:

✅ Xcode detected - iOS development ready
✅ Android SDK detected - Android development ready

⚠️ 環境が見つかりませんでした:

⚠️ Xcode not found
⚠️ Android SDK not found
❌ No development environment detected
📱 To develop mobile apps with Capacitor, you need:
• For iOS: Xcode (macOS only) - https://developer.apple.com/xcode/
• For Android: Android Studio - https://developer.android.com/studio

質問されるかもしれません:

はCLIを使用してCapgoにログインし、アプリをアカウントに追加します。

(spinner) Running: npm @capgo/cli@latest login ***
Login Done ✅
❓ Add {appId} in Capgo?

アプリIDがすでに取られている場合:

はCLIが代替案を提示します:

❌ App ID "com.example.app" is already taken
💡 Here are some suggestions:
1. com.example.app2
2. com.example.app3
3. com.example.app.new
4. com.example.app.app
❓ What would you like to do?

代替案を選択するか、カスタムアプリIDを入力できます。

ステップ 3: プロダクション チャンネルを作成

ステップ 3: プロダクション チャンネルを作成

チャンネルは、アプリの更新フローを管理するために使用できます。

❓ Create default channel production for {appId} in Capgo?

はいを選択した場合:

(spinner) Running: npm @capgo/cli@latest channel add production {appId} --default
Channel add Done ✅ (or "Channel already added ✅")

production チャンネルが作成され、デフォルトの設定になります。このオプションは、ほとんどのユーザーにとって推奨されるオプションです。

はいを選択しない場合:

If you change your mind, run it for yourself with: "npm @capgo/cli@latest channel add production {appId} --default"

後でチャンネルを作成および設定する必要があります。代わりに、

  • ファイルの capacitor.config.ts チャンネルを設定する
  • JavaScript setChannel() 方法を使用して、動的にチャンネルを設定する
  • 後でCapgo Webコンソールからチャンネルを設定する

ステップ 4: アップデート プラグインをインストールする

ステップ 4: アップデート プラグインをインストールする

CLIは、CLIのバージョンに適合した @capgo/capacitor-updater plugin compatible with your Capacitor version.

❓ Automatic Install "@capgo/capacitor-updater" dependency in {appId}?

バージョン互換性:

  • Capacitor 5: __CAPGO_KEEP_0__ をインストールします @capgo/capacitor-updater v5
  • Capacitor 6: __CAPGO_KEEP_0__ をインストールします @capgo/capacitor-updater v6
  • Capacitor 7: __CAPGO_KEEP_0__ をインストールします @capgo/capacitor-updater v7
  • Capacitor 8+: 最新バージョンの __CAPGO_KEEP_0__ をインストールします

即時更新オプション:

インストール後、次の質問が行われます:

❓ Do you want to set instant updates in {appId}?
Read more: https://capgo.app/docs/live-updates/update-behavior/#applying-updates-immediately

Yesを選択した場合:

  • 更新はアプリが背景化されたときと再起動されたときに即時適用されます。
  • directUpdate: 'always' そして autoSplashscreen: true configに追加されます
  • あなたの capacitor.config.ts 自動的に更新されます
  • デルタ更新 自動的に有効になります - これは、更新の間の変更されたファイルのみを送信するため、更新がはるかに速くなります。

あなたが「No」を選択した場合:

  • 更新は標準の動作を使用します (バックグラウンドでダウンロード、再起動後に適用)
  • あなたはいつでも、あなたの capacitor.config.ts

CLIは、必要なcodeを自動的にあなたの主なアプリケーションファイルにインジェクトします。

❓ Automatic Add "CapacitorUpdater.notifyAppReady()" code and import in {appId}?

何が追加される:

import { CapacitorUpdater } from '@capgo/capacitor-updater'
CapacitorUpdater.notifyAppReady()

プロジェクトタイプの検出:

  • Nuxt.js: 作成 plugins/capacitorUpdater.client.ts
  • 他のフレームワーク: メインエントリファイルに追加

ステップ 6: セキュリティ設定 (オプション)

ステップ 6: セキュリティ設定 (オプション) のセクション

エンドツーエンド暗号化は、更新のセキュリティ層を追加します。

🔐 End-to-end encryption
✅ Use this for: Banking, healthcare, or apps with legal encryption requirements
⚠️ Note: Makes debugging harder - skip if you don't need it
❓ Enable end-to-end encryption for {appId} updates?

CLI を有効にすると、次のことが行われます。

  1. __CAPGO_KEEP_0__ では暗号化キーを生成します。
  2. Capacitor の設定をsyncするように提案します。

Step 7: Platformを選択

Step 7: Platformを選択

初期設定の際にテストするプラットフォームを選択します。

📱 Platform selection for onboarding
This is just for testing during onboarding - your app will work on all platforms
❓ Which platform do you want to test with during this onboarding?
Options:
- iOS
- Android

Step 8: Projectをビルドする

Step 8: Projectをビルドする

CLIはアプリをビルドし、Capacitorと同期します。

❓ Automatic build {appId} with "npm run build"?

何が起こるか:

  1. プロジェクトのタイプを検出
  2. ビルドスクリプトを実行
  3. 実行 npx cap sync {platform}

ビルドスクリプトが見つからない場合:

ビルドをスキップするか、プロジェクトにビルドスクリプトを追加するかを尋ねられます。 package.json.

Step 9: デバイスで実行する

Step 9: デバイスで実行する

デバイスまたはシミュレータでアプリの初期バージョンをテストしてください。

❓ Run {appId} on {PLATFORM} device now to test the initial version?

あなたが選択した場合 はい:

(spinner) Running: npx cap run {platform}
(device picker appears)
App started ✅
📱 Your app should now be running on your {platform} device with Capgo integrated
🔄 This is your baseline version - we'll create an update next

ステップ 10: テスト用の変更を実行する

ステップ 10: テスト用の変更を実行する

あなたは Capgo の更新システムをテストするために、変更を実行する必要があります。

🎯 Now let's test Capgo by making a visible change and deploying an update!
❓ How would you like to test the update?
Options:
- Auto: Let Capgo CLI make a visible change for you
- Manual: I'll make changes myself

自動モード: CLI は自動的にファイルを変更して、テスト用の表示可能なバナーを追加します。

手動モード: あなた自身で変更を加えることができます (例: テキスト、色、または要素を追加)。

バージョン管理:

❓ How do you want to handle the version for this update?
Options:
- Auto: Bump patch version ({currentVersion} → {nextVersion})
- Manual: I'll provide the version number

変更を反映したビルド:

❓ Build {appId} with changes before uploading?

あなたのアップデートされたアプリケーションバンドルを Capgo にアップロードしてください。

❓ Upload the updated {appId} bundle (v{version}) to Capgo?

CapgoはCLIを実行します。

ターミナルウィンドウ
npx @capgo/cli@latest bundle upload

Δルートの更新は、直接更新が有効の場合に提示されます。

💡 Direct Update (instant updates) is enabled in your config
Delta updates send only changed files instead of the full bundle
❓ Enable delta updates for this upload? (Recommended with Direct Update)

成功:

✅ Update v{version} uploaded successfully!
🎉 Your updated bundle is now available on Capgo

アップデートを実行してみましょう!

🧪 Time to test the Capgo update system!
📱 Go to your device where the app is running

即時更新の場合:

🔄 IMPORTANT: Background your app (swipe up/press home button) and then reopen it
⏱️ The update should be downloaded and applied automatically

標準的な更新の場合:

📱 With standard updates, you will need to:
1. Background the app (swipe up/press home button) to start download
2. Wait a few seconds for download to complete
3. Background and foreground again to see the update

ログの監視:

❓ Monitor Capgo logs to verify the update worked?

あなたが選択した場合 はいあなたは、デバイスから実行中の更新プロセスをリアルタイムで表示することができます。

Welcome onboard ✈️!

おめでとうございます!あなたはアプリのCapgoライブアップデートを成功で設定しました。

オンボーディングを完了した後、次のことが実行されます:

✅ アプリケーション登録

Capgo にプロダクション チャネルでアプリケーションが登録されています。

✅ プラグインのインストール

Capacitor アップデート プラグインがインストールおよび設定されています。

✅ Code の統合

code の統合がアプリケーションに追加されています。

✅ アップデートのテスト

ライブ アップデートを成功的にデプロイし、更新を受信しました。

以降のアップデートの場合、使用してください:

ターミナル画面
npm run build
npx @capgo/cli@latest bundle upload --channel=production

詳細なデプロイオプションについては ライブアップデートをデプロイ.

オンボーディングプロセスを中断しても、いつでも再開できます。

ターミナル画面
npx @capgo/cli@latest init [APIKEY]

次のようになります。

You have already got to the step {stepNumber}/13 in the previous session
❓ Would you like to continue from where you left off?

問題: XcodeやAndroid SDK のいずれも検出されませんでした。

解決策

App IDがすでに取られています

App IDがすでに取られています

問題: あなたのアプリIDはすでに登録されています。

解決策: 提案されたオプションのいずれかを選択するか、逆ドメイン記法でカスタムのアプリIDを入力してください。

ビルドスクリプトが見つかりません

ビルドスクリプトが見つかりません

問題: No build script found in __CAPGO_KEEP_0__. package.json.

解決策: Add a build script to your __CAPGO_KEEP_0__. package.json:

{
"scripts": {
"build": "your-build-command"
}
}

問題: CLI は自動的に code の統合を挿入できません。

解決策: Add the code manually to your main file:

import { CapacitorUpdater } from '@capgo/capacitor-updater'
CapacitorUpdater.notifyAppReady()

問題: Capacitor のバージョンは v5 未満です。

解決策: Capacitor を v5 またはそれ以上のバージョンにアップグレードしてください。

オンボーディングを完了した後は、これらのトピックを探索してください:

ヘルプを取得する

ヘルプを取得する

初期設定中に問題が発生した場合