read infos from package.json

Summary:
Adding the properties from a plugin's `package.json` as static properties to the class.
The name from `package.json` is used as it's `id`.

This allows us in the future to add meta information about a plugin to it's package.json and still use the data inside the app.

Reviewed By: priteshrnandgaonkar

Differential Revision: D13417288

fbshipit-source-id: 3d0a62d4cb0115153cce1aaee677b9680fefebf4
This commit is contained in:
Daniel Büchele
2018-12-18 08:27:25 -08:00
committed by Facebook Github Bot
parent e23da69db9
commit 6ffc027051
9 changed files with 54 additions and 47 deletions

View File

@@ -9,9 +9,6 @@ import {createTablePlugin} from '../createTablePlugin.js';
import {FlipperPlugin} from '../plugin.js';
const PROPS = {
title: 'Plugin Title',
id: 'pluginID',
icon: 'icon',
method: 'method',
resetMethod: 'resetMethod',
columns: {},
@@ -25,24 +22,6 @@ test('createTablePlugin returns FlipperPlugin', () => {
expect(tablePlugin.prototype).toBeInstanceOf(FlipperPlugin);
});
test('Plugin ID is set', () => {
const id = 'pluginID';
const tablePlugin = createTablePlugin({...PROPS, id});
expect(tablePlugin.id).toBe(id);
});
test('Plugin title is set', () => {
const title = 'My Plugin Title';
const tablePlugin = createTablePlugin({...PROPS, title});
expect(tablePlugin.title).toBe(title);
});
test('Plugin icon is set', () => {
const icon = 'icon';
const tablePlugin = createTablePlugin({...PROPS, icon});
expect(tablePlugin.icon).toBe(icon);
});
test('persistedStateReducer is resetting data', () => {
const resetMethod = 'resetMethod';
const tablePlugin = createTablePlugin({...PROPS, resetMethod});