From 61a889a3854da163ca436cc5807342cb64dc46f9 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Tue, 14 Apr 2020 07:10:38 -0700 Subject: [PATCH] Treat only packages with "flipper-plugin" keyword as Flipper plugins Summary: Treat only packages with "flipper-plugin" keyword as Flipper plugins. This will allow to place lib packages re-used by different plugins into "plugins" folder. Changelog: Internals: it is now possible to add modules for re-use by different plugins into `desktop/plugins` folder. Reviewed By: mweststrate Differential Revision: D20898133 fbshipit-source-id: 8934870350ce42af3dc8060d1494025519ed307e --- desktop/plugins/kaios-allocations/package.json | 3 +++ desktop/plugins/kaios-ram/package.json | 3 +++ desktop/static/compilePlugins.ts | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/desktop/plugins/kaios-allocations/package.json b/desktop/plugins/kaios-allocations/package.json index 374ec22d7..f55daad32 100644 --- a/desktop/plugins/kaios-allocations/package.json +++ b/desktop/plugins/kaios-allocations/package.json @@ -5,6 +5,9 @@ "license": "MIT", "title": "KaiOS: big allocations", "icon": "apps", + "keywords": [ + "flipper-plugin" + ], "bugs": { "email": "oncall+wa_kaios@xmail.facebook.com", "url": "https://fb.workplace.com/groups/wa.kaios/" diff --git a/desktop/plugins/kaios-ram/package.json b/desktop/plugins/kaios-ram/package.json index 22d4f2054..66c321c41 100644 --- a/desktop/plugins/kaios-ram/package.json +++ b/desktop/plugins/kaios-ram/package.json @@ -5,6 +5,9 @@ "license": "MIT", "title": "KaiOS RAM graph", "icon": "apps", + "keywords": [ + "flipper-plugin" + ], "bugs": { "email": "oncall+wa_kaios@xmail.facebook.com", "url": "https://fb.workplace.com/groups/wa.kaios/" diff --git a/desktop/static/compilePlugins.ts b/desktop/static/compilePlugins.ts index a55ad9b25..2c65aca38 100644 --- a/desktop/static/compilePlugins.ts +++ b/desktop/static/compilePlugins.ts @@ -210,7 +210,10 @@ function entryPointForPluginFolder(pluginPath: string) { if (packageJSON) { try { const json = JSON.parse(packageJSON); - if (json.workspaces) { + if (!json.keywords || !json.keywords.includes('flipper-plugin')) { + console.log( + `Skipping package "${json.name}", because its "keywords" field does not contain tag "flipper-plugin"`, + ); return null; } const pkg = json as PluginManifest;