bugsnag / bugsnag-expo

MIT License
11 stars 5 forks source link

Update lib/insert.js to insert snippets into either app.ts or app.js #98

Closed hannah-smartbear closed 1 year ago

hannah-smartbear commented 1 year ago

Goal

Updating expo-cli to support typescript by making sure that lib/insert.js inserts the relevant snippets into either app.js or app.ts, with app.ts taking priority. It previously only looked for and inserted into app.js

Design

The section of code that I modified in lib/insert.js first checks if app.ts exists. If it does, it checks whether the snippets are already there and inserts them if not. If app.ts does not exist, a try/catch block is implemented with the code to insert into app.js if it exists and does not already contain the snippets, and gives an error message that neither app.js nor app.ts could be found if not.

Testing