メインコンテンツにジャンプ

Getting Started

GitHub

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

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

次に、以下のプロンプトを使用してください:

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

Manual Setup を好む場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください:

ターミナルウィンドウ
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 がアップストリームで変更された場合に、再度同期を実行してください。

Capacitor を使用している場合 Getting Started ダッシュボードと API の計画と操作を行う場合、接続してください。 Using @capgo/capacitor-env for the native capability in Using @capgo/capacitor-env API Overview for the implementation detail in API Overview Introduction for the implementation detail in Introduction API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.