Skip to content

Latest commit

 

History

History
112 lines (67 loc) · 5.05 KB

codepush.mdx

File metadata and controls

112 lines (67 loc) · 5.05 KB
title description
Migrate from CodePush
A guide to help migrate from CodePush to EAS Update.

import { Collapsible } from '/ui/components/Collapsible'; import { Terminal } from '/ui/components/Snippet'; import { Step } from '~/ui/components/Step';

This guide explains how to transition a React Native project that uses CodePush to use EAS Update which offers many advantages. It assumes that you're using the default React Native project structure. For assistance with migrating brownfield native apps to EAS Update, reach out to us directly.

Prerequisites

EAS Update is available to anyone with an Expo account, regardless of whether you pay for EAS or use our free tier. You can sign up at https://expo.dev/signup.

Learn more about different plans and benefits.

## Uninstall CodePush

To avoid conflicts and unexpected behavior, it's recommended to uninstall CodePush if you're using EAS Update. This is because your app could periodically fetch updates from both services, leading to issues, especially if you're using different configurations for each service.

Remove the CodePush SDK from your project by uninstalling the react-native-code-push package:

<Terminal cmd={['$ npm uninstall react-native-code-push']} />

You'll also need to remove CodePush references from JS and native code. Follow this guide for more detailed instructions.

## Ensure proper `app.json`

Ensure that your project has an app.json file with an expo object. If you don't have anything specific to configure in your app.json file yet, you can simply create a minimal app.json file with an empty expo object like this:

{
  "expo": {
    //... any other existing keys you have
  }
}
## Install the `expo` package

Install the expo package by running the command:

<Terminal cmd={['$ npx install-expo-modules@latest']} />

If the command fails, refer to the "Installing Expo modules" guide.

## Install the latest EAS CLI

EAS CLI is the command-line app that you will use to interact with EAS services from your terminal. To install it, run the command:

<Terminal cmd={['$ npm install -g eas-cli']} />

You can also use the above command to check if a new version of EAS CLI is available. We encourage you to always stay up to date with the latest version.

We recommend using npm instead of yarn for global package installations. You may alternatively use npx eas-cli@latest. Remember to use that instead of eas whenever it's called for in the documentation.

## Log in to your Expo account

If you are already signed in to an Expo account using Expo CLI, you can skip the steps described in this section. If you are not, run the following command to log in:

<Terminal cmd={['$ eas login']} />

You can check whether you are logged in by running eas whoami.

## Configure project, deploy builds and publish updates

We have finished all the steps tailored for a CodePush-enabled bare React Native project. To proceed with the configuration of your project, please begin with Step 4 in the main guide and follow it through to completion.

You may need to edit some of the code eas update:configure generates depending on how you build and run your project. See Updating bare app for more details about the native changes.

## Verifying the migration and resubmitting your app

After completing the migration and setting up your project with EAS Update, you should test your app to ensure that over-the-air updates are working correctly. To do this:

  1. Install the currently published version of your app on a device or simulator.
  2. Deploy a new update to your app using EAS Update.
  3. Launch the app and ensure that it loads the latest update from EAS. Once the update is built and uploaded to EAS and the command completes, force close and reopen your app up to two times to download and view the update.

Keep in mind that since you have changed the update provider from CodePush to EAS Update, you will need to rebuild your app and submit the new build to the respective app stores (Apple App Store and Google Play Store) to ensure the update mechanism works as expected for your end-users.

Please follow the respective store guidelines for submitting a new build of your application:

After successfully submitting your app, users will be able to download and use the latest build with EAS Update integration. If your app is not updating as expected, validate your configuration.