Skip to content

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

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

  1. ✅ Register your app in Capgo
  2. 🔌 プラグインのアップデート設定をインストールして構成する
  3. 🚀 最初のライブアップデートをデプロイする
  4. 📱 デバイス上でアップデートをテストする

推定時間: 10-20分 (インターネット接続速度とビルド時間に依存)

API キーとともにオンボーディングコマンドを実行する:

ターミナルウィンドウ
npx @capgo/cli@latest init [APIKEY]

ようこそメッセージが表示されます:

Capgo onboarding 🛫

CLIは、13ステップのインタラクティブなガイドを提供します:

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

  • 開発環境(Xcode/Android Studio)を確認する
  • Capgoにアプリを追加し、生産チャンネルを作成する
  • __CAPGO_KEEP_1__をインストールする @capgo/capacitor-updater __CAPGO_KEEP_2__
  • Inject the required code into your app
  • オプションでエンドツーエンド暗号化を有効にする
  • テスト用のプラットフォームを選択 (iOS または Android)

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

  • アプリをビルドし、デバイス/エミュレータで実行する
  • 自動または手動で code の可視化された変更を実行する
  • 更新されたパッケージを Capgo にアップロードする
  • 実際のリアルタイムでデバイス上でライブ更新を確認する

完了 (ステップ 13):

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

13ステップのオンボーディングプロセス

セクション「13ステップのオンボーディングプロセス」

ステップ 1: 必要な前提条件を確認する

Step 1: Prerequisites Check

The CLI checks your development environment to ensure you have the necessary tools installed.

確認されるもの:

  • 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

質問を受けるかもしれません:

ステップ 2: アプリを追加

ステップ 2: アプリを追加

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?

Yesを選択した場合:

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

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

Noを選択した場合:

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_KEEP_0__ Webコンソールからチャンネルを設定する
  • Configure channels later from the Capgo web console

Step 4: Capgo Updater Pluginをインストール

Step 4: Capgo Updater Pluginをインストール

The CLI will install the @capgo/capacitor-updater plugin compatible with your Capacitor version.

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

バージョン互換性:

  • Capacitor 5: Capgo 5をインストール @capgo/capacitor-updater v5
  • Capacitor 6: Capgo 6をインストール @capgo/capacitor-updater v6
  • Capacitor 7: @capgo/capacitor-updater v7
  • Capacitor 8+:

__CAPGO_KEEP_0__は__CAPGO_KEEP_1__ v5以上をサポートしています。古いバージョンを使用している場合は、まずアップグレードする必要があります。

Instant updates option:

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

Yes を選択した場合:

  • アップデートは、アプリが背景化されたときに即座に適用されます。
  • autoUpdate: 'always' そして autoSplashscreen: true config に追加されます。
  • あなたの capacitor.config.ts 自動的に更新されます。
  • Delta アップデート 自動的に有効になります - この機能は、更新間で変更されたファイルのみを送信するため、更新が大幅に高速化されます。

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 を有効にすると、CLI は次のことを行います。

  1. 暗号化キーを生成
  2. Capacitor の構成を同期するオファー

ステップ 7:プラットフォームの選択

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: プロジェクトのビルド

Section titled “Step 8: Build Your Project”

The CLI will build your app and sync it with Capacitor.

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

何が起こるか:

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

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

ビルドスクリプトが存在しない場合は、ビルドをスキップするか、プロジェクトにビルドスクリプトを追加するかを尋ねられます package.json.

デバイスまたはエミュレータでアプリの初期バージョンをテストします

❓ 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

ここで、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

__CAPGO_KEEP_0__モード: CLIは、テストバナーを表示するためにファイルを自動的に変更します。

__CAPGO_KEEP_0__モード: 自分で変更を実行します(例えば、テキスト、色、または要素を追加します).

バージョン管理:

❓ 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?

ステップ11: バンドルアップロード

ステップ11: バンドルアップロード

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

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

CLIが実行される:

ターミナル画面
npx @capgo/cli@latest bundle upload

即時適用モードが有効な場合の delta 更新のプロンプト:

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

成功:

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

Step 12: デバイスでテストアップデート

ステップ12:デバイスでアップデートをテストする

実際にアップデートを動作させる時間です!

🧪 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 が追加されました

✅ Update Tested

成功で、ライブアップデートを受信しました

以降のアップデートの場合、以下の手順に従ってください

ターミナル画面
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 が検出されませんでした。

解決策:

  • iOSの場合: インストール Xcode (macOS専用)
  • Androidの場合: インストール Android Studio

問題: アプリケーションIDはすでに登録されています。

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

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

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

問題: ビルドスクリプトが package.json.

解決策: ビルドスクリプトを package.json:

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

問題: CLI が自動的にインジェクションすることができません。インジェクションする必要がある code。

解決策: code を手動でメインファイルに追加してください:

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

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

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

オンボーディングを完了したので、これらのトピックを調べることができます

アップデートの適用時期と方法をカスタマイズ

ヘルプ

オンボーディング中に問題が発生した場合

Capgo の導入ガイドを使用している場合 CLI Onboarding Guide to plan dashboard and API operations, connect it with API Overview API の概要 Introduction 導入 API Keys API のキーアクセス Devices デバイス Bundles バンドル