react-native-update 10.37.13 → 10.37.15

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.
@@ -22,6 +22,41 @@ def supportsNamespace() {
22
22
  return major >= 8
23
23
  }
24
24
 
25
+ def parseMajorVersion(String versionString) {
26
+ if (!versionString) {
27
+ return null
28
+ }
29
+
30
+ def matcher = (versionString =~ /(\d+)/)
31
+ if (matcher.find()) {
32
+ return matcher[0][0].toInteger()
33
+ }
34
+
35
+ return null
36
+ }
37
+
38
+ def resolveInstalledExpoMajorVersion(File projectDir) {
39
+ try {
40
+ def stdout = new ByteArrayOutputStream()
41
+ def stderr = new ByteArrayOutputStream()
42
+ def result = project.exec {
43
+ workingDir projectDir
44
+ commandLine 'node', '--print', "require('expo/package.json').version"
45
+ standardOutput = stdout
46
+ errorOutput = stderr
47
+ ignoreExitValue true
48
+ }
49
+
50
+ if (result.exitValue != 0) {
51
+ return null
52
+ }
53
+
54
+ return parseMajorVersion(stdout.toString().trim())
55
+ } catch (Exception ignored) {
56
+ return null
57
+ }
58
+ }
59
+
25
60
  def checkProjectInfo() {
26
61
  def hasExpoModulesCore = rootProject.subprojects.any { it.name == 'expo-modules-core' }
27
62
  def packageJsonFile = new File(rootProject.projectDir.parentFile, 'package.json')
@@ -33,24 +68,19 @@ def checkProjectInfo() {
33
68
  def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
34
69
  projectVersion = packageJson.version ?: '1.0.0' // Get project version
35
70
 
36
- // Check for expo dependency and version >= 50
71
+ // Check for expo dependency and version >= 50.
72
+ // For pnpm catalogs (e.g. "catalog:native"), the version string in package.json
73
+ // is not numeric, so we resolve the installed expo package version as fallback.
37
74
  String expoVersionString = packageJson.dependencies?.expo ?: packageJson.devDependencies?.expo
38
- boolean expoVersionIsHighEnough = false
39
- if (expoVersionString) {
40
- try {
41
- // Extract the first number sequence as the major version
42
- def matcher = (expoVersionString =~ /(\d+)/)
43
- if (matcher.find()) {
44
- int majorVersion = matcher[0][0].toInteger()
45
- if (majorVersion >= 50) {
46
- expoVersionIsHighEnough = true
47
- }
48
- }
49
- } catch (NumberFormatException e) {
50
- // Handle error if version parsing fails, maybe log a warning
51
- println "Warning: Could not parse Expo version string: ${expoVersionString}"
52
- }
53
- }
75
+ Integer declaredExpoMajorVersion = parseMajorVersion(expoVersionString)
76
+ Integer installedExpoMajorVersion = expoVersionString ?
77
+ resolveInstalledExpoMajorVersion(packageJsonFile.parentFile) :
78
+ null
79
+ Integer expoMajorVersion = installedExpoMajorVersion ?: declaredExpoMajorVersion
80
+
81
+ boolean expoVersionIsHighEnough =
82
+ expoMajorVersion != null && expoMajorVersion >= 50
83
+
54
84
  hasExpoDependency = expoVersionIsHighEnough // Update based on version check
55
85
  }
56
86