Skip to content

Commit 444600b

Browse files
Upgrade @sentry/react-native to version 5 (#337)
1 parent dd53ed9 commit 444600b

File tree

13 files changed

+1652
-1524
lines changed

13 files changed

+1652
-1524
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
### 🛠 Breaking changes
66

7+
- Upgrade `@sentry/react-native` to `5.5.0`.
8+
- Checkout [the migration guide](https://docs.sentry.io/platforms/react-native/migration/#from-4x-to-5x) for breaking changes
9+
710
### 🎉 New features
811

912
### 🐛 Bug fixes

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
[![runs with expo](https://img.shields.io/badge/Runs%20with%20Expo-4630EB.svg?style=flat-square&logo=EXPO&labelColor=f3f3f3&logoColor=000)](https://expo.dev/)
23

34
# sentry-expo

build/integrations/bare.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/integrations/bare.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/integrations/bare.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
"homepage": "https://docs.expo.io/guides/using-sentry/",
4040
"dependencies": {
4141
"@expo/spawn-async": "^1.7.0",
42-
"@sentry/integrations": "7.37.2",
43-
"@sentry/react": "7.37.2",
44-
"@sentry/react-native": "4.15.2",
45-
"@sentry/types": "7.37.2",
42+
"@sentry/integrations": "7.52.1",
43+
"@sentry/react": "7.52.1",
44+
"@sentry/react-native": "5.5.0",
45+
"@sentry/types": "7.52.1",
4646
"mkdirp": "^1.0.4",
4747
"rimraf": "^3.0.2"
4848
},
@@ -65,9 +65,9 @@
6565
"expo-device": "~5.0.0",
6666
"expo-module-scripts": "3.0.4",
6767
"expo-updates": "~0.15.6",
68-
"jest": "26",
69-
"react": "18.1.0",
70-
"react-native": "^0.70.5",
68+
"jest": "29.5.0",
69+
"react": "18.2.0",
70+
"react-native": "0.71.8",
7171
"react-native-web": "~0.18.9",
7272
"typescript": "^4.7.4"
7373
}

plugin/build/withSentryAndroid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function modifyAppBuildGradle(buildGradle) {
5454
if (buildGradle.includes('/sentry.gradle"')) {
5555
return buildGradle;
5656
}
57-
// Use the same location that sentry-wizard uses
57+
// Use the same location that sentry-wizard uses
5858
// See: https://github.com/getsentry/sentry-wizard/blob/e9b4522f27a852069c862bd458bdf9b07cab6e33/lib/Steps/Integrations/ReactNative.ts#L232
5959
const pattern = /^android {/m;
6060
if (!buildGradle.match(pattern)) {

plugin/build/withSentryIOS.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ exports.writeSentryPropertiesTo = exports.modifyExistingXcodeBuildScript = expor
2727
const config_plugins_1 = require("expo/config-plugins");
2828
const fs = __importStar(require("fs"));
2929
const path = __importStar(require("path"));
30+
const SENTRY_CLI = `\`node --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``;
3031
const withSentryIOS = (config, sentryProperties) => {
3132
config = (0, config_plugins_1.withXcodeProject)(config, (config) => {
3233
const xcodeProject = config.modResults;
3334
const sentryBuildPhase = xcodeProject.pbxItemByComment('Upload Debug Symbols to Sentry', 'PBXShellScriptBuildPhase');
3435
if (!sentryBuildPhase) {
3536
xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
3637
shellPath: '/bin/sh',
37-
shellScript: 'export SENTRY_PROPERTIES=sentry.properties\\n' +
38-
"`node --print \"require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'\"` upload-dsym --force-foreground",
38+
shellScript: `
39+
export SENTRY_PROPERTIES=sentry.properties
40+
[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
41+
${SENTRY_CLI} debug-files upload --force-foreground "$INCLUDE_SOURCES_FLAG" "$DWARF_DSYM_FOLDER_PATH"
42+
`
3943
});
4044
}
4145
let bundleReactNativePhase = xcodeProject.pbxItemByComment('Bundle React Native code and images', 'PBXShellScriptBuildPhase');
@@ -61,8 +65,8 @@ function modifyExistingXcodeBuildScript(script) {
6165
code =
6266
'export SENTRY_PROPERTIES=sentry.properties\n' +
6367
'export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"\n' +
64-
code.replace(/^.*?(packager|scripts)\/react-native-xcode\.sh\s*(\\'\\\\")?/m, (match) => "`node --print \"require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'\"` react-native xcode --force-foreground " +
65-
match);
68+
code.replace(/^.*?(packager|scripts)\/react-native-xcode\.sh\s*(\\'\\\\")?/m, (match) => `${SENTRY_CLI} react-native xcode --force-foreground ${match}`) +
69+
"\n\n`node --print \"require.resolve('@sentry/react-native/package.json').slice(0, -13) + '/scripts/collect-modules.sh'\"`";
6670
script.shellScript = JSON.stringify(code);
6771
}
6872
exports.modifyExistingXcodeBuildScript = modifyExistingXcodeBuildScript;

plugin/src/__tests__/modifyXcodeProject-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const buildScriptWithoutSentry = {
1717

1818
const buildScriptWithSentry = {
1919
shellScript:
20-
'"export SENTRY_PROPERTIES=sentry.properties\\nexport EXTRA_PACKAGER_ARGS=\\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\\"\\nexport NODE_BINARY=node\\n`node --print \\"require.resolve(\'@sentry/cli/package.json\').slice(0, -13) + \'/bin/sentry-cli\'\\"` react-native xcode --force-foreground ../node_modules/react-native/scripts/react-native-xcode.sh"',
20+
'"export SENTRY_PROPERTIES=sentry.properties\\nexport EXTRA_PACKAGER_ARGS=\\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\\"\\nexport NODE_BINARY=node\\n`node --print \\"require.resolve(\'@sentry/cli/package.json\').slice(0, -13) + \'/bin/sentry-cli\'\\"` react-native xcode --force-foreground ../node_modules/react-native/scripts/react-native-xcode.sh\\n\\n`node --print \\\"require.resolve(\'@sentry/react-native/package.json\').slice(0, -13) + \'/scripts/collect-modules.sh\'\\\"`"',
2121
};
2222

2323
const monorepoBuildScriptWithoutSentry = {
@@ -27,7 +27,7 @@ const monorepoBuildScriptWithoutSentry = {
2727

2828
const monorepoBuildScriptWithSentry = {
2929
shellScript:
30-
'"export SENTRY_PROPERTIES=sentry.properties\\nexport EXTRA_PACKAGER_ARGS=\\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\\"\\nexport NODE_BINARY=node\\n`node --print \\"require.resolve(\'@sentry/cli/package.json\').slice(0, -13) + \'/bin/sentry-cli\'\\"` react-native xcode --force-foreground `node --print \\"require.resolve(\'react-native/package.json\').slice(0, -13) + \'/scripts/react-native-xcode.sh\'\\"`"',
30+
'"export SENTRY_PROPERTIES=sentry.properties\\nexport EXTRA_PACKAGER_ARGS=\\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\\"\\nexport NODE_BINARY=node\\n`node --print \\"require.resolve(\'@sentry/cli/package.json\').slice(0, -13) + \'/bin/sentry-cli\'\\"` react-native xcode --force-foreground `node --print \\"require.resolve(\'react-native/package.json\').slice(0, -13) + \'/scripts/react-native-xcode.sh\'\\"`\\n\\n`node --print \\\"require.resolve(\'@sentry/react-native/package.json\').slice(0, -13) + \'/scripts/collect-modules.sh\'\\\"`"',
3131
};
3232

3333
const buildScriptWeDontExpect = {

0 commit comments

Comments
 (0)