From cc82e0e337116b1f60dc9757d1652c16bbd44f52 Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Mon, 27 Nov 2023 21:59:20 +0100 Subject: [PATCH] chore(ios): remove deprecated param in `use_native_modules` --- packages/cli-platform-ios/native_modules.rb | 24 ++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/packages/cli-platform-ios/native_modules.rb b/packages/cli-platform-ios/native_modules.rb index 82f537c9f..154a80fd7 100644 --- a/packages/cli-platform-ios/native_modules.rb +++ b/packages/cli-platform-ios/native_modules.rb @@ -12,31 +12,21 @@ require 'pathname' require 'cocoapods' -def use_native_modules!(config = nil) - if (config.is_a? String) - Pod::UI.warn("Passing custom root to use_native_modules! is deprecated.", - [ - "CLI detects root of the project automatically. The \"#{config}\" argument was ignored.", - ]); - config = nil; - end - +def use_native_modules!() # Resolving the path the RN CLI. The `@react-native-community/cli` module may not be there for certain package managers, so we fall back to resolving it through `react-native` package, that's always present in RN projects cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" cli_bin = Pod::Executable.execute_command("node", ["-e", cli_resolve_script], true).strip - if (!config) - json = [] + json = [] - IO.popen(["node", cli_bin, "config"]) do |data| - while line = data.gets - json << line - end + IO.popen(["node", cli_bin, "config"]) do |data| + while line = data.gets + json << line end - - config = JSON.parse(json.join("\n")) end + config = JSON.parse(json.join("\n")) + project_root = Pathname.new(config["project"]["ios"]["sourceDir"]) packages = config["dependencies"]