chore: Fix build of open-lens

- Remove need for using relative paths during build

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-05-09 09:55:25 -04:00
1 parent 6167ad2c25
commit 91354eae01
40 files changed
+284 -160

No files matched your search

@@ -0,0 +1,50 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import packageJson from "../../package.json";
import { applicationInformationToken } from "@k8slens/application";
const applicationInformationInjectable = getInjectable({
id: "application-information",
instantiate: () => {
const {
version,
config: {
bundledHelmVersion,
bundledKubectlVersion,
contentSecurityPolicy,
k8sProxyVersion,
sentryDsn,
welcomeRoute,
},
productName,
build,
copyright,
description,
name,
dependencies,
} = packageJson;
return {
version,
productName,
copyright,
description,
name,
k8sProxyVersion,
bundledKubectlVersion,
bundledHelmVersion,
sentryDsn,
contentSecurityPolicy,
welcomeRoute,
updatingIsEnabled: (build as any)?.publish?.length > 0,
dependencies,
};
},
causesSideEffects: true,
injectionToken: applicationInformationToken,
});
export default applicationInformationInjectable;
@@ -0,0 +1,14 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { lensBuildEnvironmentInjectionToken } from "@k8slens/application";
import { getInjectable } from "@ogre-tools/injectable";
const lensBuildEnvironmentInjectable = getInjectable({
id: "lens-build-environment",
instantiate: () => "unknown",
injectionToken: lensBuildEnvironmentInjectionToken,
});
export default lensBuildEnvironmentInjectable;
@@ -0,0 +1,21 @@
import { bundledExtensionInjectionToken } from "@k8slens/legacy-extensions";
import { getInjectable } from "@ogre-tools/injectable";
import exampleBundledExtensionManifest from "@k8slens/legacy-extension-example/package.json";
const exampleBundledExtensionInjectable = getInjectable({
id: "example-bundled-extension",
instantiate: (di) => ({
manifest: exampleBundledExtensionManifest,
/**
* Inline `require` is needed as to delay the loading and execution of the JS file until it is needed.
*
* Futhermore there might be code that runs "during load" and shouldn't be executed until everything is
* setup for the extensions (ie globals).
*/
main: () => require("@k8slens/legacy-extension-example/main").default,
renderer: () => require("@k8slens/legacy-extension-example/renderer").default,
}),
injectionToken: bundledExtensionInjectionToken,
});
export default exampleBundledExtensionInjectable;