-
-
Notifications
You must be signed in to change notification settings - Fork 77
feat(react-native): skip patch native files when expo CNG #1211
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
base: master
Are you sure you want to change the base?
Conversation
src/react-native/git.ts
Outdated
|
|
||
| return NATIVE_FOLDERS.every((folder) => { | ||
| return lines.some((line) => { | ||
| const lineWithoutComment = line.split('#')[0].trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gitignore parser incorrectly strips mid-line hash characters
Low Severity
The line.split('#')[0] approach treats # anywhere on a line as a comment delimiter. Per the gitignore spec, # only starts a comment when it's the first non-whitespace character on the line — mid-line # is a literal part of the pattern. A gitignore entry like ios # native would be incorrectly parsed as matching ios, even though git treats the entire string (including the #) as a literal pattern. This could cause a false positive for isExpoCNG, leading to native file patching being skipped when it shouldn't be. A simpler approach — checking if the trimmed line starts with # to identify comment lines — would match gitignore semantics correctly.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1211 +/- ##
==========================================
+ Coverage 36.26% 37.32% +1.06%
==========================================
Files 144 154 +10
Lines 17746 18585 +839
Branches 1457 1558 +101
==========================================
+ Hits 6435 6937 +502
- Misses 11291 11630 +339
+ Partials 20 18 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Lms24
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (isExpo && (await isExpoCNG())) { | ||
| Sentry.setTag('expo-cng', true); | ||
| clack.log.info( | ||
| `Detected Expo Continous Native Generation (CNG) setup. Skipping native files patching.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `Detected Expo Continous Native Generation (CNG) setup. Skipping native files patching.`, | |
| `Detected Expo Continuous Native Generation (CNG) setup. Skipping native files patching.`, |
test/react-native/expo.test.ts
Outdated
| expect(git.areNativeFoldersInGitignore).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| test('handles errors from areNativeFoldersInGitignore gracefully', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h: Wdyt of catching possible errors like the ones tested here and handling the error gracefully. I would expect that if the detection fails the isExpoCNG function would return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I've wrapped in try catch block so now it should work as expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, used the wrong account here but its still me ;)
antonis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution @uragirii 🙇 Overall it looks great 🥇
I've left a few comments for possible improvements along with the sentry[bot] feedback.
We could also add a changelog entry. Something like:
## Unreleased
- fix(react-native): Skip native file patching when Expo CNG is detected ([#1211](https://github.com/getsentry/sentry-wizard/pull/1211))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| const iOSExists = fs.existsSync('ios'); | ||
| const androidExists = fs.existsSync('android'); | ||
|
|
||
| const bothNativeFoldersExist = iOSExists || androidExists; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading variable name contradicts OR operator logic
Low Severity
The variable bothNativeFoldersExist is assigned using || (OR), so it's true when either folder exists. The name "both" strongly implies && (AND), meaning both must exist. The actual logic is correct for the function's intent, but a future maintainer reading if (!bothNativeFoldersExist) would naturally interpret it as "if not both exist" (i.e., at most one exists), when it actually means "if neither exists." A name like anyNativeFolderExists would accurately reflect the || semantics.
|
Can someone run the ubuntu test CI again? It failed due to 500 from yarn install |


Description
AI Disclosure