UNPKG

@membranehq/cli

Version:

A command-line interface for working with Membrane in your local development environment.

112 lines (75 loc) 3.24 kB
# Membrane CLI A command-line interface for working with Membrane in your local development environment. ## Installation ```bash npm install -g @membranehq/cli # or yarn global add @membranehq/cli # or bun install -g @membranehq/cli # or pnpm install -g @membranehq/cli ``` ## Quick Start Run `membrane` in your project directory to go through the setup process and get started. It will ask you to authenticate in the Membrane Console and select a remote workspace you want to work with. It will create the `membrane.config.yml` file that will contain your workspace credentials. ## Commands Reference ```bash # View membrane help membrane --help # View membrane <command> help membrane <command> --help # Check CLI version membrane --version ``` ## Configuration The CLI can be configured using either environment variables or a configuration file (`membrane.config.yml`). Environment variables take precedence over the configuration file. ### Environment Variables ```bash export MEMBRANE_WORKSPACE_KEY=<your-workspace-key> export MEMBRANE_WORKSPACE_SECRET=<your-workspace-secret> export MEMBRANE_API_URI=https://api.integration.app # Optional: for self-hosted instances export MEMBRANE_TEST_CUSTOMER_ID=<test-customer-id> # Optional: test customer ID for testing integrations ``` ### Configuration File The CLI uses a configuration file at `membrane.config.yml`: ```yaml workspaceKey: <your-workspace-key> workspaceSecret: <your-workspace-secret> # Optional apiUri: https://api.integration.app # Set it to work with a self-hosted version of Membrane testCustomerId: test-customer # Internal id of the customer to be used for testing integrations. ``` **Note:** When both environment variables and configuration file are present, environment variables take precedence. ## Version Control `membrane.config.yml` contains secrets. You should exclude it from version control. `membrane` folder can and should be stored in version control to keep your integration configurations versioned. ## Syncing between workspaces with `pull` and `push` The CLI provides a `pull` and `push` command to sync elements between your workspaces. You'd typically use this to sync elements between your development and production workspaces. **Usage** ```bash membrane pull # Change workspace credentials in membrane.config.yml / environment variables membrane push ``` **Sample workspace sync script** ```bash echo "🚀 Starting Membrane workspace sync workflow..." # Step 1: Set up environment variables for development workspace echo "📝 Setting up development workspace credentials..." export MEMBRANE_WORKSPACE_KEY="dev-workspace-key-123" export MEMBRANE_WORKSPACE_SECRET="dev-workspace-secret-456" # Step 2: Pull latest changes from development workspace echo "⬇️ Pulling latest changes from development workspace..." membrane pull # Step 3: Switch to production workspace credentials echo "🔄 Switching to production workspace credentials..." export MEMBRANE_WORKSPACE_KEY="prod-workspace-key-789" export MEMBRANE_WORKSPACE_SECRET="prod-workspace-secret-012" # Step 4: Push changes to production workspace echo "⬆️ Pushing changes to production workspace..." membrane push ``` ## License MIT