diff --git a/src/common/app-paths/app-path-injection-token.ts b/src/common/app-paths/app-path-injection-token.ts index e29bcdbebf..91e8a580d8 100644 --- a/src/common/app-paths/app-path-injection-token.ts +++ b/src/common/app-paths/app-path-injection-token.ts @@ -2,11 +2,6 @@ * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ -import { getInjectionToken } from "@ogre-tools/injectable"; import type { PathName } from "./app-path-names"; export type AppPaths = Record; - -export const appPathsInjectionToken = getInjectionToken({ id: "app-paths-token" }); - - diff --git a/src/common/app-paths/app-paths-state.injectable.ts b/src/common/app-paths/app-paths-state.injectable.ts index 5487d428b2..db46b8d115 100644 --- a/src/common/app-paths/app-paths-state.injectable.ts +++ b/src/common/app-paths/app-paths-state.injectable.ts @@ -21,6 +21,8 @@ const appPathsStateInjectable = getInjectable({ }, set: (newState: AppPaths) => { + console.trace("whereamI?"); + if (state) { throw new Error("Tried to overwrite existing state of app paths."); } diff --git a/src/common/app-paths/app-paths.injectable.ts b/src/common/app-paths/app-paths.injectable.ts index 803f9e1380..0e836a8514 100644 --- a/src/common/app-paths/app-paths.injectable.ts +++ b/src/common/app-paths/app-paths.injectable.ts @@ -3,13 +3,11 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "./app-path-injection-token"; import appPathsStateInjectable from "./app-paths-state.injectable"; const appPathsInjectable = getInjectable({ id: "app-paths", instantiate: (di) => di.inject(appPathsStateInjectable).get(), - injectionToken: appPathsInjectionToken, }); export default appPathsInjectable; diff --git a/src/common/app-paths/app-paths.test.ts b/src/common/app-paths/app-paths.test.ts index ff4bd88988..c0d2ddd60e 100644 --- a/src/common/app-paths/app-paths.test.ts +++ b/src/common/app-paths/app-paths.test.ts @@ -3,7 +3,6 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import type { AppPaths } from "./app-path-injection-token"; -import { appPathsInjectionToken } from "./app-path-injection-token"; import getElectronAppPathInjectable from "../../main/app-paths/get-electron-app-path/get-electron-app-path.injectable"; import type { PathName } from "./app-path-names"; import setElectronAppPathInjectable from "../../main/app-paths/set-electron-app-path/set-electron-app-path.injectable"; @@ -11,6 +10,7 @@ import directoryForIntegrationTestingInjectable from "../../main/app-paths/direc import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder"; import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder"; import type { DiContainer } from "@ogre-tools/injectable"; +import appPathsInjectable from "./app-paths.injectable"; describe("app-paths", () => { let builder: ApplicationBuilder; @@ -67,7 +67,7 @@ describe("app-paths", () => { }); it("given in renderer, when injecting app paths, returns application specific app paths", () => { - const actual = windowDi.inject(appPathsInjectionToken); + const actual = windowDi.inject(appPathsInjectable); expect(actual).toEqual({ appData: "some-app-data", @@ -90,7 +90,7 @@ describe("app-paths", () => { }); it("given in main, when injecting app paths, returns application specific app paths", () => { - const actual = mainDi.inject(appPathsInjectionToken); + const actual = mainDi.inject(appPathsInjectable); expect(actual).toEqual({ appData: "some-app-data", @@ -130,7 +130,7 @@ describe("app-paths", () => { }); it("given in renderer, when injecting path for app data, has integration specific app data path", () => { - const { appData, userData } = windowDi.inject(appPathsInjectionToken); + const { appData, userData } = windowDi.inject(appPathsInjectable); expect({ appData, userData }).toEqual({ appData: "some-integration-testing-app-data", @@ -139,7 +139,7 @@ describe("app-paths", () => { }); it("given in main, when injecting path for app data, has integration specific app data path", () => { - const { appData, userData } = windowDi.inject(appPathsInjectionToken); + const { appData, userData } = windowDi.inject(appPathsInjectable); expect({ appData, userData }).toEqual({ appData: "some-integration-testing-app-data", diff --git a/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts b/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts index 944c8a656a..01f97dbaec 100644 --- a/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts +++ b/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts @@ -3,11 +3,11 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import appPathsInjectable from "../app-paths.injectable"; const directoryForDownloadsInjectable = getInjectable({ id: "directory-for-downloads", - instantiate: (di) => di.inject(appPathsInjectionToken).downloads, + instantiate: (di) => di.inject(appPathsInjectable).downloads, }); export default directoryForDownloadsInjectable; diff --git a/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts b/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts index 1bd245daa4..690f53d958 100644 --- a/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts +++ b/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts @@ -3,11 +3,11 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import appPathsInjectable from "../app-paths.injectable"; const directoryForExesInjectable = getInjectable({ id: "directory-for-exes", - instantiate: (di) => di.inject(appPathsInjectionToken).exe, + instantiate: (di) => di.inject(appPathsInjectable).exe, }); export default directoryForExesInjectable; diff --git a/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts b/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts index b51e8e0489..460efc073d 100644 --- a/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts +++ b/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts @@ -3,11 +3,11 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import appPathsInjectable from "../app-paths.injectable"; const directoryForTempInjectable = getInjectable({ id: "directory-for-temp", - instantiate: (di) => di.inject(appPathsInjectionToken).temp, + instantiate: (di) => di.inject(appPathsInjectable).temp, }); export default directoryForTempInjectable; diff --git a/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts b/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts index bff067b7e5..793684dd21 100644 --- a/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts +++ b/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts @@ -3,11 +3,15 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import appPathsInjectable from "../app-paths.injectable"; const directoryForUserDataInjectable = getInjectable({ id: "directory-for-user-data", - instantiate: (di) => di.inject(appPathsInjectionToken).userData, + instantiate: (di) => { + console.trace("whereamI?"); + + return di.inject(appPathsInjectable).userData; + }, }); export default directoryForUserDataInjectable;