@mhoshi-vm/plugin-crossplane-aws 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/esm/Router-7e4981b2.esm.js +140 -0
- package/dist/esm/Router-7e4981b2.esm.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.esm.js +38 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +60 -0
- package/src/index.ts +2 -0
package/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# crossplane-ecs
|
2
|
+
|
3
|
+
Welcome to the crossplane-ecs plugin!
|
4
|
+
|
5
|
+
_This plugin was created through the Backstage CLI_
|
6
|
+
|
7
|
+
## Getting started
|
8
|
+
|
9
|
+
Your plugin has been added to the example app in this repository, meaning you'll be able to access it by
|
10
|
+
running `yarn start` in the root directory, and then navigating
|
11
|
+
to [/crossplane-ecs](http://localhost:3000/crossplane-ecs).
|
12
|
+
|
13
|
+
You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
|
14
|
+
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
|
15
|
+
It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory.
|
@@ -0,0 +1,140 @@
|
|
1
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
2
|
+
import React, { useState, useEffect } from 'react';
|
3
|
+
import { Routes, Route } from 'react-router-dom';
|
4
|
+
import { useKubernetesObjects } from '@backstage/plugin-kubernetes';
|
5
|
+
import { Table, Page, Content, Progress, ResponseErrorPanel } from '@backstage/core-components';
|
6
|
+
import { Grid } from '@material-ui/core';
|
7
|
+
|
8
|
+
const ResourceTable = (props) => {
|
9
|
+
const { app, resources } = props;
|
10
|
+
const columns = [
|
11
|
+
{ title: "Kind", field: "kind" },
|
12
|
+
{ title: "Name", field: "name" },
|
13
|
+
{ title: "Ready", field: "ready" },
|
14
|
+
{ title: "Synced", field: "synced" },
|
15
|
+
{ title: "External Name", field: "externalName" }
|
16
|
+
];
|
17
|
+
const data = [];
|
18
|
+
resources.map((resource) => {
|
19
|
+
resource.resources.map((resourceStatus) => {
|
20
|
+
data.push({
|
21
|
+
kind: resource.kind,
|
22
|
+
name: resourceStatus.name,
|
23
|
+
ready: resourceStatus.ready,
|
24
|
+
synced: resourceStatus.synced,
|
25
|
+
externalName: resourceStatus.externalName
|
26
|
+
});
|
27
|
+
});
|
28
|
+
});
|
29
|
+
return /* @__PURE__ */ React.createElement(
|
30
|
+
Table,
|
31
|
+
{
|
32
|
+
title: app,
|
33
|
+
columns,
|
34
|
+
data
|
35
|
+
}
|
36
|
+
);
|
37
|
+
};
|
38
|
+
|
39
|
+
const CrossplaneAwsComponent = ({ entity, refreshIntervalMs }) => {
|
40
|
+
var _a;
|
41
|
+
const { kubernetesObjects, error } = useKubernetesObjects(
|
42
|
+
entity,
|
43
|
+
refreshIntervalMs
|
44
|
+
);
|
45
|
+
const [loading, setLoading] = useState(true);
|
46
|
+
useEffect(() => {
|
47
|
+
if (kubernetesObjects !== void 0 && kubernetesObjects !== null) {
|
48
|
+
setLoading(false);
|
49
|
+
}
|
50
|
+
}, [kubernetesObjects]);
|
51
|
+
const ecss = [];
|
52
|
+
if (kubernetesObjects !== void 0) {
|
53
|
+
for (let clusterCnt = 0; clusterCnt < kubernetesObjects.items.length; clusterCnt++) {
|
54
|
+
const customResources = kubernetesObjects == null ? void 0 : kubernetesObjects.items[clusterCnt].resources.filter(isCustomResource);
|
55
|
+
const upboundEcsCRs = customResources == null ? void 0 : customResources.map((r) => {
|
56
|
+
return { ...r, resources: r.resources.filter(isUpboundEcs) };
|
57
|
+
});
|
58
|
+
const flattenUpboundEcsAny = (_a = upboundEcsCRs == null ? void 0 : upboundEcsCRs.flatMap(
|
59
|
+
({ resources }) => [...resources]
|
60
|
+
)) != null ? _a : [];
|
61
|
+
const ecsCrds = flattenUpboundEcsAny;
|
62
|
+
for (let crdCnt = 0; crdCnt < ecsCrds.length; crdCnt++) {
|
63
|
+
const appName = ecsCrds[crdCnt].metadata.labels["app.kubernetes.io/part-of"];
|
64
|
+
const kind = ecsCrds[crdCnt].kind;
|
65
|
+
const resource = {
|
66
|
+
name: ecsCrds[crdCnt].metadata.name,
|
67
|
+
externalName: ecsCrds[crdCnt].metadata.annotations["crossplane.io/external-name"]
|
68
|
+
};
|
69
|
+
for (let condCnt = 0; condCnt < ecsCrds[crdCnt].status.conditions.length; condCnt++) {
|
70
|
+
const condition = ecsCrds[crdCnt].status.conditions[condCnt];
|
71
|
+
const type = condition.type;
|
72
|
+
switch (type) {
|
73
|
+
case "Ready":
|
74
|
+
resource.ready = condition.status;
|
75
|
+
break;
|
76
|
+
case "Synced":
|
77
|
+
resource.synced = condition.status;
|
78
|
+
break;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
let ecs = {};
|
82
|
+
const appIndex = ecss.findIndex(
|
83
|
+
(item) => item.name === appName
|
84
|
+
);
|
85
|
+
if (appIndex !== -1) {
|
86
|
+
ecs = ecss[appIndex];
|
87
|
+
} else {
|
88
|
+
ecs.name = appName;
|
89
|
+
ecs.resources = [];
|
90
|
+
}
|
91
|
+
const kindIndex = ecs.resources.findIndex(
|
92
|
+
(item) => item.kind === kind
|
93
|
+
);
|
94
|
+
if (kindIndex !== -1) {
|
95
|
+
ecs.resources[kindIndex].resources.push(resource);
|
96
|
+
} else {
|
97
|
+
ecs.resources.push({
|
98
|
+
kind,
|
99
|
+
resources: [resource]
|
100
|
+
});
|
101
|
+
}
|
102
|
+
if (appIndex === -1) {
|
103
|
+
ecss.push(ecs);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Content, null, loading ? (
|
109
|
+
// Display progress bar while loading
|
110
|
+
/* @__PURE__ */ React.createElement("div", { className: "progress-bar-container" }, /* @__PURE__ */ React.createElement(Progress, null))
|
111
|
+
) : (kubernetesObjects == null ? void 0 : kubernetesObjects.items) !== void 0 && (ecss == null ? void 0 : ecss.length) > 0 && ecss.map(
|
112
|
+
(ecs) => /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(ResourceTable, { app: ecs.name, resources: ecs.resources })))
|
113
|
+
), error !== void 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error: new Error(error) }), ";"))));
|
114
|
+
};
|
115
|
+
function isCustomResource(n) {
|
116
|
+
return n.type === "customresources";
|
117
|
+
}
|
118
|
+
function isUpboundEcs(n) {
|
119
|
+
return n.apiVersion.endsWith("aws.upbound.io/v1beta1");
|
120
|
+
}
|
121
|
+
|
122
|
+
const Router = (props) => {
|
123
|
+
const { entity } = useEntity();
|
124
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(
|
125
|
+
Route,
|
126
|
+
{
|
127
|
+
path: "/",
|
128
|
+
element: /* @__PURE__ */ React.createElement(
|
129
|
+
CrossplaneAwsComponent,
|
130
|
+
{
|
131
|
+
entity,
|
132
|
+
refreshIntervalMs: props.refreshIntervalMs
|
133
|
+
}
|
134
|
+
)
|
135
|
+
}
|
136
|
+
));
|
137
|
+
};
|
138
|
+
|
139
|
+
export { Router };
|
140
|
+
//# sourceMappingURL=Router-7e4981b2.esm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Router-7e4981b2.esm.js","sources":["../../src/components/ResourceTable/ResourceTable.tsx","../../src/components/CrossplaneAws/CrossplaneAwsComponent.tsx","../../src/Router.tsx"],"sourcesContent":["import React from \"react\";\nimport {Resource} from \"../../type\";\nimport {Table, TableColumn} from \"@backstage/core-components\";\n\nexport const ResourceTable = (props: { app: string, resources: Resource[] }) => {\n const {app, resources} = props;\n\n\n const columns: TableColumn[] = [\n {title: 'Kind', field: 'kind'},\n {title: 'Name', field: 'name'},\n {title: 'Ready', field: 'ready'},\n {title: 'Synced', field: 'synced'},\n {title: 'External Name', field: 'externalName'},\n ];\n\n const data = [] as {\n kind: string,\n name: string,\n ready: string,\n synced: string,\n externalName: string\n }[];\n\n resources.map(resource => {\n resource.resources.map(resourceStatus => {\n data.push({\n kind: resource.kind,\n name: resourceStatus.name,\n ready: resourceStatus.ready,\n synced: resourceStatus.synced,\n externalName: resourceStatus.externalName,\n })\n })\n });\n\n return (\n <Table\n title={app}\n columns={columns}\n data={data}\n\n />\n );\n};","import {Entity} from '@backstage/catalog-model';\nimport React, {useEffect, useState} from \"react\";\nimport {useKubernetesObjects} from \"@backstage/plugin-kubernetes\";\nimport {Ecs, Resource, ResourceStatus, UpboundECSCrd} from \"../../type\";\nimport {FetchResponse} from \"@backstage/plugin-kubernetes-common\";\nimport {Content, Page, Progress, ResponseErrorPanel} from \"@backstage/core-components\";\nimport {Grid} from \"@material-ui/core\";\nimport {ResourceTable} from \"../ResourceTable\";\n\ntype KubernetesContentProps = {\n entity: Entity;\n refreshIntervalMs?: number;\n children?: React.ReactNode;\n}\n\nexport const CrossplaneAwsComponent = ({entity, refreshIntervalMs}: KubernetesContentProps) => {\n const {kubernetesObjects, error} = useKubernetesObjects(\n entity,\n refreshIntervalMs,\n );\n\n const [loading, setLoading] = useState(true); // State to manage loading state\n\n useEffect(() => {\n // This useEffect will run whenever kubernetesObjects changes\n // If kubernetesObjects is not undefined or null, setLoading to false\n if (kubernetesObjects !== undefined && kubernetesObjects !== null) {\n setLoading(false);\n }\n }, [kubernetesObjects]);\n\n const ecss = [] as Ecs[];\n\n if (kubernetesObjects !== undefined) {\n for (let clusterCnt = 0; clusterCnt < kubernetesObjects.items.length; clusterCnt++) {\n const customResources = kubernetesObjects?.items[clusterCnt].resources.filter(isCustomResource);\n\n // get ecsCrs\n const upboundEcsCRs = customResources?.map((r) => {\n return {...r, resources: r.resources.filter(isUpboundEcs)}\n });\n\n // flatMap\n const flattenUpboundEcsAny = upboundEcsCRs?.flatMap(({resources}) =>\n [...resources]\n ) ?? [];\n\n const ecsCrds = flattenUpboundEcsAny as UpboundECSCrd[];\n\n for (let crdCnt = 0; crdCnt < ecsCrds.length; crdCnt++) {\n\n const appName = ecsCrds[crdCnt].metadata.labels[\"app.kubernetes.io/part-of\"]\n\n const kind = ecsCrds[crdCnt].kind\n\n const resource = {\n name: ecsCrds[crdCnt].metadata.name,\n externalName: ecsCrds[crdCnt].metadata.annotations[\"crossplane.io/external-name\"],\n } as ResourceStatus;\n\n for (let condCnt = 0; condCnt < ecsCrds[crdCnt].status.conditions.length; condCnt++) {\n const condition = ecsCrds[crdCnt].status.conditions[condCnt];\n const type = condition.type;\n switch (type) {\n case (\"Ready\"):\n resource.ready = condition.status;\n break;\n case(\"Synced\"):\n resource.synced = condition.status;\n break;\n default:\n break;\n }\n }\n\n let ecs = {} as Ecs;\n const appIndex = ecss.findIndex(\n (item) => item.name === appName\n )\n if (appIndex !== -1) {\n ecs = ecss[appIndex];\n } else {\n ecs.name = appName;\n ecs.resources = [];\n }\n\n const kindIndex = ecs.resources.findIndex(\n (item) => item.kind === kind\n )\n\n if (kindIndex !== -1) {\n ecs.resources[kindIndex].resources.push(resource);\n } else {\n ecs.resources.push({\n kind: kind,\n resources: [resource]\n })\n }\n\n if (appIndex === -1) {\n ecss.push(ecs);\n }\n }\n\n }\n }\n\n return (\n <Page themeId=\"tool\">\n <Content>\n {loading ? ( // Display progress bar while loading\n <div className=\"progress-bar-container\">\n <Progress/>\n </div>\n ) : (kubernetesObjects?.items !== undefined && ecss?.length > 0 &&\n (ecss.map((ecs) =>\n (<Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ResourceTable app={ecs.name} resources={ecs.resources}/>\n </Grid>\n </Grid>)\n )))\n }\n {error !== undefined &&\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ResponseErrorPanel error={(new Error(error))}/>;\n </Grid>\n </Grid>\n }\n </Content>\n </Page>\n );\n}\n\nfunction isCustomResource(n: FetchResponse) {\n return n.type === 'customresources';\n}\n\nfunction isUpboundEcs(n: any): n is Resource {\n return n.apiVersion.endsWith('aws.upbound.io/v1beta1');\n}","import {useEntity} from \"@backstage/plugin-catalog-react\";\nimport React from \"react\";\nimport {Route, Routes} from \"react-router-dom\";\nimport {CrossplaneAwsComponent} from \"./components/CrossplaneAws\";\n\nexport const Router = (props: { refreshIntervalMs?: number }) => {\n const {entity} = useEntity();\n\n\n return (\n\n <Routes>\n <Route\n path=\"/\"\n element={\n <CrossplaneAwsComponent\n entity={entity}\n refreshIntervalMs={props.refreshIntervalMs}\n />\n }\n />\n </Routes>\n\n );\n}"],"names":[],"mappings":";;;;;;;AAIa,MAAA,aAAA,GAAgB,CAAC,KAAkD,KAAA;AAC5E,EAAM,MAAA,EAAC,GAAK,EAAA,SAAA,EAAa,GAAA,KAAA,CAAA;AAGzB,EAAA,MAAM,OAAyB,GAAA;AAAA,IAC3B,EAAC,KAAA,EAAO,MAAQ,EAAA,KAAA,EAAO,MAAM,EAAA;AAAA,IAC7B,EAAC,KAAA,EAAO,MAAQ,EAAA,KAAA,EAAO,MAAM,EAAA;AAAA,IAC7B,EAAC,KAAA,EAAO,OAAS,EAAA,KAAA,EAAO,OAAO,EAAA;AAAA,IAC/B,EAAC,KAAA,EAAO,QAAU,EAAA,KAAA,EAAO,QAAQ,EAAA;AAAA,IACjC,EAAC,KAAA,EAAO,eAAiB,EAAA,KAAA,EAAO,cAAc,EAAA;AAAA,GAClD,CAAA;AAEA,EAAA,MAAM,OAAO,EAAC,CAAA;AAQd,EAAA,SAAA,CAAU,IAAI,CAAY,QAAA,KAAA;AACtB,IAAS,QAAA,CAAA,SAAA,CAAU,IAAI,CAAkB,cAAA,KAAA;AACrC,MAAA,IAAA,CAAK,IAAK,CAAA;AAAA,QACN,MAAM,QAAS,CAAA,IAAA;AAAA,QACf,MAAM,cAAe,CAAA,IAAA;AAAA,QACrB,OAA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a,MAAA,MAAA,GAAS,CAAC,KAA0C,KAAA;AAC7D,EAAM,MAAA,EAAC,MAAM,EAAA,GAAI,SAAU,EAAA,CAAA;AAG3B,EAAA,2CAEK,MACG,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACG,IAAK,EAAA,GAAA;AAAA,MACL,OACI,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,sBAAA;AAAA,QAAA;AAAA,UACG,MAAA;AAAA,UACA,mBAAmB,KAAM,CAAA,iBAAA;AAAA,SAAA;AAAA,OAC7B;AAAA,KAAA;AAAA,GAGZ,CAAA,CAAA;AAGR;;;;"}
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
3
|
+
import { AppPluginInterface } from '@vmware-tanzu/core-frontend';
|
4
|
+
|
5
|
+
declare const crossplaneAwsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
6
|
+
root: _backstage_core_plugin_api.RouteRef<undefined>;
|
7
|
+
}, {}, {}>;
|
8
|
+
type EntityCrossplaneAwsContentProps = {
|
9
|
+
/**
|
10
|
+
* Sets the refresh interval in milliseconds. The default value is 10000 (10 seconds)
|
11
|
+
*/
|
12
|
+
refreshIntervalMs?: number;
|
13
|
+
};
|
14
|
+
declare const EntityCrossplaneAwsContent: (props: EntityCrossplaneAwsContentProps) => JSX.Element;
|
15
|
+
|
16
|
+
declare const TanzuAWSPlugin: AppPluginInterface;
|
17
|
+
|
18
|
+
export { EntityCrossplaneAwsContent, TanzuAWSPlugin, crossplaneAwsPlugin };
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { createRouteRef, createPlugin, createRoutableExtension } from '@backstage/core-plugin-api';
|
2
|
+
import React from 'react';
|
3
|
+
import { AppRouteSurface, EntityPageSurface } from '@vmware-tanzu/core-frontend';
|
4
|
+
import { EntityLayout } from '@backstage/plugin-catalog';
|
5
|
+
|
6
|
+
const rootRouteRef = createRouteRef({
|
7
|
+
id: "crossplane-ecs"
|
8
|
+
});
|
9
|
+
|
10
|
+
const crossplaneAwsPlugin = createPlugin({
|
11
|
+
id: "crossplane-ecs",
|
12
|
+
routes: {
|
13
|
+
root: rootRouteRef
|
14
|
+
}
|
15
|
+
});
|
16
|
+
const EntityCrossplaneAwsContent = crossplaneAwsPlugin.provide(
|
17
|
+
createRoutableExtension({
|
18
|
+
name: "EntityCrossplaneAwsContent",
|
19
|
+
component: () => import('./esm/Router-7e4981b2.esm.js').then((m) => m.Router),
|
20
|
+
mountPoint: rootRouteRef
|
21
|
+
})
|
22
|
+
);
|
23
|
+
|
24
|
+
const TanzuAWSPlugin = () => (context) => {
|
25
|
+
context.applyWithDependency(
|
26
|
+
AppRouteSurface,
|
27
|
+
EntityPageSurface,
|
28
|
+
(_appRouteSurface, entityPageSurface) => {
|
29
|
+
entityPageSurface.servicePage.addTab(
|
30
|
+
// eslint-disable-next-line react/react-in-jsx-scope
|
31
|
+
/* @__PURE__ */ React.createElement(EntityLayout.Route, { path: "/aws", title: "AWS Resources" }, /* @__PURE__ */ React.createElement(EntityCrossplaneAwsContent, { refreshIntervalMs: 5e3 }))
|
32
|
+
);
|
33
|
+
}
|
34
|
+
);
|
35
|
+
};
|
36
|
+
|
37
|
+
export { EntityCrossplaneAwsContent, TanzuAWSPlugin, crossplaneAwsPlugin };
|
38
|
+
//# sourceMappingURL=index.esm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/routes.ts","../src/plugin.ts","../src/TanzuAWSPlugin.tsx"],"sourcesContent":["import {createRouteRef} from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'crossplane-ecs',\n});\n","import {createPlugin, createRoutableExtension} from '@backstage/core-plugin-api';\n\nimport {rootRouteRef} from './routes';\n\nexport const crossplaneAwsPlugin = createPlugin({\n id: 'crossplane-ecs',\n routes: {\n root: rootRouteRef,\n },\n});\n\nexport type EntityCrossplaneAwsContentProps = {\n /**\n * Sets the refresh interval in milliseconds. The default value is 10000 (10 seconds)\n */\n refreshIntervalMs?: number;\n};\n\nexport const EntityCrossplaneAwsContent: (\n props: EntityCrossplaneAwsContentProps,\n) => JSX.Element = crossplaneAwsPlugin.provide(\n createRoutableExtension({\n name: 'EntityCrossplaneAwsContent',\n component: () => import('./Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n","import React from 'react';\nimport {AppPluginInterface, AppRouteSurface, EntityPageSurface} from \"@vmware-tanzu/core-frontend\";\nimport {EntityCrossplaneAwsContent} from './plugin';\nimport {EntityLayout} from \"@backstage/plugin-catalog\";\n\nexport const TanzuAWSPlugin: AppPluginInterface = () => context => {\n context.applyWithDependency(\n AppRouteSurface,\n EntityPageSurface,\n (_appRouteSurface, entityPageSurface) => {\n entityPageSurface.servicePage.addTab(\n // eslint-disable-next-line react/react-in-jsx-scope\n <EntityLayout.Route path=\"/aws\" title=\"AWS Resources\">\n <EntityCrossplaneAwsContent refreshIntervalMs={5000}/>\n </EntityLayout.Route>,\n );\n },\n );\n}"],"names":[],"mappings":";;;;;AAEO,MAAM,eAAe,cAAe,CAAA;AAAA,EACvC,EAAI,EAAA,gBAAA;AACR,CAAC,CAAA;;ACAM,MAAM,sBAAsB,YAAa,CAAA;AAAA,EAC5C,EAAI,EAAA,gBAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACJ,IAAM,EAAA,YAAA;AAAA,GACV;AACJ,CAAC,EAAA;AASM,MAAM,6BAEM,mBAAoB,CAAA,OAAA;AAAA,EACnC,uBAAwB,CAAA;AAAA,IACpB,IAAM,EAAA,4BAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,8BAAU,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,IACtD,UAAY,EAAA,YAAA;AAAA,GACf,CAAA;AACL;;ACrBa,MAAA,cAAA,GAAqC,MAAM,CAAW,OAAA,KAAA;AAC/D,EAAQ,OAAA,CAAA,mBAAA;AAAA,IACJ,eAAA;AAAA,IACA,iBAAA;AAAA,IACA,CAAC,kBAAkB,iBAAsB,KAAA;AACrC,MAAA,iBAAA,CAAkB,WAAY,CAAA,MAAA;AAAA;AAAA,wBAEzB,KAAA,CAAA,aAAA,CAAA,YAAA,CAAa,KAAb,EAAA,EAAmB,IAAK,EAAA,MAAA,EAAO,KAAM,EAAA,eAAA,EAAA,kBACjC,KAAA,CAAA,aAAA,CAAA,0BAAA,EAAA,EAA2B,iBAAmB,EAAA,GAAA,EAAK,CACxD,CAAA;AAAA,OACJ,CAAA;AAAA,KACJ;AAAA,GACJ,CAAA;AACJ;;;;"}
|
package/package.json
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
{
|
2
|
+
"name": "@mhoshi-vm/plugin-crossplane-aws",
|
3
|
+
"version": "0.1.1",
|
4
|
+
"main": "dist/index.esm.js",
|
5
|
+
"types": "dist/index.d.ts",
|
6
|
+
"license": "Apache-2.0",
|
7
|
+
"private": false,
|
8
|
+
"publishConfig": {
|
9
|
+
"access": "public",
|
10
|
+
"main": "dist/index.esm.js",
|
11
|
+
"types": "dist/index.d.ts"
|
12
|
+
},
|
13
|
+
"backstage": {
|
14
|
+
"role": "frontend-plugin"
|
15
|
+
},
|
16
|
+
"scripts": {
|
17
|
+
"start": "backstage-cli package start",
|
18
|
+
"build": "backstage-cli package build",
|
19
|
+
"lint": "backstage-cli package lint",
|
20
|
+
"test": "backstage-cli package test",
|
21
|
+
"clean": "backstage-cli package clean",
|
22
|
+
"prepack": "backstage-cli package prepack",
|
23
|
+
"postpack": "backstage-cli package postpack"
|
24
|
+
},
|
25
|
+
"dependencies": {
|
26
|
+
"@backstage/catalog-model": "^1.4.3",
|
27
|
+
"@backstage/core-components": "*",
|
28
|
+
"@backstage/core-plugin-api": "*",
|
29
|
+
"@backstage/plugin-catalog": "*",
|
30
|
+
"@backstage/plugin-catalog-react": "*",
|
31
|
+
"@backstage/plugin-kubernetes": "*",
|
32
|
+
"@backstage/plugin-kubernetes-common": "*",
|
33
|
+
"@material-ui/core": "^4.12.4",
|
34
|
+
"@vmware-tanzu/core-common": "^1.0.0",
|
35
|
+
"@vmware-tanzu/core-frontend": "^1.0.0",
|
36
|
+
"react-use": "^17.4.2"
|
37
|
+
},
|
38
|
+
"peerDependencies": {
|
39
|
+
"react": "^17.0.2",
|
40
|
+
"react-dom": "^17.0.2",
|
41
|
+
"react-router": "6.0.0-beta.0",
|
42
|
+
"react-router-dom": "6.0.0-beta.0"
|
43
|
+
},
|
44
|
+
"devDependencies": {
|
45
|
+
"@backstage/cli": "^0.22.10",
|
46
|
+
"@backstage/core-app-api": "^1.9.1",
|
47
|
+
"@backstage/dev-utils": "^1.0.20",
|
48
|
+
"@backstage/test-utils": "^1.4.2",
|
49
|
+
"@testing-library/jest-dom": "^5.10.1",
|
50
|
+
"@testing-library/react": "^12.1.3",
|
51
|
+
"@testing-library/user-event": "^14.0.0",
|
52
|
+
"@types/node": "*",
|
53
|
+
"eslint": "^8.16.0",
|
54
|
+
"msw": "^1.0.0"
|
55
|
+
},
|
56
|
+
"files": [
|
57
|
+
"dist"
|
58
|
+
],
|
59
|
+
"module": "./dist/index.esm.js"
|
60
|
+
}
|
package/src/index.ts
ADDED