refactor this documentation adding some emojis and adjust some english mistakes:
A plug-in for using react-native-code-push with Expo managed/bare workflow
- Copy the files from this repo and place them into your Expo app directory.
- Install the appcenter-cli:
npm install -g appcenter-cli
- Install codepush library:
npm install react-native-code-push
- Create an app.plugin.js file and add the following code:
module.exports = require("./plugin/build");
- Add the following to your Expo app config
- Adjust the plugin files as needed for your use case. This will not be a plug-and-play situation in most cases.
-
Open your Expo app config file (app.json).
-
Insert the following into the plugins section of your config (Don't duplicate configuration, if the './app.plugin' item already exists, simply add the android portion.). Create the plugins section if it doesn't already exist.
"plugins":[ [ "./app.plugin", { "android": { "CodePushDeploymentKey": "YOUR_ANDROID_CODE_PUSH_KEY", } } ] ]
-
Replace
YOUR_ANDROID_CODE_PUSH_KEY
with the Deployment key. -
To release a signed release replace your CodePushPublicKey with a public key (https://github.com/microsoft/code-push/tree/v3.0.1/cli#code-signing):
"plugins":[ [ "./app.plugin", { "android": { "CodePushDeploymentKey": "YOUR_ANDROID_CODE_PUSH_KEY", "CodePushPublicKey": "-----BEGIN PUBLIC KEY-----\nYOUR_PUBLIC_KEY\n-----END PUBLIC KEY-----" } } ] ]
-
Run
npx expo prebuild
to regenerate your native code with the codepush dependencies. -
To generate an update use the following code:
appcenter codepush release-react -a <ownerName>/MyApp -d Production -k private.pem
React Native Code Push comes packaged with a plugin to automate some of the setup process:
-
Open your Expo app config file (app.config.json or app.config.js instead of app.json).
-
Insert the following into the plugins section of your config (Don't duplicate configuration, if the './app.plugin' item already exists, simply add the ios portion.). Create the plugins section if it doesn't already exist.
"plugins": [ [ './app.plugin', { ios: { CodePushDeploymentKey: 'YOUR_IOS_CODE_PUSH_KEY', }, } ] ]
-
Replace
YOUR_IOS_CODE_PUSH_KEY
with the Deployment key. -
Run
npx expo prebuild
to regenerate your native code with the codepush dependencies. -
To generate an update use the following code:
appcenter codepush release-react -a <ownerName>/MyApp -d Production -k private.pem