mgscreativa / react-native-code-push-expo-plugin-managed-workflow

react-native-code-push-expo-plugin-managed-workflow
6 stars 1 forks source link

Demo repo for react-native-code-push-plugin using Expo Development Client

This is a demo repo implementing CodePush for Expo dev client using react-native-code-push-plugin config plugin.

:information_source: Note
This will not work on Expo Go projects, it will only work for Expo Development Client projects.

Setup

After you have your app running on your device, try to change something in code (ie: edit setTimesPressed function) and then upload a CodePush release (see Create deployments), wait a minute and then restart the app or set it to background and then foreground it again.

At this point you should be able to tweak the project, analyze it and set it up in your production project, maybe implementing manual CodePush updates.

Known issues

At this point, CodePush seems to dislike local imports that use @/ instead of the good old ./. For this to work, you need to change all @/ imports with ./ paths. If you know how to fix this, please tell or send a PR. Issue reported here

Enable react-native-code-push-plugin in your project

To enable the plugin in your project, you need to install it with npm install -s react-native-code-push-plugin and set the plugin config in your app.json, app.config.json or app.config.js. If you don't need Android or iOS CodePush support simply remove the Android or iOS section.

"plugins": [
  [
    "react-native-code-push-plugin",
    {
      "android": {
        "CodePushDeploymentKey": ""
      },
      "ios": {
        "CodePushDeploymentKey": ""
      }
    }
  ]
]

Support the PR on react-native-code-push repo

Currently, there's an open PR to have this plugin out of the box in react-native-code-push package but still waiting for approval to merge, if you can, write a comment asking for this plugin to be added to the package. Here's the PR link Expo plugin to simplify installation with expo

Useful CodePush commands

CodePush documentation

Releasing CodePush updates using the App Center CLI

Install app center cli

npm install -g appcenter-cli

Login to your app center account

appcenter login

Create an app center app

Adjust --display-name --release-type params as you need

List app center apps

appcenter apps list

Create deployments

Here you get the deployment key. Adjust -a and Development params as you need

Get deployment keys

Adjust -a param as you need

Send a bundle update (release)

Adjust -a, --deployment-name, --entry-file should be pointed at your file stated in main in package.json. In this repo is "main": "App.tsx", --use-hermes and --target-binary-version params as you need. See CodePush docs here for more info