From c8047bfe66e6b3b62c045568260fbde894e40788 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 10 Dec 2018 08:21:15 -0800 Subject: [PATCH] Fix flow types Summary: This diff ignores the `react-native-local-cli` from being used internally. Unfortunately, since `react-native-local-cli` has its own dependency on Metro, and using `yarn` selective resolutions causes some issues with `flow` rechecks that have not been resolved (https://fb.facebook.com/groups/flow/permalink/2220467474668522/), the easiest way to move forward is to just not install the `react-native-local-cli` package internally (we don't need it since we have our own cli). Reviewed By: pvdz Differential Revision: D13377495 fbshipit-source-id: 6d6edbd947104e050ad1c31a657fc21fe6848692 --- jest/hasteImpl.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/jest/hasteImpl.js b/jest/hasteImpl.js index fda5a20dd..3bf3caf66 100644 --- a/jest/hasteImpl.js +++ b/jest/hasteImpl.js @@ -11,7 +11,6 @@ 'use strict'; const path = require('path'); -const findPlugins = require('react-native-local-cli/core/findPlugins'); const REACT_NATIVE_CI = process.cwd() === path.resolve(__dirname, '..'); @@ -23,7 +22,22 @@ if (REACT_NATIVE_CI) { pluginsPath = '../../../'; } -const plugins = findPlugins([path.resolve(__dirname, pluginsPath)]); +function getPlugins() { + try { + const findPlugins = require('react-native-local-cli/core/findPlugins'); + + return findPlugins([path.resolve(__dirname, pluginsPath)]); + } catch (_) { + return { + haste: { + providesModuleNodeModules: [], + platforms: [], + }, + }; + } +} + +const plugins = getPlugins(); // Detect out-of-tree platforms and add them to the whitelists const pluginRoots /*: Array<