sentry-wizard icon indicating copy to clipboard operation
sentry-wizard copied to clipboard

react-native: javascript not patched when using typescript

Open wodCZ opened this issue 5 years ago • 4 comments

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.

wodCZ avatar Jan 28 '20 09:01 wodCZ

I had the same problem.

0xTomDaniel avatar Mar 09 '20 20:03 0xTomDaniel

same problem here

leonardoballand avatar Jun 15 '20 09:06 leonardoballand

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 🥀

github-actions[bot] avatar Feb 22 '22 12:02 github-actions[bot]

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).

wodCZ avatar Feb 22 '22 12:02 wodCZ

@krystofwoldrich isnt this already done? https://github.com/getsentry/sentry-wizard/releases/tag/v2.1.0

marandaneto avatar Oct 14 '22 13:10 marandaneto

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.

krystofwoldrich avatar Oct 14 '22 13:10 krystofwoldrich