Fix flipper-pkg

Summary: flipper-pkg is broken because of metro package name change. This change should fix it.

Reviewed By: priteshrnandgaonkar

Differential Revision: D24591217

fbshipit-source-id: 2036c43bc0c2bb052e56740a03dc248e7daa8cfc
This commit is contained in:
Anton Nikolaev
2020-10-28 06:26:45 -07:00
committed by Facebook GitHub Bot
parent e5181a31c6
commit 39e02f5852

View File

@@ -15,10 +15,11 @@ import fs from 'fs-extra';
let metroDir: string | undefined;
const metroDirPromise = getMetroDir().then((dir) => (metroDir = dir));
// We need to include metro-runtime to the watched folders list because it contains modules which are included into the final bundle.
async function getMetroDir() {
let dir = __dirname;
while (true) {
const dirToCheck = path.join(dir, 'node_modules', 'metro');
const dirToCheck = path.join(dir, 'node_modules', 'metro-runtime');
if (await fs.pathExists(dirToCheck)) return dirToCheck;
const nextDir = path.dirname(dir);
if (!nextDir || nextDir === '' || nextDir === dir) {