CLI Installation

CLI Installation

The Source Push CLI is a command-line tool that enables you to manage your apps and deployments from your terminal.

System Requirements

  • Node.js version 18.0 or higher
  • npm or yarn package manager
  • Terminal access

Installation Steps

Using npm

npm install -g @srcpush/code-push-cli

Using yarn

yarn global add @srcpush/code-push-cli

Verifying Installation

After installation, verify that the CLI is properly installed:

srcpush -h

You should see output similar to:

srcpush -h
  __  _   _    _
 (_  |_) /    |_)    _ |_
 __) | \ \_   | |_| _> | |   CLI v0.0.1
============================================
Source Push is a service that enables you to deploy mobile app updates directly to your users devices.

Usage: srcpush <command>

Commands:
  srcpush access-key     View and manage the access keys associated with your account
  srcpush app            View and manage your CodePush apps
  srcpush collaborator   View and manage app collaborators
  srcpush debug         View the CodePush debug logs for a running app
  srcpush deployment    View and manage your app deployments
  srcpush login         Authenticate with the CodePush server
  srcpush logout        Log out of the current session
  ...

Configuration

Setting Up Authentication

After installation, you need to authenticate with Source Push:

srcpush login

This will:

  1. Open your browser
  2. Prompt you to log in with your Source Push account
  3. Generate an access token for CLI use

Environment Variables

The CLI supports the following environment variables:

  • SRCPUSH_SERVER_URL: Override the default server URL
  • SRCPUSH_ACCESS_KEY: Set a pre-defined access key
  • SRCPUSH_PROXY: Set a proxy server for CLI connections

Updating the CLI

To update to the latest version:

npm update -g @srcpush/code-push-cli

Or using yarn:

yarn global upgrade @srcpush/code-push-cli

Troubleshooting

Common installation issues and solutions:

Permission Errors

If you encounter permission errors during installation:

sudo npm install -g @srcpush/code-push-cli

Path Issues

If the srcpush command is not found, ensure your npm global bin is in your PATH:

export PATH="$PATH:$(npm config get prefix)/bin"

Version Conflicts

If you have conflicts with other versions:

  1. Uninstall existing versions:

    npm uninstall -g @srcpush/code-push-cli
  2. Clear npm cache:

    npm cache clean --force
  3. Reinstall the CLI:

    npm install -g @srcpush/code-push-cli

Next Steps

After installing the CLI:

  1. Learn about CLI commands
  2. Set up authentication
  3. Create your first app