Use the single type representing plugins

Summary: Use interface PluginDetails everywhere where plugins are handled and removed PluginDefinition type which was effectively a subset of PluginDetails

Reviewed By: mweststrate

Differential Revision: D21927456

fbshipit-source-id: 434ebeef955b922cc11757e78fbba8dec05f1060
This commit is contained in:
Anton Nikolaev
2020-06-08 08:47:29 -07:00
committed by Facebook GitHub Bot
parent 907cb9e3cc
commit db3f04a2d7
21 changed files with 264 additions and 167 deletions

View File

@@ -9,15 +9,24 @@
import {annotatePluginsWithUpdates} from '../PluginInstaller';
import {UpdateResult} from '../../../utils/pluginManager';
import {PluginDetails} from 'flipper-plugin-lib';
test('annotatePluginsWithUpdates', async () => {
const installedPlugins = new Map([
const installedPlugins = new Map<string, PluginDetails>([
[
'example',
{
name: 'example',
version: '0.1.0',
description: 'Gaze into the death crystal',
dir: '/plugins/example',
specVersion: 2,
source: 'src/index.ts',
isDefault: false,
main: 'lib/index.js',
title: 'Example',
id: 'Example',
entry: '/plugins/example/lib/index.js',
},
],
[
@@ -26,6 +35,14 @@ test('annotatePluginsWithUpdates', async () => {
name: 'ricksybusiness',
version: '1.0.0',
description: 'Rick Die Rickpeat',
dir: '/plugins/example',
specVersion: 2,
source: 'src/index.ts',
isDefault: false,
main: 'lib/index.js',
title: 'ricksybusiness',
id: 'ricksybusiness',
entry: '/plugins/ricksybusiness/lib/index.js',
},
],
]);
@@ -37,7 +54,15 @@ test('annotatePluginsWithUpdates', async () => {
Map {
"example" => Object {
"description": "Gaze into the death crystal",
"dir": "/plugins/example",
"entry": "/plugins/example/lib/index.js",
"id": "Example",
"isDefault": false,
"main": "lib/index.js",
"name": "example",
"source": "src/index.ts",
"specVersion": 2,
"title": "Example",
"updateStatus": Object {
"kind": "update-available",
"version": "1.1.0",
@@ -46,7 +71,15 @@ test('annotatePluginsWithUpdates', async () => {
},
"ricksybusiness" => Object {
"description": "Rick Die Rickpeat",
"dir": "/plugins/example",
"entry": "/plugins/ricksybusiness/lib/index.js",
"id": "ricksybusiness",
"isDefault": false,
"main": "lib/index.js",
"name": "ricksybusiness",
"source": "src/index.ts",
"specVersion": 2,
"title": "ricksybusiness",
"updateStatus": Object {
"kind": "up-to-date",
},