bugsnag / bugsnag-expo

MIT License
11 stars 5 forks source link

[PLAT-9733] Use EAS Build lifecycle hook for Android source map uploads #112

Closed yousif-bugsnag closed 1 year ago

yousif-bugsnag commented 1 year ago

Goal

plugin-expo-eas-sourcemaps is incompatible with Expo 48 due to the issue with BAGP and RN 0.71

This PR updates the plugin for SDK 48 by using Expo’s eas-build-on-success hook to upload Android source maps instead of installing BAGP into the native project.

iOS source maps are still uploaded by the native build using the pre-existing config plugin.

Design

The plugin now exposes a script bugsnag-eas-build-on-success that can be added to the eas-build-on-success build hook in a project's package.json, e.g.

"scripts": {
  "eas-build-on-success": "npx bugsnag-eas-build-on-success"
}

The script reads the project's Bugsnag API key from the app.json file and exits with an error if it fails to find the source map file or API key (this mirrors the behaviour of the plugin's iOS script).

The script relies on the source map and bundle files being generated in a consistent path relative to the project root: bundle: android/app/build/generated/assets/createBundleReleaseJsAndAssets/index.android.bundle source map: android/app/build/generated/sourcemaps/react/release/index.android.bundle.map

The CLI tool has been updated so that the init and upload-sourcemaps commands will add the necessary hook into the project's package.json

Testing