diff --git a/packages/core/src/common/vars/application-information-injectable.ts b/packages/core/src/common/vars/application-information-injectable.ts deleted file mode 100644 index 8530257a3a73..000000000000 --- a/packages/core/src/common/vars/application-information-injectable.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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 "../../common/vars/application-information-token"; - -const applicationInformationInjectable = getInjectable({ - id: "application-information", - injectionToken: applicationInformationToken, - instantiate: () => { - const { version, config, productName, build, copyright, description, name } = packageJson; - - return { version, config, productName, build, copyright, description, name }; - }, - causesSideEffects: true, -}); - -export default applicationInformationInjectable; diff --git a/packages/core/src/common/vars/application-information.global-override-for-injectable.ts b/packages/core/src/common/vars/application-information.global-override-for-injectable.ts deleted file mode 100644 index e0b886fa65b3..000000000000 --- a/packages/core/src/common/vars/application-information.global-override-for-injectable.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ - -import { getGlobalOverride } from "../test-utils/get-global-override"; -import applicationInformationInjectable from "./application-information-injectable"; - -export default getGlobalOverride(applicationInformationInjectable, () => ({ - name: "some-product-name", - productName: "some-product-name", - version: "6.0.0", - build: {} as any, - config: { - k8sProxyVersion: "0.2.1", - bundledKubectlVersion: "1.23.3", - bundledHelmVersion: "3.7.2", - sentryDsn: "", - contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:", - welcomeRoute: "/welcome", - }, - copyright: "some-copyright-information", - description: "some-descriptive-text", -})); diff --git a/packages/core/src/features/certificate-authorities/main/request-system-cas.global-override-for-injectable.ts b/packages/core/src/features/certificate-authorities/main/request-system-cas.global-override-for-injectable.ts index 670f150b81c4..ac08c953e0c4 100644 --- a/packages/core/src/features/certificate-authorities/main/request-system-cas.global-override-for-injectable.ts +++ b/packages/core/src/features/certificate-authorities/main/request-system-cas.global-override-for-injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ -import { getGlobalOverride } from "@k8slens/test-utils"; +import { getGlobalOverride } from "../../../common/test-utils/get-global-override"; import requestSystemCAsInjectable from "./request-system-cas.injectable"; export default getGlobalOverride(requestSystemCAsInjectable, () => async () => []); diff --git a/packages/core/src/main/getDi.ts b/packages/core/src/main/getDi.ts index db7decece82f..78deb4da311a 100644 --- a/packages/core/src/main/getDi.ts +++ b/packages/core/src/main/getDi.ts @@ -3,15 +3,9 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { createContainer } from "@ogre-tools/injectable"; -import { runInAction } from "mobx"; -import applicationInformationInjectable from "../common/vars/application-information-injectable"; export const getDi = () => { const di = createContainer("main"); - runInAction(() => { - di.register(applicationInformationInjectable); - }); - return di; }; diff --git a/packages/core/src/main/getDiForUnitTesting.ts b/packages/core/src/main/getDiForUnitTesting.ts index 1324667ae66b..5e3836a4f03a 100644 --- a/packages/core/src/main/getDiForUnitTesting.ts +++ b/packages/core/src/main/getDiForUnitTesting.ts @@ -5,7 +5,7 @@ import { chunk } from "lodash/fp"; import type { DiContainer, Injectable } from "@ogre-tools/injectable"; -import { createContainer, isInjectable, getInjectable } from "@ogre-tools/injectable"; +import { createContainer, isInjectable } from "@ogre-tools/injectable"; import { Environments, setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api"; import spawnInjectable from "./child-process/spawn.injectable"; import initializeExtensionsInjectable from "./start-main-application/runnables/initialize-extensions.injectable"; @@ -28,8 +28,6 @@ import waitUntilBundledExtensionsAreLoadedInjectable from "./start-main-applicat import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx"; import initializeClusterManagerInjectable from "./cluster/initialize-manager.injectable"; import type { GlobalOverride } from "../common/test-utils/get-global-override"; -import applicationInformationInjectable from "../common/vars/application-information-injectable"; -import nodeEnvInjectionToken from "../common/vars/node-env-injection-token"; import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes"; export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) { @@ -39,12 +37,6 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) const di = createContainer("main"); - di.register(getInjectable({ - id: "node-env", - instantiate: () => "production", - injectionToken: nodeEnvInjectionToken, - })); - setLegacyGlobalDiForExtensionApi(di, Environments.main); di.preventSideEffects(); @@ -58,7 +50,6 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) runInAction(() => { registerMobX(di); - di.register(applicationInformationInjectable); chunk(100)(injectables).forEach(chunkInjectables => { di.register(...chunkInjectables); diff --git a/packages/core/src/renderer/getDi.tsx b/packages/core/src/renderer/getDi.tsx index de61d5ab674c..7fccc845f2ee 100644 --- a/packages/core/src/renderer/getDi.tsx +++ b/packages/core/src/renderer/getDi.tsx @@ -4,15 +4,9 @@ */ import { createContainer } from "@ogre-tools/injectable"; -import { runInAction } from "mobx"; -import applicationInformationInjectable from "../common/vars/application-information-injectable"; export const getDi = () => { const di = createContainer("renderer"); - runInAction(() => { - di.register(applicationInformationInjectable); - }); - return di; }; diff --git a/packages/core/src/renderer/getDiForUnitTesting.tsx b/packages/core/src/renderer/getDiForUnitTesting.tsx index ac42796d9be5..0e0ba6db0111 100644 --- a/packages/core/src/renderer/getDiForUnitTesting.tsx +++ b/packages/core/src/renderer/getDiForUnitTesting.tsx @@ -5,7 +5,7 @@ import { noop, chunk } from "lodash/fp"; import type { Injectable } from "@ogre-tools/injectable"; -import { createContainer, isInjectable, getInjectable } from "@ogre-tools/injectable"; +import { createContainer, isInjectable } from "@ogre-tools/injectable"; import { Environments, setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api"; import requestFromChannelInjectable from "./utils/channel/request-from-channel.injectable"; import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes"; @@ -18,8 +18,6 @@ import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx"; import watchHistoryStateInjectable from "./remote-helpers/watch-history-state.injectable"; import legacyOnChannelListenInjectable from "./ipc/legacy-channel-listen.injectable"; import type { GlobalOverride } from "../common/test-utils/get-global-override"; -import applicationInformationInjectable from "../common/vars/application-information-injectable"; -import nodeEnvInjectionToken from "../common/vars/node-env-injection-token"; export const getDiForUnitTesting = ( opts: { doGeneralOverrides?: boolean } = {}, @@ -28,12 +26,6 @@ export const getDiForUnitTesting = ( const di = createContainer("renderer"); - di.register(getInjectable({ - id: "node-env", - instantiate: () => "production", - injectionToken: nodeEnvInjectionToken, - })); - di.preventSideEffects(); setLegacyGlobalDiForExtensionApi(di, Environments.renderer); @@ -47,7 +39,6 @@ export const getDiForUnitTesting = ( runInAction(() => { registerMobX(di); - di.register(applicationInformationInjectable); chunk(100)(injectables).forEach((chunkInjectables) => { di.register(...chunkInjectables); diff --git a/packages/core/src/test-env/application-information-fake.injectable.ts b/packages/core/src/test-env/application-information-fake.injectable.ts index c5d9bfa8d2bf..571b6a6943de 100644 --- a/packages/core/src/test-env/application-information-fake.injectable.ts +++ b/packages/core/src/test-env/application-information-fake.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; -import { applicationInformationToken } from "@k8slens/application"; +import { applicationInformationToken } from "../common/vars/application-information-token"; export const applicationInformationFakeInjectable = getInjectable({ id: "application-information-fake", @@ -14,15 +14,19 @@ export const applicationInformationFakeInjectable = getInjectable({ productName: "some-product-name", version: "6.0.0", updatingIsEnabled: false, - k8sProxyVersion: "0.2.1", - bundledKubectlVersion: "1.23.3", - bundledHelmVersion: "3.7.2", - sentryDsn: "", - contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:", - welcomeRoute: "/welcome", copyright: "some-copyright-information", description: "some-descriptive-text", dependencies: {}, + build: {}, + + config: { + welcomeRoute: "/welcome", + bundledKubectlVersion: "1.23.3", + bundledHelmVersion: "3.7.2", + k8sProxyVersion: "0.2.1", + sentryDsn: "", + contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:", + } }), injectionToken: applicationInformationToken, diff --git a/packages/core/src/test-env/node-env.injectable.ts b/packages/core/src/test-env/node-env.injectable.ts index b08639d94c1a..24e74c490057 100644 --- a/packages/core/src/test-env/node-env.injectable.ts +++ b/packages/core/src/test-env/node-env.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { nodeEnvInjectionToken } from "../main/library"; +import nodeEnvInjectionToken from "../common/vars/node-env-injection-token"; const nodeEnvForTestingEnvInjectable = getInjectable({ id: "node-env-for-testing-env",