From 50111ef24be9c1dd30e2276c6e847a7214825500 Mon Sep 17 00:00:00 2001 From: Andrey Goncharov Date: Tue, 10 May 2022 05:13:24 -0700 Subject: [PATCH] Add headless plugin definition Summary: Support explicitly marking headless plugins as "headless" Reviewed By: passy Differential Revision: D35891387 fbshipit-source-id: 50b5acb3a7c52d7aedf32e271ebe6fc6d4fcef73 --- desktop/flipper-common/src/PluginDetails.tsx | 2 ++ desktop/pkg/schemas/plugin-package-v2.json | 4 ++++ desktop/plugin-lib/src/__tests__/getPluginDetails.node.tsx | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/desktop/flipper-common/src/PluginDetails.tsx b/desktop/flipper-common/src/PluginDetails.tsx index dd009a706..bf80a3dc0 100644 --- a/desktop/flipper-common/src/PluginDetails.tsx +++ b/desktop/flipper-common/src/PluginDetails.tsx @@ -30,6 +30,7 @@ export interface PluginDetails { }; flipperSDKVersion?: string; pluginType?: PluginType; + headless?: boolean; supportedDevices?: SupportedDevice[]; supportedApps?: SupportedApp[]; publishedDocs?: { @@ -179,6 +180,7 @@ function getPluginDetailsV2(packageJson: any): PluginDetails { supportedApps: packageJson?.supportedApps, engines: packageJson.engines, publishedDocs: packageJson.publishedDocs, + headless: packageJson.headless, }; } diff --git a/desktop/pkg/schemas/plugin-package-v2.json b/desktop/pkg/schemas/plugin-package-v2.json index c1cee1b86..f8c89657d 100644 --- a/desktop/pkg/schemas/plugin-package-v2.json +++ b/desktop/pkg/schemas/plugin-package-v2.json @@ -109,6 +109,10 @@ } } } + }, + "headless": { + "type": "boolean", + "description": "Specifies if plugin works in a headless mode. Default: false." } }, "required": [ diff --git a/desktop/plugin-lib/src/__tests__/getPluginDetails.node.tsx b/desktop/plugin-lib/src/__tests__/getPluginDetails.node.tsx index caf7c6850..094d9e764 100644 --- a/desktop/plugin-lib/src/__tests__/getPluginDetails.node.tsx +++ b/desktop/plugin-lib/src/__tests__/getPluginDetails.node.tsx @@ -89,6 +89,7 @@ test('getPluginDetailsV2', async () => { "entry": "/Users/mock/.flipper/thirdparty/flipper-plugin-test/dist/bundle.js", "flipperSDKVersion": undefined, "gatekeeper": "GK_flipper_plugin_test", + "headless": undefined, "icon": undefined, "id": "flipper-plugin-test", "isActivatable": true, @@ -135,6 +136,7 @@ test('id used as title if the latter omited', async () => { "entry": "/Users/mock/.flipper/thirdparty/flipper-plugin-test/dist/bundle.js", "flipperSDKVersion": undefined, "gatekeeper": "GK_flipper_plugin_test", + "headless": undefined, "icon": undefined, "id": "test", "isActivatable": true, @@ -180,6 +182,7 @@ test('name without "flipper-plugin-" prefix is used as title if the latter omite "entry": "/Users/mock/.flipper/thirdparty/flipper-plugin-test/dist/bundle.js", "flipperSDKVersion": undefined, "gatekeeper": "GK_flipper_plugin_test", + "headless": undefined, "icon": undefined, "id": "flipper-plugin-test", "isActivatable": true, @@ -228,6 +231,7 @@ test('flipper-plugin-version is parsed', async () => { "entry": "/Users/mock/.flipper/thirdparty/flipper-plugin-test/dist/bundle.js", "flipperSDKVersion": "^0.45", "gatekeeper": "GK_flipper_plugin_test", + "headless": undefined, "icon": undefined, "id": "flipper-plugin-test", "isActivatable": true, @@ -280,6 +284,7 @@ test('plugin type and supported devices parsed', async () => { "entry": "/Users/mock/.flipper/thirdparty/flipper-plugin-test/dist/bundle.js", "flipperSDKVersion": undefined, "gatekeeper": "GK_flipper_plugin_test", + "headless": undefined, "icon": undefined, "id": "flipper-plugin-test", "isActivatable": true, @@ -348,6 +353,7 @@ test('plugin type and supported apps parsed', async () => { "entry": "/Users/mock/.flipper/thirdparty/flipper-plugin-test/dist/bundle.js", "flipperSDKVersion": undefined, "gatekeeper": "GK_flipper_plugin_test", + "headless": undefined, "icon": undefined, "id": "flipper-plugin-test", "isActivatable": true, @@ -436,6 +442,7 @@ test('can merge two package.json files', async () => { "entry": "/Users/mock/.flipper/thirdparty/flipper-plugin-test/dist/bundle.js", "flipperSDKVersion": undefined, "gatekeeper": "GK_flipper_plugin_test", + "headless": undefined, "icon": undefined, "id": "flipper-plugin-test", "isActivatable": true,