Skip to content

Commit 3f77d3b

Browse files
committed
Revert "Fix SDK Build when using PnPM (#4977)"
This reverts commit 4f13db0.
1 parent 4693494 commit 3f77d3b

File tree

4 files changed

+7
-72
lines changed

4 files changed

+7
-72
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
### Fixes
2828

29-
- SDK now Builds when using PnPM ([#4977](https://github.com/getsentry/sentry-react-native/pull/4977))
3029
- Skip idle span creation when app is in background ([#4995](https://github.com/getsentry/sentry-react-native/pull/4995))
3130

3231
### Dependencies

packages/core/scripts/sentry-xcode-debug-files.sh

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,7 @@ RN_PROJECT_ROOT="${PROJECT_DIR}/.."
2727
[ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
2828

2929
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
30-
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
31-
32-
if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then
33-
# Try standard resolution safely
34-
RESOLVED_PATH=$(
35-
"$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))" 2>/dev/null
36-
) || true
37-
if [ -n "$RESOLVED_PATH" ]; then
38-
SENTRY_CLI_PACKAGE_PATH="$RESOLVED_PATH"
39-
else
40-
# Fallback: parse NODE_PATH from the .bin/sentry-cli shim (file generated by PNPM)
41-
PNPM_BIN_PATH="$PWD/../node_modules/@sentry/react-native/node_modules/.bin/sentry-cli"
42-
43-
if [ -f "$PNPM_BIN_PATH" ]; then
44-
CLI_FILE_TEXT=$(cat "$PNPM_BIN_PATH")
45-
46-
# Filter where PNPM stored Sentry CLI
47-
NODE_PATH_LINE=$(echo "$CLI_FILE_TEXT" | grep -oE 'NODE_PATH="[^"]+"' | head -n1)
48-
NODE_PATH_VALUE=$(echo "$NODE_PATH_LINE" | sed -E 's/^NODE_PATH="([^"]+)".*/\1/')
49-
SENTRY_CLI_PACKAGE_PATH=${NODE_PATH_VALUE%%/bin*}
50-
fi
51-
fi
52-
fi
30+
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
5331

5432
[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
5533

packages/core/scripts/sentry-xcode.sh

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,7 @@ RN_PROJECT_ROOT="${PROJECT_DIR}/.."
1616
[ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
1717
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
1818

19-
if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then
20-
# Try standard resolution safely
21-
RESOLVED_PATH=$(
22-
"$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))" 2>/dev/null
23-
) || true
24-
if [ -n "$RESOLVED_PATH" ]; then
25-
SENTRY_CLI_PACKAGE_PATH="$RESOLVED_PATH"
26-
else
27-
# Fallback: parse NODE_PATH from the .bin/sentry-cli shim (file generated by PNPM)
28-
PNPM_BIN_PATH="$PWD/../node_modules/@sentry/react-native/node_modules/.bin/sentry-cli"
29-
30-
if [ -f "$PNPM_BIN_PATH" ]; then
31-
CLI_FILE_TEXT=$(cat "$PNPM_BIN_PATH")
32-
33-
# Filter where PNPM stored Sentry CLI
34-
NODE_PATH_LINE=$(echo "$CLI_FILE_TEXT" | grep -oE 'NODE_PATH="[^"]+"' | head -n1)
35-
NODE_PATH_VALUE=$(echo "$NODE_PATH_LINE" | sed -E 's/^NODE_PATH="([^"]+)".*/\1/')
36-
SENTRY_CLI_PACKAGE_PATH=${NODE_PATH_VALUE%%/bin*}
37-
fi
38-
fi
39-
fi
19+
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
4020
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
4121

4222
REACT_NATIVE_XCODE=$1

packages/core/sentry.gradle

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ project.afterEvaluate {
167167
project.logger.info("file not found '$propertiesFile' for '$variant'")
168168
}
169169

170-
def cliPackage = resolveSentryCliPackagePath(reactRoot)
170+
def resolvedCliPackage = null
171+
try {
172+
resolvedCliPackage = new File(["node", "--print", "require.resolve('@sentry/cli/package.json')"].execute(null, rootDir).text.trim()).getParentFile();
173+
} catch (Throwable ignored) {}
174+
def cliPackage = resolvedCliPackage != null && resolvedCliPackage.exists() ? resolvedCliPackage.getAbsolutePath() : "$reactRoot/node_modules/@sentry/cli"
171175
def cliExecutable = sentryProps.get("cli.executable", "$cliPackage/bin/sentry-cli")
172176

173177
// fix path separator for Windows
@@ -302,32 +306,6 @@ def resolveSentryReactNativeSDKPath(reactRoot) {
302306
return sentryPackage
303307
}
304308

305-
def resolveSentryCliPackagePath(reactRoot) {
306-
def resolvedCliPath = null
307-
try {
308-
def file = new File(["node", "--print", "require.resolve('@sentry/cli/package.json')"].execute(null, rootDir))
309-
resolvedCliPath = file.text.trim().getParentFile();
310-
} catch (Throwable ignored) { // Check if it's located in .pnpm
311-
try {
312-
def pnpmRefPath = reactRoot.toString() + "/node_modules/@sentry/react-native/node_modules/.bin/sentry-cli"
313-
def sentryCliFile = new File(pnpmRefPath)
314-
315-
if (sentryCliFile.exists()) {
316-
def cliFileText = sentryCliFile.text
317-
def matcher = cliFileText =~ /NODE_PATH="([^"]*?)@sentry\/cli\//
318-
319-
if (matcher.find()) {
320-
def match = matcher.group(1)
321-
resolvedCliPath = new File(match + "@sentry/cli")
322-
}
323-
}
324-
} catch (Throwable ignored2) {} // if the resolve fails we fallback to the default path
325-
}
326-
327-
def cliPackage = resolvedCliPath != null && resolvedCliPath.exists() ? resolvedCliPath.getAbsolutePath() : "$reactRoot/node_modules/@sentry/cli"
328-
return cliPackage
329-
}
330-
331309
/** Compose lookup map of build variants - to - outputs. */
332310
def extractReleasesInfo() {
333311
def releases = [:]

0 commit comments

Comments
 (0)