Skip to content
This repository was archived by the owner on Sep 14, 2020. It is now read-only.

Commit af7c656

Browse files
committed
chore: allow setting api key + app version via env var in sourcemap scripts
1 parent b4e3eec commit af7c656

5 files changed

Lines changed: 29 additions & 9 deletions

File tree

examples/plain/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ This app provides working examples of how to deobfuscate stacktraces for JS, And
5959

6060
### JavaScript
6161

62-
You will need to upload source maps to Bugsnag in order to deobfuscate JavaScript stack traces. Example scripts for achieving this on Android/iOS in both debug and release builds can be found [here](scripts). The example script requires the installation of [bugsnag-sourcemaps](https://github.com/bugsnag/bugsnag-sourcemaps) to work, which is a dev dependency of this example project. The scripts can also be invoked in this example project using [npm run](https://docs.npmjs.com/cli/run-script.html):
62+
You will need to upload source maps to Bugsnag in order to deobfuscate JavaScript stack traces. Example scripts for achieving this on Android/iOS in both debug and release builds can be found [here](scripts). The example scripts use [bugsnag-sourcemaps](https://github.com/bugsnag/bugsnag-sourcemaps), which is installed as a dev dependency of the project. The scripts can also be invoked in this example project using [npm run](https://docs.npmjs.com/cli/run-script.html):
6363

6464
```bash
6565
npm run upload-sourcemaps:debug:android

examples/plain/scripts/upload-debug-android.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
API_KEY=YOUR-API-KEY-HERE # set your own API key here
5-
APP_VERSION=1 # set your own app version here (using the Android versionCode)
4+
if [ -z "$API_KEY" ]; then
5+
export API_KEY=YOUR-API-KEY-HERE # set your own API key here, or as an environment variable
6+
fi
7+
8+
if [ -z "$APP_VERSION" ]; then
9+
export APP_VERSION=1 # set your own app version here (using the Android versionCode)
10+
fi
611

712
# Download debug source maps from Metro bundler
813
curl "http://localhost:8081/index.bundle?platform=android&dev=true&minify=false" > android-debug.bundle

examples/plain/scripts/upload-debug-ios.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
API_KEY=YOUR-API-KEY-HERE # set your own API key here
5-
APP_VERSION=1 # set your own app version here (using the iOS build number)
4+
if [ -z "$API_KEY" ]; then
5+
export API_KEY=YOUR-API-KEY-HERE # set your own API key here, or as an environment variable
6+
fi
7+
8+
if [ -z "$APP_VERSION" ]; then
9+
export APP_VERSION=1 # set your own app version here (using the iOS build number)
10+
fi
611

712
# Download debug source maps from Metro bundler
813
curl "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false" > ios-debug.bundle

examples/plain/scripts/upload-release-android.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
API_KEY=YOUR-API-KEY-HERE # set your own API key here
5-
APP_VERSION=1 # set your own app version here (using the Android versionCode)
4+
if [ -z "$API_KEY" ]; then
5+
export API_KEY=YOUR-API-KEY-HERE # set your own API key here, or as an environment variable
6+
fi
7+
8+
if [ -z "$APP_VERSION" ]; then
9+
export APP_VERSION=1 # set your own app version here (using the Android versionCode)
10+
fi
611

712
# Generate source maps using react-native bundler
813
cd ..

examples/plain/scripts/upload-release-ios.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
API_KEY=YOUR-API-KEY-HERE # set your own API key here
5-
APP_VERSION=1 # set your own app version here (using the iOS build number)
4+
if [ -z "$API_KEY" ]; then
5+
export API_KEY=YOUR-API-KEY-HERE # set your own API key here, or as an environment variable
6+
fi
7+
8+
if [ -z "$APP_VERSION" ]; then
9+
export APP_VERSION=1 # set your own app version here (using the iOS build number)
10+
fi
611

712
# Generate source maps using react-native bundler
813
cd ..

0 commit comments

Comments
 (0)