Cleanup plugin watch folders

Summary:
Watch folders weren't updated for cross plugin/flipper boundaries that have recently been removed

Fix changes in several source folders not being picked up when fast refresh wasn't enabled

Reviewed By: passy, aigoncharov

Differential Revision: D32626139

fbshipit-source-id: 2c830ec8154ff859ce1e3ee101e5963162d2e0a2
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent e742322eb1
commit 2b81be6c29
2 changed files with 13 additions and 16 deletions

View File

@@ -9,25 +9,12 @@
import fs from 'fs-extra';
import pFilter from 'p-filter';
import path from 'path';
import {getWatchFolders} from 'flipper-pkg-lib';
import {appDir, publicPluginsDir, fbPluginsDir} from './paths';
/**
* Flipper references code from below plugins directly. Such directly referenced plugins
* and their dependencies should be added as watch folders so Metro bundled can resolve them.
*/
const pluginsReferencedDirectlyFromFlipper = [
path.join(publicPluginsDir, 'navigation'),
path.join(fbPluginsDir, 'mobileconfig'),
path.join(fbPluginsDir, 'watch'),
];
import {appDir} from './paths';
export default async function getAppWatchFolders() {
const getWatchFoldersResults = await Promise.all(
[appDir, ...pluginsReferencedDirectlyFromFlipper].map((dir) =>
getWatchFolders(dir),
),
[appDir].map((dir) => getWatchFolders(dir)),
);
const watchFolders = ([] as string[]).concat(...getWatchFoldersResults);
return pFilter(