Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade @sentry/react-native to version 5 #337

Merged
merged 15 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

### 🛠 Breaking changes

- Upgrade `@sentry/react-native` to `5.5.0`.
- Checkout [the migration guide](https://docs.sentry.io/platforms/react-native/migration/#from-4x-to-5x) for breaking changes

### 🎉 New features

### 🐛 Bug fixes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

[![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/)

# sentry-expo
Expand Down
2 changes: 1 addition & 1 deletion build/integrations/bare.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions build/integrations/bare.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/integrations/bare.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"homepage": "https://docs.expo.io/guides/using-sentry/",
"dependencies": {
"@expo/spawn-async": "^1.7.0",
"@sentry/integrations": "7.37.2",
"@sentry/react": "7.37.2",
"@sentry/react-native": "4.15.2",
"@sentry/types": "7.37.2",
"@sentry/integrations": "7.52.1",
"@sentry/react": "7.52.1",
"@sentry/react-native": "5.5.0",
"@sentry/types": "7.52.1",
"mkdirp": "^1.0.4",
"rimraf": "^3.0.2"
},
Expand All @@ -65,9 +65,9 @@
"expo-device": "~5.0.0",
"expo-module-scripts": "3.0.4",
"expo-updates": "~0.15.6",
"jest": "26",
"react": "18.1.0",
"react-native": "^0.70.5",
"jest": "29.5.0",
"react": "18.2.0",
"react-native": "0.71.8",
"react-native-web": "~0.18.9",
"typescript": "^4.7.4"
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/build/withSentryAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function modifyAppBuildGradle(buildGradle) {
if (buildGradle.includes('/sentry.gradle"')) {
return buildGradle;
}
// Use the same location that sentry-wizard uses
// Use the same location that sentry-wizard uses
// See: https://github.com/getsentry/sentry-wizard/blob/e9b4522f27a852069c862bd458bdf9b07cab6e33/lib/Steps/Integrations/ReactNative.ts#L232
const pattern = /^android {/m;
if (!buildGradle.match(pattern)) {
Expand Down
12 changes: 8 additions & 4 deletions plugin/build/withSentryIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ exports.writeSentryPropertiesTo = exports.modifyExistingXcodeBuildScript = expor
const config_plugins_1 = require("expo/config-plugins");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const SENTRY_CLI = `\`node --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"\``;
const withSentryIOS = (config, sentryProperties) => {
config = (0, config_plugins_1.withXcodeProject)(config, (config) => {
const xcodeProject = config.modResults;
const sentryBuildPhase = xcodeProject.pbxItemByComment('Upload Debug Symbols to Sentry', 'PBXShellScriptBuildPhase');
if (!sentryBuildPhase) {
xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
shellPath: '/bin/sh',
shellScript: 'export SENTRY_PROPERTIES=sentry.properties\\n' +
"`node --print \"require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'\"` upload-dsym --force-foreground",
shellScript: `
export SENTRY_PROPERTIES=sentry.properties
[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
${SENTRY_CLI} debug-files upload --force-foreground "$INCLUDE_SOURCES_FLAG" "$DWARF_DSYM_FOLDER_PATH"
`
});
}
let bundleReactNativePhase = xcodeProject.pbxItemByComment('Bundle React Native code and images', 'PBXShellScriptBuildPhase');
Expand All @@ -61,8 +65,8 @@ function modifyExistingXcodeBuildScript(script) {
code =
'export SENTRY_PROPERTIES=sentry.properties\n' +
'export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"\n' +
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 " +
match);
code.replace(/^.*?(packager|scripts)\/react-native-xcode\.sh\s*(\\'\\\\")?/m, (match) => `${SENTRY_CLI} react-native xcode --force-foreground ${match}`) +
"\n\n`node --print \"require.resolve('@sentry/react-native/package.json').slice(0, -13) + '/scripts/collect-modules.sh'\"`";
script.shellScript = JSON.stringify(code);
}
exports.modifyExistingXcodeBuildScript = modifyExistingXcodeBuildScript;
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/__tests__/modifyXcodeProject-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const buildScriptWithoutSentry = {

const buildScriptWithSentry = {
shellScript:
'"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"',
'"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\'\\\"`"',
};

const monorepoBuildScriptWithoutSentry = {
Expand All @@ -27,7 +27,7 @@ const monorepoBuildScriptWithoutSentry = {

const monorepoBuildScriptWithSentry = {
shellScript:
'"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\'\\"`"',
'"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\'\\\"`"',
};

const buildScriptWeDontExpect = {
Expand Down
Loading