@react-native/gradle-plugin 0.84.0-nightly-20251210-3e9083b42 → 0.84.0-nightly-20251211-80e384a80
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.
package/package.json
CHANGED
|
@@ -42,6 +42,7 @@ internal fun detectedEntryFile(config: ReactExtension, envVariableOverride: Stri
|
|
|
42
42
|
*/
|
|
43
43
|
internal fun detectedCliFile(config: ReactExtension): File =
|
|
44
44
|
detectCliFile(
|
|
45
|
+
project = config.project,
|
|
45
46
|
reactNativeRoot = config.root.get().asFile,
|
|
46
47
|
preconfiguredCliFile = config.cliFile.asFile.orNull,
|
|
47
48
|
)
|
|
@@ -71,7 +72,11 @@ private fun detectEntryFile(
|
|
|
71
72
|
else -> File(reactRoot, "index.js")
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
private fun detectCliFile(
|
|
75
|
+
private fun detectCliFile(
|
|
76
|
+
project: Project,
|
|
77
|
+
reactNativeRoot: File,
|
|
78
|
+
preconfiguredCliFile: File?,
|
|
79
|
+
): File {
|
|
75
80
|
// 1. preconfigured path
|
|
76
81
|
if (preconfiguredCliFile != null) {
|
|
77
82
|
if (preconfiguredCliFile.exists()) {
|
|
@@ -81,14 +86,12 @@ private fun detectCliFile(reactNativeRoot: File, preconfiguredCliFile: File?): F
|
|
|
81
86
|
|
|
82
87
|
// 2. node module path
|
|
83
88
|
val nodeProcess =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
val nodeProcessOutput = nodeProcess.inputStream.use { it.bufferedReader().readText().trim() }
|
|
89
|
+
project.providers.exec { exec ->
|
|
90
|
+
exec.commandLine("node", "--print", "require.resolve('react-native/cli');")
|
|
91
|
+
exec.workingDir(reactNativeRoot)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
val nodeProcessOutput = nodeProcess.standardOutput.asText.get().trim()
|
|
92
95
|
|
|
93
96
|
if (nodeProcessOutput.isNotEmpty()) {
|
|
94
97
|
val nodeModuleCliJs = File(nodeProcessOutput)
|
package/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt
CHANGED
|
@@ -14,6 +14,7 @@ import com.facebook.react.tests.OsRule
|
|
|
14
14
|
import com.facebook.react.tests.WithOs
|
|
15
15
|
import java.io.File
|
|
16
16
|
import org.assertj.core.api.Assertions.assertThat
|
|
17
|
+
import org.gradle.process.ProcessExecutionException
|
|
17
18
|
import org.gradle.testfixtures.ProjectBuilder
|
|
18
19
|
import org.junit.Assume.assumeTrue
|
|
19
20
|
import org.junit.Rule
|
|
@@ -99,7 +100,7 @@ class PathUtilsTest {
|
|
|
99
100
|
assertThat(actual.readText()).isEqualTo("<!-- nothing to see here -->")
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
@Test(expected =
|
|
103
|
+
@Test(expected = ProcessExecutionException::class)
|
|
103
104
|
fun detectedCliPath_failsIfNotFound() {
|
|
104
105
|
val project = ProjectBuilder.builder().build()
|
|
105
106
|
val extension = TestReactExtension(project)
|