@flareapp/react-native-sourcemaps 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ #!/bin/sh
2
+ # Flare automatic sourcemap upload for bare React Native (iOS).
3
+ #
4
+ # Invoked from an Xcode "Upload Flare sourcemaps" build phase placed AFTER the stock
5
+ # "Bundle React Native code and images" phase, wrapped in with-environment.sh so it
6
+ # sees SOURCEMAP_FILE (and any FLARE_* exports) from .xcode.env:
7
+ #
8
+ # set -e
9
+ # WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
10
+ # FLARE_XCODE="../node_modules/@flareapp/react-native-sourcemaps/scripts/flare-xcode.sh"
11
+ # /bin/sh -c "$WITH_ENVIRONMENT $FLARE_XCODE"
12
+ #
13
+ # Never fails the build: the CLI exits 0 in --auto mode, and the upload call is
14
+ # guarded with `|| true`.
15
+
16
+ # Don't gate on the configuration NAME being "Release". Brownfield and bare apps rename
17
+ # it or add release-style configurations (Staging, Production, AppStore, ...), none of
18
+ # which equal "Release" — requiring that literal name would silently skip the upload on
19
+ # exactly the builds that ship. The real signal is whether a composed sourcemap was
20
+ # produced: only a bundled + Hermes-compiled (release-style) build emits one, and a
21
+ # Debug/Metro build emits none, so the SOURCEMAP_PATH check below skips it for free.
22
+ # We only fast-path the dev config, matched case-insensitively as a substring so
23
+ # "Debug", "debug", "StagingDebug", etc. are all caught (POSIX sh: tr + case, no
24
+ # bashisms).
25
+ CONFIGURATION_LC=$(printf '%s' "$CONFIGURATION" | tr '[:upper:]' '[:lower:]')
26
+ case "$CONFIGURATION_LC" in
27
+ *debug*)
28
+ echo "@flareapp/react-native-sourcemaps: CONFIGURATION=$CONFIGURATION, skipping (dev build)."
29
+ exit 0
30
+ ;;
31
+ esac
32
+
33
+ # Prefer the path the bundle phase wrote (SOURCEMAP_FILE from .xcode.env, the
34
+ # documented setup). The fallback is a best-effort heuristic for the stock iOS
35
+ # layout; if SOURCEMAP_FILE is unset and no map exists there, we skip below.
36
+ SOURCEMAP_PATH="$SOURCEMAP_FILE"
37
+ if [ -z "$SOURCEMAP_PATH" ]; then
38
+ SOURCEMAP_PATH="$TARGET_TEMP_DIR/main.jsbundle.map"
39
+ fi
40
+
41
+ # Xcode hides build-phase stdout (and `expo run` condenses it), so emit the outcome
42
+ # with `warning:` / `note:` prefixes — Xcode surfaces those in the build results even
43
+ # when the rest of the log is hidden.
44
+ if [ ! -f "$SOURCEMAP_PATH" ]; then
45
+ echo "warning: Flare: no sourcemap at $SOURCEMAP_PATH — skipping upload. Was the bundle built with Hermes and SOURCEMAP_FILE set in ios/.xcode.env?"
46
+ exit 0
47
+ fi
48
+
49
+ CONFIG_PATH="$SRCROOT/../flare.json"
50
+
51
+ CLI="$SRCROOT/../node_modules/.bin/flare-rn-sourcemaps"
52
+ if [ -x "$CLI" ]; then
53
+ FLARE_OUTPUT=$("$CLI" upload --sourcemap "$SOURCEMAP_PATH" --config "$CONFIG_PATH" --auto 2>&1)
54
+ else
55
+ FLARE_OUTPUT=$(npx flare-rn-sourcemaps upload --sourcemap "$SOURCEMAP_PATH" --config "$CONFIG_PATH" --auto 2>&1)
56
+ fi
57
+
58
+ # Echo the full detail (banner / success line) for anyone reading the raw log...
59
+ echo "$FLARE_OUTPUT"
60
+ # ...then a one-line Xcode-visible summary so you can tell from the build results alone.
61
+ case "$FLARE_OUTPUT" in
62
+ *"Successfully uploaded"*)
63
+ echo "note: Flare: sourcemap uploaded ($SOURCEMAP_PATH)."
64
+ ;;
65
+ *)
66
+ # Xcode/expo run hide the full banner (plain stdout above), so lift its
67
+ # "Reason:" line into a `warning:` the build results actually surface.
68
+ REASON=$(printf '%s\n' "$FLARE_OUTPUT" | sed -n 's/^[[:space:]]*Reason:[[:space:]]*//p' | head -1)
69
+ if [ -n "$REASON" ]; then
70
+ echo "warning: Flare: sourcemap NOT uploaded — $REASON"
71
+ else
72
+ echo "warning: Flare: sourcemap NOT uploaded — see the Flare banner in the log above (missing API key or FLARE_SOURCEMAP_VERSION)."
73
+ fi
74
+ ;;
75
+ esac
76
+
77
+ exit 0