Simplify bundled plugin setup
Summary: Stop bundling plugins into Flipper Server bundles. In later diffs, we will start building all plugins even in dev mode which removes the need to bundle them. Reviewed By: lblasa Differential Revision: D39276249 fbshipit-source-id: 091405cfcf58aa7e1bd2b382da40f8d9841ae6b1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a67a4e5d0f
commit
a888e6affa
@@ -75,12 +75,13 @@ export abstract class AbstractPluginInitializer {
|
||||
protected async loadAllLocalVersions(
|
||||
uninstalledPluginNames: Set<string>,
|
||||
): Promise<(BundledPluginDetails | InstalledPluginDetails)[]> {
|
||||
const bundledPlugins = await getBundledPlugins();
|
||||
this.bundledPlugins = bundledPlugins;
|
||||
this.bundledPlugins = Object.values(this.defaultPluginsIndex).map(
|
||||
(defaultPluginEntry: any) => defaultPluginEntry.description,
|
||||
);
|
||||
|
||||
const allLocalVersions = [
|
||||
...bundledPlugins,
|
||||
...(await getDynamicPlugins()),
|
||||
...this.bundledPlugins,
|
||||
].filter((p) => !uninstalledPluginNames.has(p.name));
|
||||
|
||||
return allLocalVersions;
|
||||
@@ -147,24 +148,6 @@ export function getLatestCompatibleVersionOfEachPlugin<
|
||||
return Array.from(latestCompatibleVersions.values());
|
||||
}
|
||||
|
||||
export async function getBundledPlugins(): Promise<
|
||||
Array<BundledPluginDetails>
|
||||
> {
|
||||
if (getRenderHostInstance().serverConfig.env.NODE_ENV === 'test') {
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
// defaultPlugins that are included in the Flipper distributive.
|
||||
// List of default bundled plugins is written at build time to defaultPlugins/bundled.json.
|
||||
return await getRenderHostInstance().flipperServer!.exec(
|
||||
'plugins-get-bundled-plugins',
|
||||
);
|
||||
} catch (e) {
|
||||
console.error('Failed to load list of bundled plugins', e);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDynamicPlugins(): Promise<InstalledPluginDetails[]> {
|
||||
try {
|
||||
return await getRenderHostInstance().flipperServer!.exec(
|
||||
|
||||
Reference in New Issue
Block a user