Skip to content

Getting Started

GitHub

CapgoのAIアシストセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。

ターミナルウィンドウ
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-env` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

ターミナルウィンドウ
bun add @capgo/capacitor-env
bunx cap sync
import { Env } from '@capgo/capacitor-env';

環境変数の特定のキーに対応する値を取得します。

このメソッドは、ネイティブのビルドプロセス中に設定された環境変数を取得します。変数は、実行時にはアクセスできるようにネイティブプロジェクトで構成する必要があります。

import { Env } from '@capgo/capacitor-env';
const result = await EnvPlugin.getKey({ key: 'API_URL' });
console.log(result.value); // 'https://api.example.com'

このページはプラグインの src/definitions.tsパブリック API がアップストリームで変更された場合に、再度 Sync を実行してください。

Capacitor を使用している場合 Getting Started ダッシュボードと API の操作を計画するには、 @capgo/capacitor-env を使用 native capabilityの使用に@capgo/capacitor-envを使用します。 APIの概要 APIの実装詳細について 導入 導入の実装詳細について APIのキー APIのキーに関する実装詳細 デバイス デバイスの実装詳細