Files
flipper/desktop/flipper-ui-core/src/utils/testUtils.tsx
Andrey Goncharov 650ff4bcfb Remove plugin bundling
Summary: Remove the notion of bundled plugins

Reviewed By: lblasa

Differential Revision: D39308888

fbshipit-source-id: aa88ddbf2801ad1da95f89e4c761259b697b0d66
2022-09-15 10:02:19 -07:00

83 lines
2.1 KiB
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {
ActivatablePluginDetails,
DownloadablePluginDetails,
} from 'flipper-common';
export function createMockDownloadablePluginDetails(
params: {
id?: string;
name?: string;
version?: string;
title?: string;
flipperEngineVersion?: string;
downloadUrl?: string;
gatekeeper?: string;
lastUpdated?: Date;
} = {},
): DownloadablePluginDetails {
const {id, version, title, flipperEngineVersion, gatekeeper, lastUpdated} = {
id: 'test',
version: '3.0.1',
flipperEngineVersion: '0.46.0',
lastUpdated: new Date(1591226525 * 1000),
...params,
};
const lowercasedID = id.toLowerCase();
const name = params.name || `flipper-plugin-${lowercasedID}`;
const details: DownloadablePluginDetails = {
name: name || `flipper-plugin-${lowercasedID}`,
id: id,
bugs: {
email: 'bugs@localhost',
url: 'bugs.localhost',
},
category: 'tools',
description: 'Description of Test Plugin',
flipperSDKVersion: flipperEngineVersion,
engines: {
flipper: flipperEngineVersion,
},
gatekeeper: gatekeeper ?? `GK_${lowercasedID}`,
icon: 'internet',
main: 'dist/bundle.js',
source: 'src/index.tsx',
specVersion: 2,
pluginType: 'client',
title: title ?? id,
version: version,
downloadUrl: `http://localhost/${lowercasedID}/${version}`,
lastUpdated: lastUpdated,
isActivatable: false,
isEnabledByDefault: false,
};
return details;
}
export function createMockActivatablePluginDetails(
base: Partial<ActivatablePluginDetails>,
): ActivatablePluginDetails {
return {
id: 'Hello',
specVersion: 2,
isActivatable: true,
dir: '/Users/mock/.flipper/thirdparty/flipper-plugin-sample1',
entry: './test/index.js',
name: 'flipper-plugin-hello',
version: '0.1.0',
pluginType: 'client',
source: 'src/index.js',
main: 'dist/bundle.js',
title: 'Hello',
...base,
};
}