From 17757fd395a03192e62a05f604d48286f8315f67 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Tue, 13 Dec 2022 15:08:12 +0200 Subject: [PATCH] use startApp on both sides Signed-off-by: Jari Kolehmainen --- src/main/index.ts | 6 ++++-- src/main/library.ts | 13 +------------ src/main/start-app.ts | 17 +++++++++++++++++ src/renderer/index.ts | 6 ++++-- src/renderer/library.ts | 13 +------------ src/renderer/start-app.ts | 18 ++++++++++++++++++ 6 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 src/main/start-app.ts create mode 100644 src/renderer/start-app.ts diff --git a/src/main/index.ts b/src/main/index.ts index e4f96684fc..66820207ff 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -6,11 +6,13 @@ // Main process import { getDi } from "./getDi"; -import startMainApplicationInjectable from "./start-main-application/start-main-application.injectable"; import { Mobx, LensExtensions, Pty } from "./extension-api"; +import { startApp } from "./start-app"; const di = getDi(); -void di.inject(startMainApplicationInjectable); +startApp({ + di, +}); export { Mobx, LensExtensions, Pty }; diff --git a/src/main/library.ts b/src/main/library.ts index 9dad026642..0c4c2d3a0f 100644 --- a/src/main/library.ts +++ b/src/main/library.ts @@ -3,24 +3,13 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ -import type { DiContainer } from "@ogre-tools/injectable"; import { registerInjectables } from "./register-injectables"; import { afterApplicationIsLoadedInjectionToken } from "./start-main-application/runnable-tokens/after-application-is-loaded-injection-token"; import { beforeApplicationIsLoadingInjectionToken } from "./start-main-application/runnable-tokens/before-application-is-loading-injection-token"; import { beforeElectronIsReadyInjectionToken } from "./start-main-application/runnable-tokens/before-electron-is-ready-injection-token"; import { onLoadOfApplicationInjectionToken } from "./start-main-application/runnable-tokens/on-load-of-application-injection-token"; -import startMainApplicationInjectable from "./start-main-application/start-main-application.injectable"; import * as extensionApi from "./extension-api"; - -interface AppConfig { - di: DiContainer; -} - -function startApp(conf: AppConfig) { - const { di } = conf; - - return di.inject(startMainApplicationInjectable); -} +import type { startApp } from "./start-app"; export { registerInjectables, diff --git a/src/main/start-app.ts b/src/main/start-app.ts new file mode 100644 index 0000000000..d293c7a320 --- /dev/null +++ b/src/main/start-app.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +import type { DiContainer } from "@ogre-tools/injectable"; +import startMainApplicationInjectable from "./start-main-application/start-main-application.injectable"; + +interface AppConfig { + di: DiContainer; +} + +export function startApp(conf: AppConfig) { + const { di } = conf; + + return di.inject(startMainApplicationInjectable); +} diff --git a/src/renderer/index.ts b/src/renderer/index.ts index 8f91e6fc3d..66cbbb43e2 100644 --- a/src/renderer/index.ts +++ b/src/renderer/index.ts @@ -6,16 +6,18 @@ import "./components/app.scss"; import { getDi } from "./getDi"; -import { bootstrap } from "./bootstrap"; import { React, ReactDOM, ReactRouter, ReactRouterDom, Mobx, MobxReact, LensExtensions, } from "./extension-api"; +import { startApp } from "./start-app"; const di = getDi(); // run -bootstrap(di); +startApp({ + di, +}); export { React, diff --git a/src/renderer/library.ts b/src/renderer/library.ts index f693655ffb..635f44a4fb 100644 --- a/src/renderer/library.ts +++ b/src/renderer/library.ts @@ -4,20 +4,9 @@ */ import "./components/app.scss"; -import { bootstrap } from "./bootstrap"; import * as extensionApi from "./extension-api"; import { registerInjectables } from "./register-injectables"; -import type { DiContainer } from "@ogre-tools/injectable"; - -interface AppConfig { - di: DiContainer; -} - -function startApp(conf: AppConfig) { - const { di } = conf; - - bootstrap(di); -} +import type { startApp } from "./start-app"; export { startApp, diff --git a/src/renderer/start-app.ts b/src/renderer/start-app.ts new file mode 100644 index 0000000000..38b248e0fe --- /dev/null +++ b/src/renderer/start-app.ts @@ -0,0 +1,18 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import "./components/app.scss"; + +import { bootstrap } from "./bootstrap"; +import type { DiContainer } from "@ogre-tools/injectable"; + +interface AppConfig { + di: DiContainer; +} + +export function startApp(conf: AppConfig) { + const { di } = conf; + + bootstrap(di); +}