@@ -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. */
332310def extractReleasesInfo () {
333311 def releases = [:]
0 commit comments