Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/content/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cli/
│ │ ├── org/ # list, view
│ │ ├── proguard/ # upload, uuid
│ │ ├── project/ # create, delete, list, view
│ │ ├── react-native/# gradle
│ │ ├── react-native/# gradle, xcode
│ │ ├── release/ # archive, create, delete, deploy, deploys, finalize, list, propose-version, restore, set-commits, view
│ │ ├── replay/ # list, view
│ │ ├── repo/ # list
Expand Down
24 changes: 24 additions & 0 deletions docs/src/fragments/commands/react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,32 @@ sentry react-native gradle \
--sourcemap index.android.bundle.map \
--release com.example.app@1.0.0 \
--dist 1000

# Xcode build phase (usually added automatically to your build script)
../node_modules/.bin/sentry-cli react-native xcode
```

## Xcode build step (`react-native xcode`)

`react-native xcode` runs inside an Xcode "Bundle React Native code and images"
build phase. It has three modes:

- **release build** — wraps the RN build script (standing in for
`NODE_BINARY`/`HERMES_CLI_PATH`) to capture the produced bundle + sourcemap
(including the Hermes combined sourcemap), then uploads them.
- **simulator build with `--allow-fetch`** — downloads the bundle + sourcemap
from the running packager, then uploads.
- **debug build** — just runs the build script.

Release/distribution come from `SENTRY_RELEASE`/`SENTRY_DIST` or the app's
`Info.plist` (`<CFBundleIdentifier>@<CFBundleShortVersionString>+<CFBundleVersion>`),
unless `--no-auto-release` is set. Pass extra build-script arguments after the
flags.

Limitations vs. the legacy CLI: `Info.plist` C preprocessing
(`INFOPLIST_PREPROCESS`) and `xcodebuild`-based discovery outside an Xcode build
are not supported — set `SENTRY_RELEASE`/`SENTRY_DIST` in those cases.

## Important Notes

- `react-native gradle` is normally invoked automatically by the
Expand Down
1 change: 1 addition & 0 deletions plugins/sentry-cli/skills/sentry-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ Work with ProGuard/R8 mapping files
Upload React Native sourcemaps from build steps

- `sentry react-native gradle` — Upload a React Native bundle + sourcemap (Gradle build step)
- `sentry react-native xcode <script-arg...>` — Upload React Native sourcemaps (Xcode build step)

→ Full flags and examples: `references/react-native.md`

Expand Down
17 changes: 17 additions & 0 deletions plugins/sentry-cli/skills/sentry-cli/references/react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ Upload a React Native bundle + sourcemap (Gradle build step)
- `--wait - Accepted for compatibility (the CLI always waits for assembly)`
- `--wait-for <value> - Accepted for compatibility (the CLI always waits for assembly)`

### `sentry react-native xcode <script-arg...>`

Upload React Native sourcemaps (Xcode build step)

**Flags:**
- `-f, --force - Run even in a debug configuration`
- `--allow-fetch - Fetch sourcemaps from the packager on simulator builds`
- `--fetch-from <value> - Packager URL to fetch from (default: http://127.0.0.1:8081/)`
- `--build-script <value> - Path to the react-native-xcode.sh build script`
- `--dist <value>... - Distribution(s) to publish (repeatable)`
- `--wait - Accepted for compatibility (the CLI always waits for assembly)`
- `--wait-for <value> - Accepted for compatibility (the CLI always waits for assembly)`
- `--no-auto-release - Don't read the release from Xcode project files`

**Examples:**

```bash
Expand All @@ -37,6 +51,9 @@ sentry react-native gradle \
--sourcemap index.android.bundle.map \
--release com.example.app@1.0.0 \
--dist 1000

# Xcode build phase (usually added automatically to your build script)
../node_modules/.bin/sentry-cli react-native xcode
```

All commands also support `--json`, `--fields`, `--help`, `--log-level`, and `--verbose` flags.
9 changes: 9 additions & 0 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ process.emit = ((event: string, ...args: unknown[]) => {
}) as typeof process.emit;

import { startCli } from "./cli.js";
import { wrapCall } from "./lib/react-native/wrap-call.js";

// React Native Xcode build wrapper: when the RN build script invokes us in
// place of NODE_BINARY/HERMES_CLI_PATH (see `react-native xcode`), forward to
// the real Node/Hermes tool instead of running the CLI. Must run before any
// command parsing.
if (process.env.__SENTRY_RN_WRAP_XCODE_CALL === "1") {
process.exit(wrapCall());
}

// Handle non-recoverable stream I/O errors gracefully instead of crashing.
// - EPIPE (errno -32): downstream pipe consumer closed (e.g., `sentry issue list | head`).
Expand Down
2 changes: 2 additions & 0 deletions src/commands/react-native/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

import { buildRouteMap } from "../../lib/route-map.js";
import { gradleCommand } from "./gradle.js";
import { xcodeCommand } from "./xcode.js";

export const reactNativeRoute = buildRouteMap({
routes: {
gradle: gradleCommand,
xcode: xcodeCommand,
},
docs: {
brief: "Upload React Native sourcemaps from build steps",
Expand Down
Loading
Loading