From 3fab11bb2f02cfda8a1eae2356eaa8298a9b602e Mon Sep 17 00:00:00 2001 From: Quinlan Jung Date: Tue, 30 Jan 2024 11:41:12 -0800 Subject: [PATCH 1/5] feat(expo) read .env file in upload script --- scripts/expo-upload-sourcemaps.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/expo-upload-sourcemaps.js b/scripts/expo-upload-sourcemaps.js index 28f356f925..76986b5c99 100755 --- a/scripts/expo-upload-sourcemaps.js +++ b/scripts/expo-upload-sourcemaps.js @@ -101,6 +101,15 @@ function groupAssets(assetPaths) { return groups; } +process.env.NODE_ENV = process.env.NODE_ENV || 'development'; +const projectRoot = '.'; // Assume script is run from the project root +try { + require('@expo/env').load(projectRoot); +} catch (error) { + console.warn('⚠️ Failed to load environment variables from @expo/env.'); + console.warn(error); +} + let sentryProject = getEnvVar(SENTRY_PROJECT); let authToken = getEnvVar(SENTRY_AUTH_TOKEN); const sentryCliBin = getEnvVar(SENTRY_CLI_EXECUTABLE) || require.resolve('@sentry/cli/bin/sentry-cli'); From 4b94c498fe3315918490b6f541bff8c33b52d1d6 Mon Sep 17 00:00:00 2001 From: Quinlan Jung Date: Tue, 30 Jan 2024 15:23:41 -0800 Subject: [PATCH 2/5] Update scripts/expo-upload-sourcemaps.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kryštof Woldřich <31292499+krystofwoldrich@users.noreply.github.com> --- scripts/expo-upload-sourcemaps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/expo-upload-sourcemaps.js b/scripts/expo-upload-sourcemaps.js index 76986b5c99..cecf3efa9e 100755 --- a/scripts/expo-upload-sourcemaps.js +++ b/scripts/expo-upload-sourcemaps.js @@ -106,7 +106,7 @@ const projectRoot = '.'; // Assume script is run from the project root try { require('@expo/env').load(projectRoot); } catch (error) { - console.warn('⚠️ Failed to load environment variables from @expo/env.'); + console.warn('⚠️ Failed to load environment variables using @expo/env.'); console.warn(error); } From 8ece709f43fe95d2641d12314038828757ddaf38 Mon Sep 17 00:00:00 2001 From: Quinlan Jung Date: Tue, 30 Jan 2024 15:28:56 -0800 Subject: [PATCH 3/5] pr feedback --- scripts/expo-upload-sourcemaps.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/expo-upload-sourcemaps.js b/scripts/expo-upload-sourcemaps.js index cecf3efa9e..7f815ee409 100755 --- a/scripts/expo-upload-sourcemaps.js +++ b/scripts/expo-upload-sourcemaps.js @@ -101,7 +101,6 @@ function groupAssets(assetPaths) { return groups; } -process.env.NODE_ENV = process.env.NODE_ENV || 'development'; const projectRoot = '.'; // Assume script is run from the project root try { require('@expo/env').load(projectRoot); From ebd19b60f27f38fdfd53f8016a429008aa4635d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:57:23 +0100 Subject: [PATCH 4/5] Update expo-upload-sourcemaps.js --- scripts/expo-upload-sourcemaps.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/expo-upload-sourcemaps.js b/scripts/expo-upload-sourcemaps.js index 20743feaf9..11600a4465 100755 --- a/scripts/expo-upload-sourcemaps.js +++ b/scripts/expo-upload-sourcemaps.js @@ -101,6 +101,7 @@ function groupAssets(assetPaths) { return groups; } +process.env.NODE_ENV = process.env.NODE_ENV || 'development'; // Ensures precedence .env.development > .env (the same as @expo/cli) const projectRoot = '.'; // Assume script is run from the project root try { require('@expo/env').load(projectRoot); From 20ca2762d2412d48ce349ba308a9828dff38083d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:05:23 +0100 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c38172ad72..629e88fd6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ ``` - Only upload Expo artifact if source map exists ([#3568](https://github.com/getsentry/sentry-react-native/pull/3568)) +- Read `.env` file in `sentry-expo-upload-sourcemaps` ([#3571](https://github.com/getsentry/sentry-react-native/pull/3571)) ### Fixes