fix: Resolve node_modules/ better (#706)

* fix: Use `rootDir` instead of `projectDir`

* Revert "fix: Use `rootDir` instead of `projectDir`"

This reverts commit 058e0a110bcf9b688e12a1cccbac2f23a29fa55c.

* fix: Find node_modules path where react-native/ lives

* fix: Figure out VisionCameraExample project

* Revert "fix: Figure out VisionCameraExample project"

This reverts commit 7ca455098244dd62280d40586062803d1ccc2c5f.
This commit is contained in:
Marc Rousavy 2022-01-03 13:18:38 +01:00 committed by GitHub
parent 1c09ded57e
commit 675dec5ab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,9 +7,10 @@ static def findNodeModules(baseDir) {
// Node's module resolution algorithm searches up to the root directory,
// after which the base path will be null
while (basePath) {
def candidatePath = Paths.get(basePath.toString(), "node_modules")
if (candidatePath.toFile().exists()) {
return candidatePath.toString()
def nodeModulesPath = Paths.get(basePath.toString(), "node_modules")
def reactNativePath = Paths.get(nodeModulesPath.toString(), "react-native")
if (nodeModulesPath.toFile().exists() && reactNativePath.toFile().exists()) {
return nodeModulesPath.toString()
}
basePath = basePath.getParent()
}