-
Notifications
You must be signed in to change notification settings - Fork 599
/
build-types.ts
53 lines (45 loc) · 1.59 KB
/
build-types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { PluginBuildMetadata, PluginManifest } from '@openshift/dynamic-plugin-sdk-webpack';
/**
* Additional plugin metadata supported by the Console application.
*/
export type ConsoleSupportedCustomProperties = Partial<{
/** User-friendly plugin name. */
displayName: string;
/** User-friendly plugin description. */
description: string;
/** Disable the given static plugins when this plugin gets loaded. */
disableStaticPlugins: string[];
}>;
/**
* Build-time Console dynamic plugin metadata.
*/
export type ConsolePluginBuildMetadata = PluginBuildMetadata & ConsoleSupportedCustomProperties;
/**
* Standard Console dynamic plugin manifest format.
*/
export type StandardConsolePluginManifest = {
customProperties?: {
console?: ConsoleSupportedCustomProperties;
[customNamespace: string]: unknown;
};
} & PluginManifest;
/**
* Legacy Console dynamic plugin manifest format.
*/
export type LegacyConsolePluginManifest = Pick<
PluginManifest,
'name' | 'version' | 'dependencies' | 'extensions'
> &
ConsoleSupportedCustomProperties;
/**
* This type supports both standard and legacy Console dynamic plugin manifest formats.
*
* Console application automatically adapts the manifest to standard format when loading
* the given plugin.
*/
export type AnyConsolePluginManifest = StandardConsolePluginManifest | LegacyConsolePluginManifest;
export const isStandardPluginManifest = (
m: AnyConsolePluginManifest,
): m is StandardConsolePluginManifest =>
// Standard plugin manifests must have a string valued baseURL property
m['baseURL'] && typeof m['baseURL'] === 'string';