Load either installed or bundled version of plugin depending on which is newer
Summary: Load either installed or bundled version of plugin depending on which is newer. Reviewed By: mweststrate Differential Revision: D21858965 fbshipit-source-id: aa46eafe0b5137134fadad827749672441f2c9e5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e31ddbc648
commit
e65b355fb6
@@ -10,15 +10,23 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import expandTilde from 'expand-tilde';
|
||||
import getPluginFolders from './getPluginFolders';
|
||||
import {
|
||||
getPluginsInstallationFolder,
|
||||
getPluginSourceFolders,
|
||||
} from './getPluginFolders';
|
||||
import {PluginDetails, getPluginDetails} from 'flipper-pkg-lib';
|
||||
import pmap from 'p-map';
|
||||
import pfilter from 'p-filter';
|
||||
|
||||
export default async function getPlugins(
|
||||
includeThirdparty: boolean = false,
|
||||
export async function getSourcePlugins(): Promise<PluginDetails[]> {
|
||||
return await getPluginsFromFolders(await getPluginSourceFolders());
|
||||
}
|
||||
export async function getInstalledPlugins(): Promise<PluginDetails[]> {
|
||||
return await getPluginsFromFolders([getPluginsInstallationFolder()]);
|
||||
}
|
||||
async function getPluginsFromFolders(
|
||||
pluginFolders: string[],
|
||||
): Promise<PluginDetails[]> {
|
||||
const pluginFolders = await getPluginFolders(includeThirdparty);
|
||||
const entryPoints: {[key: string]: PluginDetails} = {};
|
||||
const additionalPlugins = await pmap(pluginFolders, (path) =>
|
||||
entryPointForPluginFolder(path),
|
||||
|
||||
Reference in New Issue
Block a user