react-native: javascript not patched when using typescript
The current template for new react native projects using typescript has App.tsx file instead of App.js.
When running the wizard, I've noticed this output:
✅ Patched build.gradle file.
✅ Patched App.js file.
✅ Added sentry.properties file to android
Successfully set up android for react-native
✅ Patched build script in Xcode project.
✅ Patched App.js file.
✅ Added sentry.properties file to ios
Successfully set up ios for react-native
And I confirmed, the App.js file was not patched (it doesn't exist) - the step passed without actually patching anything.
Link to current typescript template: https://github.com/react-native-community/react-native-template-typescript/tree/master/template Link to current steps to initialize react native project with typescript: https://facebook.github.io/react-native/docs/typescript
I think adding another block here: https://github.com/getsentry/sentry-wizard/blob/master/lib/Steps/Integrations/ReactNative.ts#L51-L63 would fix this step:
await patchMatchingFile(
'App.tsx',
this.patchJs.bind(this),
answers,
platform,
);
But probably this section of code could be refactored to more sophisticated context detection.
I had the same problem.
same problem here
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
The issue still exists: sentry-wizard doesn't support official react-native typescript starter. I haven't tested lately, but I believe it's still "lying" about that the wizard finished successfully (while it did not).
@krystofwoldrich isnt this already done? https://github.com/getsentry/sentry-wizard/releases/tag/v2.1.0
Yes, wizard 2.1.0 and newer supports the official TS template. It also informs users in case it couldn't find a file to patch.