Skip to content

Commit

Permalink
fix: don't use yarn for spawning 'config' command (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee authored Jun 30, 2019
1 parent de936f6 commit 023360b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
12 changes: 2 additions & 10 deletions packages/platform-android/native_modules.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class ReactNativeModules {
private ArrayList<HashMap<String, String>> reactNativeModules

private static String LOG_PREFIX = ":ReactNative:"
private static String REACT_NATIVE_CONFIG_CMD = "yarn run --silent react-native config"
private static String REACT_NATIVE_CONFIG_CMD_FALLBACK = "node ./node_modules/.bin/react-native config"

ReactNativeModules(Logger logger) {
this.logger = logger
Expand Down Expand Up @@ -175,20 +173,14 @@ class ReactNativeModules {

def cmdProcess
def root = getReactNativeProjectRoot()
def command = REACT_NATIVE_CONFIG_CMD_FALLBACK
def command = "node ./node_modules/.bin/react-native config"

try {
try {
// Check if project uses Yarn
def isYarnProject = Runtime.getRuntime().exec("node -e console.log(require.resolve('./yarn.lock'))", null, root)
isYarnProject.waitFor()
command = REACT_NATIVE_CONFIG_CMD
} catch(Exception exception) {}
cmdProcess = Runtime.getRuntime().exec(command, null, root)
cmdProcess.waitFor()
} catch (Exception exception) {
this.logger.warn("${LOG_PREFIX}${exception.message}")
this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed. (UNKNOWN)")
this.logger.warn("${LOG_PREFIX}Automatic import of native modules failed.")
return reactNativeModules
}

Expand Down
8 changes: 0 additions & 8 deletions packages/platform-ios/native_modules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ def use_native_modules!(root = "..", packages = nil)
if (!packages)
command = "node"
args = ["./node_modules/.bin/react-native", "config"]
begin
# Check if project uses Yarn
Pod::Executable.execute_command("node", ["-e", "console.log(require.resolve('#{root}/yarn.lock'))"], true)
command = "yarn"
args = ["run", "--silent", "react-native", "config"]
rescue
end

output = ""
# Make sure `react-native config` is ran from your project root
Dir.chdir(root) do
Expand Down

0 comments on commit 023360b

Please sign in to comment.