Skip to content

Commit 8d8a8a4

Browse files
feat(expo): Dynamically resolve sentry-cli path in expo source maps upload script (#3507)
1 parent dc8966b commit 8d8a8a4

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
This release is compatible with `[email protected]` and newer.
66

7+
### Features
8+
79
- `withSentryExpoSerializers` changes to `getSentryExpoConfig` ([#3501](https://github.com/getsentry/sentry-react-native/pull/3501))
810
- `getSentryExpoConfig` accepts the same parameters as `getDefaultConfig` from `expo/metro-config` and returns Metro configuration
911
- This also works for EAS Updates (and expo export). Debug ID is generated by `expo/metro-config` and used by Sentry.
@@ -13,10 +15,24 @@ This release is compatible with `[email protected]` and newer.
1315
const config = getSentryExpoConfig(config);
1416
```
1517

18+
- Add `scripts/expo-upload-sourcemaps.js` for simple EAS Update (expo export) source maps upload to Sentry ([#3491](https://github.com/getsentry/sentry-react-native/pull/3491))
19+
20+
```bash
21+
SENTRY_PROJECT=project-slug \
22+
SENTRY_ORG=org-slug \
23+
SENTRY_AUTH_TOKEN=super-secret-token \
24+
node node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js dist
25+
```
26+
27+
- Sentry CLI binary path in `scripts/expo-upload-sourcemaps.js` is resolved dynamically ([#3507](https://github.com/getsentry/sentry-react-native/pull/3507))
28+
- Or can be overwritten by `SENTRY_CLI_EXECUTABLE` env
29+
1630
- Resolve Default Integrations based on current platform ([#3465](https://github.com/getsentry/sentry-react-native/pull/3465))
1731
- Native Integrations are only added if Native Module is available
1832
- Web Integrations only for React Native Web builds
1933

34+
### Fixes
35+
2036
- Includes fixes from version 5.15.2
2137

2238
## 5.15.2

scripts/expo-upload-sourcemaps.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const process = require('process');
66
const SENTRY_PROJECT = 'SENTRY_PROJECT';
77
// The sentry org is inferred from the auth token
88
const SENTRY_AUTH_TOKEN = 'SENTRY_AUTH_TOKEN';
9-
10-
const SENTRY_CLI = 'node_modules/@sentry/cli/bin/sentry-cli';
9+
const SENTRY_CLI_EXECUTABLE = 'SENTRY_CLI_EXECUTABLE';
1110

1211
function getEnvVar(varname) {
1312
return process.env[varname];
@@ -103,6 +102,7 @@ function groupAssets(assetPaths) {
103102

104103
let sentryProject = getEnvVar(SENTRY_PROJECT);
105104
let authToken = getEnvVar(SENTRY_AUTH_TOKEN);
105+
const sentryCliBin = getEnvVar(SENTRY_CLI_EXECUTABLE) || require.resolve('@sentry/cli/bin/sentry-cli');
106106

107107
if (!sentryProject) {
108108
console.log(`🐕 Fetching ${SENTRY_PROJECT} from expo config...`);
@@ -147,7 +147,7 @@ for (const [assetGroupName, assets] of Object.entries(groupedAssets)) {
147147
}
148148
console.log(`⬆️ Uploading ${assetGroupName} bundle and sourcemap...`);
149149
const isHermes = assets.find(asset => asset.endsWith('.hbc'));
150-
execSync(`${SENTRY_CLI} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')}`, {
150+
execSync(`${sentryCliBin} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')}`, {
151151
env: {
152152
...process.env,
153153
[SENTRY_PROJECT]: sentryProject,

0 commit comments

Comments
 (0)