From 66311a300e03bf111d56eaa0dabb4d66fccb81f5 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 21 Jul 2022 10:57:12 +0200 Subject: [PATCH 1/3] Revert "Revert "Patch React Native xcode RN 0.69" (#177)" This reverts commit 76ab6d9540dc3dbf4a2e0fd1ee818e382b08b331. --- CHANGELOG.md | 2 -- lib/Steps/Integrations/ReactNative.ts | 38 +++++++-------------------- package.json | 1 + 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8400570b7..3de03d905 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,6 @@ ## 1.3.1 -- revert(react-native) Xcode linking for RN 0.69 and higher (#177) - ## 1.3.0 - chore(deps): Bump sentry-cli to 1.72.0 (#154) diff --git a/lib/Steps/Integrations/ReactNative.ts b/lib/Steps/Integrations/ReactNative.ts index c62f83243..30a824f32 100755 --- a/lib/Steps/Integrations/ReactNative.ts +++ b/lib/Steps/Integrations/ReactNative.ts @@ -231,9 +231,9 @@ export class ReactNative extends MobileProject { for (const script of buildScripts) { if ( !script.shellScript.match( - /(packager|scripts)\/react-native-xcode\.sh\b/, + /\/scripts\/react-native-xcode\.sh/i, ) || - script.shellScript.match(/sentry-cli\s+react-native[\s-]xcode/) + script.shellScript.match(/sentry-cli\s+react-native\s+xcode/i) ) { continue; } @@ -243,9 +243,10 @@ export class ReactNative extends MobileProject { '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: any) => - `../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ${match}`, + '$REACT_NATIVE_XCODE', + () => + // eslint-disable-next-line no-useless-escape + '\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\"', ); script.shellScript = JSON.stringify(code); } @@ -339,38 +340,20 @@ export class ReactNative extends MobileProject { } // ignore scripts that do not invoke the react-native-xcode command. - if (!script.shellScript.match(/sentry-cli\s+react-native[\s-]xcode\b/)) { + if (!script.shellScript.match(/sentry-cli\s+react-native\s+xcode/i)) { continue; } script.shellScript = JSON.stringify( JSON.parse(script.shellScript) - // "legacy" location for this. This is what happens if users followed - // the old documentation for where to add the bundle command - .replace( - /^..\/node_modules\/@sentry\/react-native\/bin\/bundle-frameworks\s*?\r\n?/m, - '', - ) - // legacy location for dsym upload - .replace( - /^..\/node_modules\/@sentry\/cli\/bin\/sentry-cli upload-dsym\s*?\r?\n/m, - '', - ) // remove sentry properties export .replace(/^export SENTRY_PROPERTIES=sentry.properties\r?\n/m, '') // unwrap react-native-xcode.sh command. In case someone replaced it // entirely with the sentry-cli command we need to put the original // version back in. .replace( - /^(?:..\/node_modules\/@sentry\/cli\/bin\/)?sentry-cli\s+react-native[\s-]xcode(\s+.*?)$/m, - (match: any, m1: string) => { - const rv = m1.trim(); - if (rv === '') { - return '../node_modules/react-native/scripts/react-native-xcode.sh'; - } else { - return rv; - } - }, + /\.\.\/node_modules\/@sentry\/cli\/bin\/sentry-cli\s+react-native\s+xcode\s+\$REACT_NATIVE_XCODE/i, + '$REACT_NATIVE_XCODE', ), ); } @@ -385,9 +368,6 @@ export class ReactNative extends MobileProject { } if ( - script.shellScript.match( - /@sentry\/react-native\/bin\/bundle-frameworks\b/, - ) || script.shellScript.match( /@sentry\/cli\/bin\/sentry-cli\s+upload-dsym\b/, ) diff --git a/package.json b/package.json index 27f08a7fe..e31bb23f2 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "fix:eslint": "eslint . --format stylish --fix", "test": "yarn build && jest", "try": "ts-node bin.ts", + "try:uninstall": "ts-node bin.ts --uninstall", "test:watch": "jest --watch --notify" }, "jest": { From 5d04e1e7177069fc41405c0c87c35deb0c536aa7 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 21 Jul 2022 10:57:58 +0200 Subject: [PATCH 2/3] fix changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3de03d905..6985e1d14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,14 @@ # Changelog -## 1.3.1 +## 2.0.0 + +- fix(react-native) Xcode linking for RN 0.69 and higher (#173) ## 1.3.0 - chore(deps): Bump sentry-cli to 1.72.0 (#154) - feat(nextjs): Use helper function in `_error.js` (#170) - fix(electron): Fix version detection to use electron/package.json (#161) -- fix(react-native) Xcode linking for RN 0.69 and higher (#173) ## 1.2.17 From 2439a6e74518c0b249b8001de670a89c2c972438 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 21 Jul 2022 10:58:24 +0200 Subject: [PATCH 3/3] fix pr id --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6985e1d14..0684cfdb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.0.0 -- fix(react-native) Xcode linking for RN 0.69 and higher (#173) +- fix(react-native) Xcode linking for RN 0.69 and higher (#178) ## 1.3.0