From 87467a524feef1c0297bf25060ecbc9bf99fdb8f Mon Sep 17 00:00:00 2001 From: rohankeskarwednesday Date: Wed, 21 Aug 2024 12:06:15 +0530 Subject: [PATCH 1/6] fix: fix complexity in eslint --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index c5366cf..2e0a9a9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -120,7 +120,7 @@ module.exports = { } ], 'no-shadow': 'error', - complexity: ['error', 10], + complexity: ['error', 2], 'no-empty': 'error', 'import/order': [ 'error', From c9bd7c902c4f736c1c80442593ba20f1859ba5d2 Mon Sep 17 00:00:00 2001 From: rohankeskarwednesday Date: Wed, 21 Aug 2024 12:24:54 +0530 Subject: [PATCH 2/6] fix: fix complexity --- .eslintrc.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2e0a9a9..a2da718 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,16 +1,15 @@ const fs = require('fs'); const path = require('path'); - const prettierOptions = JSON.parse( - fs.readFileSync(path.resolve(__dirname, '.prettierrc'), 'utf8'), + fs.readFileSync(path.resolve(__dirname, '.prettierrc'), 'utf8') ); module.exports = { root: true, parser: 'babel-eslint', extends: [ 'airbnb', - 'prettier', + 'prettier', 'prettier/react', 'plugin:prettier/recommended', 'plugin:sonarjs/recommended', @@ -54,13 +53,13 @@ module.exports = { 'import/no-unresolved': 0, 'import/prefer-default-export': 0, 'react/jsx-props-no-spreading': 0, - 'camelcase': ['error', { 'properties': 'always', ignoreImports: false}], + camelcase: ['error', { properties: 'always', ignoreImports: false }], indent: [ 2, 2, { - SwitchCase: 1, - }, + SwitchCase: 1 + } ], 'jsx-a11y/aria-props': 2, 'jsx-a11y/heading-has-content': 0, @@ -171,4 +170,4 @@ module.exports = { } } } -}; \ No newline at end of file +}; From 28550137f9f71db2ac1ecb2c46b6df998475e8dc Mon Sep 17 00:00:00 2001 From: rohankeskarwednesday Date: Wed, 21 Aug 2024 15:01:38 +0530 Subject: [PATCH 3/6] feat: add env support --- .env | 2 ++ app/config/index.dev.js | 4 ++- app/config/index.js | 4 ++- app/config/index.production.js | 4 ++- app/utils/growthbook.js | 64 ++++++++++++++++++++++++++++++++++ babel.config.js | 11 ++++++ ios/Podfile.lock | 2 +- package.json | 2 ++ yarn.lock | 21 ++++++++++- 9 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 .env create mode 100644 app/utils/growthbook.js diff --git a/.env b/.env new file mode 100644 index 0000000..e3c125e --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +JSON_PLACEHOLDER_API="https://jsonplaceholder.typicode.com" +SIMPSONS_API="https://thesimpsonsquoteapi.glitch.me/" \ No newline at end of file diff --git a/app/config/index.dev.js b/app/config/index.dev.js index 5482277..d03639d 100644 --- a/app/config/index.dev.js +++ b/app/config/index.dev.js @@ -1,3 +1,5 @@ +import { JSON_PLACEHOLDER_API } from '@env'; + export const Config = { - API_URL: 'https://jsonplaceholder.typicode.com/users/' + API_URL: `${JSON_PLACEHOLDER_API}/users/` }; diff --git a/app/config/index.js b/app/config/index.js index 6beae24..01e9e29 100644 --- a/app/config/index.js +++ b/app/config/index.js @@ -1,3 +1,5 @@ +import { SIMPSONS_API } from '@env'; + export const Config = { - API_URL: 'https://thesimpsonsquoteapi.glitch.me/' + API_URL: SIMPSONS_API }; diff --git a/app/config/index.production.js b/app/config/index.production.js index 5482277..d03639d 100644 --- a/app/config/index.production.js +++ b/app/config/index.production.js @@ -1,3 +1,5 @@ +import { JSON_PLACEHOLDER_API } from '@env'; + export const Config = { - API_URL: 'https://jsonplaceholder.typicode.com/users/' + API_URL: `${JSON_PLACEHOLDER_API}/users/` }; diff --git a/app/utils/growthbook.js b/app/utils/growthbook.js new file mode 100644 index 0000000..bdaaf58 --- /dev/null +++ b/app/utils/growthbook.js @@ -0,0 +1,64 @@ +import { GrowthBook } from '@growthbook/growthbook'; +import { GROWTH_BOOK_API_HOST, GROWTH_BOOK_CLIENT_KEY } from '@env'; + +let growthBookClient; + +/** + * creates an instance of the growthBook client + * @returns growthBook client + */ +export const createGrowthBookClient = userEmail => { + const growthBook = new GrowthBook({ + apiHost: GROWTH_BOOK_API_HOST, + clientKey: GROWTH_BOOK_CLIENT_KEY, + enableDevMode: true, + subscribeToChanges: true + }); + + growthBook.setAttributes({ + email: userEmail + }); + + return growthBook; +}; + +/** + * Function to get the GrowthBook client instance + * @returns {GrowthBook} growthBook instance + */ +export function getGrowthBookClient(email) { + if (growthBookClient) { + return growthBookClient; + } + return createGrowthBookClient(email); +} + +/** + * Function to get growthBook feature + * @param {String} email + * @returns {Applicant} growthBook feature value + */ +export async function getGrowthBookFeaturesData(name, email) { + try { + const growthBook = getGrowthBookClient(email); + await growthBook.loadFeatures(); + return growthBook.getFeatureValue(name); + } catch (error) { + return new Error(error); + } +} + +/** + * Function to get growthBook feature + * @param {String} name + * @returns {Boolean} growthBook feature status + */ +export async function getGrowthBookFeatureFlag(name, email) { + try { + const growthBook = getGrowthBookClient(email); + await growthBook.loadFeatures(); + return growthBook.isOn(name); + } catch (error) { + return new Error(error); + } +} diff --git a/babel.config.js b/babel.config.js index a040842..de969d9 100644 --- a/babel.config.js +++ b/babel.config.js @@ -32,6 +32,17 @@ module.exports = function(api = { cache: () => {} }) { '@utils': './app/utils' } } + ], + [ + 'module:react-native-dotenv', + { + moduleName: '@env', + path: '.env', + blacklist: null, + whitelist: null, + safe: false, + allowUndefined: true + } ] ] }; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6d398df..4ea505e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1371,7 +1371,7 @@ SPEC CHECKSUMS: RNReanimated: 8a4d86eb951a4a99d8e86266dc71d7735c0c30a9 RNScreens: b6b64d956af3715adbfe84808694ae82d3fec74f SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 - Yoga: 805bf71192903b20fc14babe48080582fee65a80 + Yoga: d17d2cc8105eed528474683b42e2ea310e1daf61 PODFILE CHECKSUM: 71a7eba1109c7de188217c03cf1824ab1d487aec diff --git a/package.json b/package.json index ec98e16..88f1218 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "dependencies": { "@babel/polyfill": "7.12.1", "@expo/webpack-config": "~19.0.1", + "@growthbook/growthbook": "^1.2.0", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-community/masked-view": "^0.1.11", "@react-native/metro-config": "^0.75.0-main", @@ -137,6 +138,7 @@ "prettier-eslint": "^9.0.0", "prettier-standard": "^15.0.1", "pretty-quick": "^1.11.1", + "react-native-dotenv": "^3.4.11", "react-native-rename": "^3.2.14", "react-test-renderer": "^18.2.0" }, diff --git a/yarn.lock b/yarn.lock index e0fd97e..d663ab3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1779,6 +1779,13 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== +"@growthbook/growthbook@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@growthbook/growthbook/-/growthbook-1.2.0.tgz#e0859f14614a50cd9cadb603b0834b2203be829c" + integrity sha512-lL47UKvzUaUq2QLwiePrUbM/p+NPv6WUGrGs2bjw1Zc51dtNtxAD+s1hXEU9wpAF913kbiOW2+yRa67UhxSkuw== + dependencies: + dom-mutator "^0.6.0" + "@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" @@ -5855,6 +5862,11 @@ dom-converter@^0.2.0: dependencies: utila "~0.4" +dom-mutator@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/dom-mutator/-/dom-mutator-0.6.0.tgz#079d7a4b3e8981a562cd777548b99baab51d65c5" + integrity sha512-iCt9o0aYfXMUkz/43ZOAUFQYotjGB+GNbYJiJdz4TgXkyToXbbRy5S6FbTp72lRBtfpUMwEc1KmpFEU4CZeoNg== + dom-serializer@^1.0.1: version "1.4.1" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.4.1.tgz#de5d41b1aea290215dc45a6dae8adcf1d32e2d30" @@ -5930,7 +5942,7 @@ dotenv-expand@~11.0.6: dependencies: dotenv "^16.4.4" -dotenv@^16.3.1, dotenv@^16.4.4, dotenv@~16.4.5: +dotenv@^16.3.1, dotenv@^16.4.4, dotenv@^16.4.5, dotenv@~16.4.5: version "16.4.5" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== @@ -11449,6 +11461,13 @@ react-native-cli@^2.0.1: prompt "^0.2.14" semver "^5.0.3" +react-native-dotenv@^3.4.11: + version "3.4.11" + resolved "https://registry.yarnpkg.com/react-native-dotenv/-/react-native-dotenv-3.4.11.tgz#2e6c4eabd55d5f1bf109b3dd9141dadf9c55cdd4" + integrity sha512-6vnIE+WHABSeHCaYP6l3O1BOEhWxKH6nHAdV7n/wKn/sciZ64zPPp2NUdEUf1m7g4uuzlLbjgr+6uDt89q2DOg== + dependencies: + dotenv "^16.4.5" + react-native-gesture-handler@~2.16.0: version "2.16.0" resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.16.0.tgz#45a00b5988e74ebc58f130c8d1443319c8e678db" From e451c07fbec674de7f91a49c92e46bb102cfd116 Mon Sep 17 00:00:00 2001 From: rohankeskarwednesday Date: Mon, 26 Aug 2024 10:56:44 +0530 Subject: [PATCH 4/6] feat: add sentry --- package.json | 1 + yarn.lock | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 200 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 88f1218..9554cdb 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@react-navigation/compat": "^5.3.15", "@react-navigation/native": "^6.1.17", "@react-navigation/stack": "^6.3.29", + "@sentry/react-native": "^5.30.0", "apisauce": "^3.0.1", "axios-mock-adapter": "^1.17.0", "babel-plugin-module-resolver": "^5.0.0", diff --git a/yarn.lock b/yarn.lock index d663ab3..46c952e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2670,6 +2670,182 @@ component-type "^1.2.1" join-component "^1.1.0" +"@sentry-internal/feedback@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.119.0.tgz#429b3ea0fd34e928d2e7de5dcbe9377272a3f221" + integrity sha512-om8TkAU5CQGO8nkmr7qsSBVkP+/vfeS4JgtW3sjoTK0fhj26+DljR6RlfCGWtYQdPSP6XV7atcPTjbSnsmG9FQ== + dependencies: + "@sentry/core" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry-internal/replay-canvas@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.119.0.tgz#85669d184ba79150e64d05de02f5e2b616e68371" + integrity sha512-NL02VQx6ekPxtVRcsdp1bp5Tb5w6vnfBKSIfMKuDRBy5A10Uc3GSoy/c3mPyHjOxB84452A+xZSx6bliEzAnuA== + dependencies: + "@sentry/core" "7.119.0" + "@sentry/replay" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry-internal/tracing@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.119.0.tgz#201561af2a4ad1837333287c26050a5e688537ca" + integrity sha512-oKdFJnn+56f0DHUADlL8o9l8jTib3VDLbWQBVkjD9EprxfaCwt2m8L5ACRBdQ8hmpxCEo4I8/6traZ7qAdBUqA== + dependencies: + "@sentry/core" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry/babel-plugin-component-annotate@2.20.1": + version "2.20.1" + resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-2.20.1.tgz#204c63ed006a048f48f633876e1b8bacf87a9722" + integrity sha512-4mhEwYTK00bIb5Y9UWIELVUfru587Vaeg0DQGswv4aIRHIiMKLyNqCEejaaybQ/fNChIZOKmvyqXk430YVd7Qg== + +"@sentry/browser@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.119.0.tgz#65004015c107be5d2f49a852ebcffc5d19d90e0d" + integrity sha512-WwmW1Y4D764kVGeKmdsNvQESZiAn9t8LmCWO0ucBksrjL2zw9gBPtOpRcO6l064sCLeSxxzCN+kIxhRm1gDFEA== + dependencies: + "@sentry-internal/feedback" "7.119.0" + "@sentry-internal/replay-canvas" "7.119.0" + "@sentry-internal/tracing" "7.119.0" + "@sentry/core" "7.119.0" + "@sentry/integrations" "7.119.0" + "@sentry/replay" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry/cli-darwin@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.31.2.tgz#faeb87d09d8b21b8b8dd2e2aa848b538f01ddd26" + integrity sha512-BHA/JJXj1dlnoZQdK4efRCtHRnbBfzbIZUKAze7oRR1RfNqERI84BVUQeKateD3jWSJXQfEuclIShc61KOpbKw== + +"@sentry/cli-linux-arm64@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.31.2.tgz#669c9c3f7f9130d26f5db732f793378863d58869" + integrity sha512-FLVKkJ/rWvPy/ka7OrUdRW63a/z8HYI1Gt8Pr6rWs50hb7YJja8lM8IO10tYmcFE/tODICsnHO9HTeUg2g2d1w== + +"@sentry/cli-linux-arm@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.31.2.tgz#3e36ed7db09e922f00221281252e58dfd8755ea5" + integrity sha512-W8k5mGYYZz/I/OxZH65YAK7dCkQAl+wbuoASGOQjUy5VDgqH0QJ8kGJufXvFPM+f3ZQGcKAnVsZ6tFqZXETBAw== + +"@sentry/cli-linux-i686@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.31.2.tgz#02b7da274369b78a5676c20bb26cc37caed5244b" + integrity sha512-A64QtzaPi3MYFpZ+Fwmi0mrSyXgeLJ0cWr4jdeTGrzNpeowSteKgd6tRKU+LVq0k5shKE7wdnHk+jXnoajulMA== + +"@sentry/cli-linux-x64@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.31.2.tgz#54f74a9e5925db9ddafebc0efd4056c5377be5fd" + integrity sha512-YL/r+15R4mOEiU3mzn7iFQOeFEUB6KxeKGTTrtpeOGynVUGIdq4nV5rHow5JDbIzOuBS3SpOmcIMluvo1NCh0g== + +"@sentry/cli-win32-i686@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.31.2.tgz#5dab845a824be0927566171aa05f015e887fe82d" + integrity sha512-Az/2bmW+TFI059RE0mSBIxTBcoShIclz7BDebmIoCkZ+retrwAzpmBnBCDAHow+Yi43utOow+3/4idGa2OxcLw== + +"@sentry/cli-win32-x64@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.31.2.tgz#e12fec0a54f6d9cced5235fbc68ba8f94165634b" + integrity sha512-XIzyRnJu539NhpFa+JYkotzVwv3NrZ/4GfHB/JWA2zReRvsk39jJG8D5HOmm0B9JA63QQT7Dt39RW8g3lkmb6w== + +"@sentry/cli@2.31.2": + version "2.31.2" + resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.31.2.tgz#39df8e52966aa8db4f9c51f4bc77abd62b6a630e" + integrity sha512-2aKyUx6La2P+pplL8+2vO67qJ+c1C79KYWAyQBE0JIT5kvKK9JpwtdNoK1F0/2mRpwhhYPADCz3sVIRqmL8cQQ== + dependencies: + https-proxy-agent "^5.0.0" + node-fetch "^2.6.7" + progress "^2.0.3" + proxy-from-env "^1.1.0" + which "^2.0.2" + optionalDependencies: + "@sentry/cli-darwin" "2.31.2" + "@sentry/cli-linux-arm" "2.31.2" + "@sentry/cli-linux-arm64" "2.31.2" + "@sentry/cli-linux-i686" "2.31.2" + "@sentry/cli-linux-x64" "2.31.2" + "@sentry/cli-win32-i686" "2.31.2" + "@sentry/cli-win32-x64" "2.31.2" + +"@sentry/core@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.119.0.tgz#a6e41119bb03ec27689f9ad04e79d1fba5b7fc37" + integrity sha512-CS2kUv9rAJJEjiRat6wle3JATHypB0SyD7pt4cpX5y0dN5dZ1JrF57oLHRMnga9fxRivydHz7tMTuBhSSwhzjw== + dependencies: + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry/hub@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-7.119.0.tgz#a94d657b9d3cfd4cc061c5c238f86faefb55d5d8" + integrity sha512-183h5B/rZosLxpB+ZYOvFdHk0rwZbKskxqKFtcyPbDAfpCUgCass41UTqyxF6aH1qLgCRxX8GcLRF7frIa/SOg== + dependencies: + "@sentry/core" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry/integrations@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.119.0.tgz#5b25c603026dbacfe1ae7bb8d768506a129149fb" + integrity sha512-OHShvtsRW0A+ZL/ZbMnMqDEtJddPasndjq+1aQXw40mN+zeP7At/V1yPZyFaURy86iX7Ucxw5BtmzuNy7hLyTA== + dependencies: + "@sentry/core" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + localforage "^1.8.1" + +"@sentry/react-native@^5.30.0": + version "5.30.0" + resolved "https://registry.yarnpkg.com/@sentry/react-native/-/react-native-5.30.0.tgz#dbf3ef54254f59fc33127d7c1931e1aa4b8f978b" + integrity sha512-6p2o+x5V9Hfe+6UPbMsMrEYPqv39HnkHbz7fZ6YGVqbcdmoXlztFJYtWUZgUCxAaq53L/LPbfmwJwxsdaPxGKg== + dependencies: + "@sentry/babel-plugin-component-annotate" "2.20.1" + "@sentry/browser" "7.119.0" + "@sentry/cli" "2.31.2" + "@sentry/core" "7.119.0" + "@sentry/hub" "7.119.0" + "@sentry/integrations" "7.119.0" + "@sentry/react" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry/react@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.119.0.tgz#79f2c9d94322a3afbfa8af9f5b872f7c2e9b0820" + integrity sha512-cf8Cei+qdSA26gx+IMAuc/k44PeBImNzIpXi3930SLhUe44ypT5OZ/44L6xTODHZzTIyMSJPduf59vT2+eW9yg== + dependencies: + "@sentry/browser" "7.119.0" + "@sentry/core" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + hoist-non-react-statics "^3.3.2" + +"@sentry/replay@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.119.0.tgz#50881079d013c77f87a994331d8bcad1d49e0960" + integrity sha512-BnNsYL+X5I4WCH6wOpY6HQtp4MgVt0NVlhLUsEyrvMUiTs0bPkDBrulsgZQBUKJsbOr3l9nHrFoNVB/0i6WNLA== + dependencies: + "@sentry-internal/tracing" "7.119.0" + "@sentry/core" "7.119.0" + "@sentry/types" "7.119.0" + "@sentry/utils" "7.119.0" + +"@sentry/types@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.119.0.tgz#8b3d7a1405c362e75cd900d46089df4e70919d2a" + integrity sha512-27qQbutDBPKGbuJHROxhIWc1i0HJaGLA90tjMu11wt0E4UNxXRX+UQl4Twu68v4EV3CPvQcEpQfgsViYcXmq+w== + +"@sentry/utils@7.119.0": + version "7.119.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.119.0.tgz#debe29020f6ef3786a5bd855cf1b97116b7be826" + integrity sha512-ZwyXexWn2ZIe2bBoYnXJVPc2esCSbKpdc6+0WJa8eutXfHq3FRKg4ohkfCBpfxljQGEfP1+kfin945lA21Ka+A== + dependencies: + "@sentry/types" "7.119.0" + "@sideway/address@^4.1.5": version "4.1.5" resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5" @@ -7812,7 +7988,7 @@ hoist-non-react-statics@^2.5.5: resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== -hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0: +hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -7941,7 +8117,7 @@ http-proxy@^1.18.1: follow-redirects "^1.0.0" requires-port "^1.0.0" -https-proxy-agent@^5.0.1: +https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -8015,6 +8191,11 @@ image-size@^1.0.2: dependencies: queue "6.0.2" +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== + immer@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/immer/-/immer-4.0.2.tgz#9ff0fcdf88e06f92618a5978ceecb5884e633559" @@ -9252,6 +9433,13 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lie@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" + integrity sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw== + dependencies: + immediate "~3.0.5" + lighthouse-logger@^1.0.0: version "1.4.2" resolved "https://registry.yarnpkg.com/lighthouse-logger/-/lighthouse-logger-1.4.2.tgz#aef90f9e97cd81db367c7634292ee22079280aaa" @@ -9404,6 +9592,13 @@ loader-utils@^2.0.0: emojis-list "^3.0.0" json5 "^2.1.2" +localforage@^1.8.1: + version "1.10.0" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4" + integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg== + dependencies: + lie "3.1.1" + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -11240,7 +11435,7 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== -progress@2.0.3, progress@^2.0.0: +progress@2.0.3, progress@^2.0.0, progress@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== @@ -13801,7 +13996,7 @@ which@^1.2.9: dependencies: isexe "^2.0.0" -which@^2.0.1: +which@^2.0.1, which@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== From ec00ffb4ba66acf58ec84134a2c63650e80d6de4 Mon Sep 17 00:00:00 2001 From: rohankeskarwednesday Date: Mon, 26 Aug 2024 11:03:43 +0530 Subject: [PATCH 5/6] feat: sentry integration --- .gitignore | 3 ++- App.js | 6 ++++++ android/app/build.gradle | 3 ++- android/sentry.properties | 7 +++++++ app.json | 12 +++++++++++- .../project.pbxproj | 17 ++++++++++++++++- ios/sentry.properties | 7 +++++++ metro.config.js | 4 ++-- 8 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 android/sentry.properties create mode 100644 ios/sentry.properties diff --git a/.gitignore b/.gitignore index a47ba05..20eccd7 100644 --- a/.gitignore +++ b/.gitignore @@ -62,4 +62,5 @@ buck-out/ web-build/ dist/ reports -coverage \ No newline at end of file +coverage +.env.local diff --git a/App.js b/App.js index e749f55..2b5d328 100644 --- a/App.js +++ b/App.js @@ -4,6 +4,12 @@ import { registerRootComponent } from 'expo'; import App from '@app/app'; +import * as Sentry from '@sentry/react-native'; + +Sentry.init({ + dsn: + 'https://0fbf25b4bfb443b7ae58aa4baf34460e@o4505374929584128.ingest.us.sentry.io/4505374931812352' +}); if (!window.Intl) { new Promise(resolve => { diff --git a/android/app/build.gradle b/android/app/build.gradle index aeaef48..0ac5d44 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -77,6 +77,7 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea */ def jscFlavor = 'org.webkit:android-jsc:+' +apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle") android { ndkVersion rootProject.ext.ndkVersion @@ -173,4 +174,4 @@ dependencies { } apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); -applyNativeModulesAppBuildGradle(project) +applyNativeModulesAppBuildGradle(project) \ No newline at end of file diff --git a/android/sentry.properties b/android/sentry.properties new file mode 100644 index 0000000..9bf395f --- /dev/null +++ b/android/sentry.properties @@ -0,0 +1,7 @@ + +auth.token=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 + +defaults.org=wednesday-solutions-5p +defaults.project=react-native + +defaults.url=https://sentry.io/ diff --git a/app.json b/app.json index cff2191..b47ed55 100644 --- a/app.json +++ b/app.json @@ -22,6 +22,16 @@ }, "ios": { "bundleIdentifier": "com.wednesdaysolutions.rntws" - } + }, + "plugins": [ + [ + "@sentry/react-native/expo", + { + "url": "https://sentry.io/", + "project": "react-native", + "organization": "wednesday-solutions-5p" + } + ] + ] } } diff --git a/ios/reactnativetemplatews.xcodeproj/project.pbxproj b/ios/reactnativetemplatews.xcodeproj/project.pbxproj index bea3c7e..10bf812 100644 --- a/ios/reactnativetemplatews.xcodeproj/project.pbxproj +++ b/ios/reactnativetemplatews.xcodeproj/project.pbxproj @@ -151,6 +151,7 @@ 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */, 599D80DE15B63C654B8D3C08 /* [CP] Embed Pods Frameworks */, + 598EDDAFCB7E43A189BDFC8C /* Upload Debug Symbols to Sentry */, ); buildRules = ( ); @@ -219,7 +220,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios relative | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n\n"; + shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios relative | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n/bin/sh `\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"` `\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n\n"; }; 08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; @@ -306,6 +307,20 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-reactnativetemplatews/Pods-reactnativetemplatews-resources.sh\"\n"; showEnvVarsInLog = 0; }; + 598EDDAFCB7E43A189BDFC8C /* Upload Debug Symbols to Sentry */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + name = "Upload Debug Symbols to Sentry"; + inputPaths = ( + ); + outputPaths = ( + ); + shellPath = /bin/sh; + shellScript = "/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/ios/sentry.properties b/ios/sentry.properties new file mode 100644 index 0000000..9bf395f --- /dev/null +++ b/ios/sentry.properties @@ -0,0 +1,7 @@ + +auth.token=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 + +defaults.org=wednesday-solutions-5p +defaults.project=react-native + +defaults.url=https://sentry.io/ diff --git a/metro.config.js b/metro.config.js index c759cc0..442a286 100644 --- a/metro.config.js +++ b/metro.config.js @@ -1,5 +1,5 @@ // Learn more https://docs.expo.io/guides/customizing-metro -const { getDefaultConfig } = require('@expo/metro-config'); +const { getSentryExpoConfig } = require('@sentry/react-native/metro'); // eslint-disable-next-line fp/no-mutation -module.exports = getDefaultConfig(__dirname); +module.exports = getSentryExpoConfig(__dirname); From 8c110404d21be3ef5610f33b7a66410e484bc202 Mon Sep 17 00:00:00 2001 From: Shamoil Date: Tue, 27 Aug 2024 16:52:11 +0530 Subject: [PATCH 6/6] pr comments --- .env | 3 ++- App.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.env b/.env index e3c125e..aea4e7d 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ JSON_PLACEHOLDER_API="https://jsonplaceholder.typicode.com" -SIMPSONS_API="https://thesimpsonsquoteapi.glitch.me/" \ No newline at end of file +SIMPSONS_API="https://thesimpsonsquoteapi.glitch.me/" +SENTRY_DSN= "https://0fbf25b4bfb443b7ae58aa4baf34460e@o4505374929584128.ingest.us.sentry.io/4505374931812352" \ No newline at end of file diff --git a/App.js b/App.js index 2b5d328..2f4d2d2 100644 --- a/App.js +++ b/App.js @@ -4,11 +4,11 @@ import { registerRootComponent } from 'expo'; import App from '@app/app'; +import { SENTRY_DSN } from '@env'; import * as Sentry from '@sentry/react-native'; Sentry.init({ - dsn: - 'https://0fbf25b4bfb443b7ae58aa4baf34460e@o4505374929584128.ingest.us.sentry.io/4505374931812352' + dsn: SENTRY_DSN }); if (!window.Intl) {