Show plugin documentation in Flipper
Reviewed By: passy Differential Revision: D29392524 fbshipit-source-id: 675de1fc070b1b8b22d0b27721c16dbd6f7076ef
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e4fb2907fd
commit
9fc85730ba
@@ -63,6 +63,20 @@ export async function getInstalledPluginDetails(
|
||||
): Promise<InstalledPluginDetails> {
|
||||
packageJson = packageJson ?? (await readPluginPackageJson(dir));
|
||||
const pluginDetails = getPluginDetails(packageJson);
|
||||
const [hasOverviewDocs, hasSetupDocs] = await Promise.all([
|
||||
pluginDetails.publishedDocs?.overview === undefined
|
||||
? fs.pathExists(path.join(dir, 'docs', 'overview.mdx'))
|
||||
: Promise.resolve(pluginDetails.publishedDocs.overview),
|
||||
pluginDetails.publishedDocs?.setup === undefined
|
||||
? fs.pathExists(path.join(dir, 'docs', 'setup.mdx'))
|
||||
: Promise.resolve(pluginDetails.publishedDocs.setup),
|
||||
]);
|
||||
if (hasOverviewDocs || hasSetupDocs) {
|
||||
pluginDetails.publishedDocs = {
|
||||
overview: hasOverviewDocs,
|
||||
setup: hasSetupDocs,
|
||||
};
|
||||
}
|
||||
const entry =
|
||||
pluginDetails.specVersion === 1
|
||||
? path.resolve(
|
||||
@@ -136,6 +150,7 @@ function getPluginDetailsV2(packageJson: any): PluginDetails {
|
||||
pluginType: packageJson?.pluginType,
|
||||
supportedDevices: packageJson?.supportedDevices,
|
||||
engines: packageJson.engines,
|
||||
publishedDocs: packageJson.publishedDocs,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user