microsoft / code-push

A cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users’ devices.
https://microsoft.github.io/code-push/
Other
4.34k stars 484 forks source link
codepush cordova react react-native reactnative

appcenterbanner

Sign up With App Center to use CodePush

CodePush

CodePush is a cloud service that enables React Native developers to deploy mobile app updates directly to their users' devices. It works by acting as a central repository that developers can publish updates to (JS, HTML, CSS and images), and that apps can query for updates from (using provided client SDK for React Native). This allows you to have a more deterministic and direct engagement model with your userbase, when addressing bugs and/or adding small features that don't require you to re-build a binary and re-distribute it through the respective app stores.

To get started using CodePush, refer to our documentation, otherwise, read the following steps if you'd like to build/contribute to the project from source.

NOTE: If you need information about code-push management CLI, you can find it in v3.0.1.

Dev Setup

Building

Running Tests

Coding Conventions

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

CodePush Management SDK (Node.js)

A JavaScript library for programmatically managing your CodePush account (e.g. creating apps, promoting releases), which allows authoring Node.js-based build and/or deployment scripts, without needing to shell out to the App Center CLI.

Getting Started

  1. Create a token to authenticate with the CodePush server using the following App Center CLI command:

    appcenter tokens create -d "DESCRIPTION_OF_THE_TOKEN"

    Please copy your API Token and keep it secret. You won't be able to see it again.

  2. Install the management SDK by running npm install code-push --save

  3. Import it using one of the following statement: (using ES6 syntax as applicable):

    • On commonjs environments:
    const CodePush = require("code-push");
    • Using ES6 syntax with tsconfig.json:
    import CodePush from "code-push";
  4. Create an instance of the CodePush class, passing it the API Token you created or retrieved in step #1:

    const codePush = new CodePush("YOUR_API_TOKEN");
  5. Begin automating the management of your account! For more details on what you can do with this codePush object, refer to the API reference section below.

API Reference

The code-push module exports a single class (typically referred to as CodePush), which represents a proxy to the CodePush account management REST API. This class has a single constructor for authenticating with the CodePush service, and a collection of instance methods that correspond to the commands in the App Center CLI, which allow you to programmatically control every aspect of your CodePush account.

Constructors

Methods

Note: access key here refers to an AppCenter API Token.

Error Handling

When an error occurs in any of the methods, the promise will be rejected with a CodePushError object with the following properties: