React Native CodePush Cheat Sheet
Getting Started
npm install -g code-push-cli
code-push register
code push app add MyApp-Android android react-native
In React-Native app
yarn add react-native-code-push@latest
react-native link react-native-code-push
react-native run-android --variant=releaseStaging
(Need to configure releaseStaging in build.gradle
)
Updating Apps
Retrieve list of your apps
code-push app ls
Retrieve keys for app
code-push deployment ls MyApp-Android -k
Release an update to Staging
code-push release-react MyApp-Android android
Promote an update to Production
code-push promote MyApp-Android Staging Production
Check Deployment History
code-push deployment history MyApp-Android Staging
JavaScript Integration
import React, { Component } from 'react'
import CodePush from 'react-native-code-push'
class MyApp extends Component { }
const codePushOptions = {
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.ON_NEXT_RESUME
}
export default codePush(codePushOptions)(MyApp);