find package.json in parent directories in podspec file#259
Conversation
|
Oh, sorry, I completely missed this PR. I just copied and pasted the snippet for recursively navigating and it was not working on the non-monorepo version. Because it starts in node_modules/@op-engineering/op-sqlite, the first loop detects the if is_user_app
current_dir = File.expand_path(__dir__)
# Move one level up to the parent directory
current_dir = File.dirname(current_dir)
# Find the package.json by searching up through parent directories
loop do
package_path = File.join(current_dir, "package.json")
if File.exist?(package_path)
package_json_path = package_path
break
end
parent_dir = File.dirname(current_dir)
break if parent_dir == current_dir # reached filesystem root
current_dir = parent_dir
end
raise "package.json not found" if package_json_path.nil?
app_package = JSON.parse(File.read(package_json_path))
# When running on the example app
else
package_json_path = File.join(__dir__, "example", "package.json")
app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json")))
endDid you test setting a different configuration and seeing if it is correctly picked up? |
|
Also, this should close #264 |
|
Yeah, just tested your monorepo example and without moving one level up the configuration is not picked up. I will close this and open my own PR with the fixed version, but your solution seems to work, thanks! |
Sorry about the last one, this time this should properly fix #172
I created 2 repositories that include patches with this change to test this.
A non-monorepo project:
And a monorepo project:
prebuild will run
pod install, you should see✔ Installed CocoaPodsat the end.In the monorepo project, you can also remove the patch from the root package.json, to verify that installing pods fails without the patch.
Let me know if I missed something @ospfranco