Fix fb-stubs replacement for plugin bundling

Reviewed By: nikoant

Differential Revision: D39765543

fbshipit-source-id: 14cbf8a9bdf35031e636bbbde3dbc955faedb66b
This commit is contained in:
Andrey Goncharov
2022-09-23 05:50:28 -07:00
committed by Facebook GitHub Bot
parent 61a8fe09e9
commit dd7ba2d6fc
11 changed files with 71 additions and 19 deletions

View File

@@ -20,9 +20,9 @@ import {InstalledPluginDetails} from 'flipper-common';
import {getDefaultPlugins} from './getDefaultPlugins';
import {buildDefaultPlugins} from './buildDefaultPlugins';
async function rebuildPlugin(pluginPath: string) {
async function rebuildPlugin(pluginPath: string, intern: boolean) {
try {
await runBuild(pluginPath, true);
await runBuild(pluginPath, true, intern);
console.info(chalk.green('Rebuilt plugin'), pluginPath);
} catch (e) {
console.error(
@@ -36,6 +36,7 @@ async function rebuildPlugin(pluginPath: string) {
export default async function startWatchPlugins(
isInsidersBuild: boolean,
intern: boolean,
onChanged?: (
changedPlugins: InstalledPluginDetails[],
) => void | Promise<void>,
@@ -74,7 +75,7 @@ export default async function startWatchPlugins(
}
dirPath = path.resolve(dirPath, '..');
}
await rebuildPlugin(dirPath);
await rebuildPlugin(dirPath, intern);
return dirPath;
}),
);
@@ -85,7 +86,7 @@ export default async function startWatchPlugins(
} catch (e) {
if (e instanceof Error && e.message === 'REBUILD_ALL') {
const defaultPlugins = await getDefaultPlugins(isInsidersBuild);
await buildDefaultPlugins(defaultPlugins, true);
await buildDefaultPlugins(defaultPlugins, true, intern);
onChanged?.(defaultPlugins);
return;
}