expo-srcpush
Version:
Expo module for Source Push, a service for over-the-air updates in React Native applications.
111 lines (82 loc) • 2.95 kB
Markdown
# expo-srcpush
Expo module for Source Push, a service for over-the-air updates in React Native applications.
### Add the package to your npm dependencies
```bash
npm install expo-srcpush
```
### Add and Configure the package to your app.json
Add the plugin to your `app.json` or `app.config.js` file:
```json
{
"expo": {
"plugins": [
[
"expo-srcpush",
{
"ios": {
"CodePushDeploymentKey": "YOUR_IOS_DEPLOYMENT_KEY"
},
"android": {
"CodePushDeploymentKey": "YOUR_ANDROID_DEPLOYMENT_KEY",
"CodePushPublicKey": "YOUR_ANDROID_PUBLIC_KEY"
}
}
]
]
}
}
```
#### Configuration Options
The plugin accepts the following configuration options:
**iOS Configuration:**
- `CodePushDeploymentKey` (required): Your iOS deployment key from Source Push dashboard
**Android Configuration:**
- `CodePushDeploymentKey` (required): Your Android deployment key from Source Push dashboard
- `CodePushPublicKey` (optional): Your Android public key for additional security
#### Example with app.config.js
If you prefer using `app.config.js` for more dynamic configuration:
```javascript
export default {
expo: {
plugins: [
[
"expo-srcpush",
{
ios: {
CodePushDeploymentKey: process.env.IOS_CODEPUSH_DEPLOYMENT_KEY,
},
android: {
CodePushDeploymentKey: process.env.ANDROID_CODEPUSH_DEPLOYMENT_KEY,
CodePushPublicKey: process.env.ANDROID_CODEPUSH_PUBLIC_KEY,
},
},
],
],
},
};
```
#### What the Plugin Does
This plugin automatically configures your React Native app for Source Push by:
**Android:**
- Adds the Source Push Gradle configuration to your `build.gradle`
- Configures the main application to use Source Push for JS bundle loading
- Adds deployment keys to `strings.xml`
- Updates `settings.gradle` to include the Source Push module
**iOS:**
- Adds Source Push import to your `AppDelegate.m`
- Configures the app to use Source Push for bundle URL resolution
- Adds deployment key to `Info.plist`
#### Getting Your Deployment Keys
1. Sign up for Source Push at [srcpush.com](https://srcpush.com)
2. Create a new app in your dashboard
3. Navigate to the app settings
4. Copy the deployment keys for iOS and Android platforms
#### After Configuration
After adding the plugin to your configuration:
1. Run `npx expo prebuild` to apply the native configuration
2. Build your app with `eas build` or `expo run:android/ios`
3. Your app will now be configured to receive over-the-air updates from Source Push
#### Troubleshooting
- **Build errors**: Make sure you've run `npx expo prebuild` after adding the plugin
- **Missing deployment keys**: Verify your deployment keys are correctly set in the configuration
- **Plugin not found**: Ensure `expo-srcpush` is installed in your project dependencies