mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Upgrade versions of @ogre-tools/* to 15.3.0
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
7dc0ce7192
commit
ba8f7f916d
27 files changed
+5445
-17542
No files matched your search
@@ -34,8 +34,8 @@
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/run-many": "^1.0.0-alpha.1",
|
||||
"@ogre-tools/injectable": "^15.1.2",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
||||
"@ogre-tools/injectable": "^15.3.0",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||
"electron": "^22.3.3",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
|
||||
+25
-30
@@ -1,44 +1,39 @@
|
||||
import { DiContainer, getInjectable, instantiationDecoratorToken, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import {
|
||||
getInjectable,
|
||||
instantiationDecoratorToken,
|
||||
createInstantiationTargetDecorator,
|
||||
} from "@ogre-tools/injectable";
|
||||
import { startApplicationInjectionToken } from "@k8slens/application";
|
||||
import whenAppIsReadyInjectable from "./when-app-is-ready.injectable";
|
||||
import { beforeAnythingInjectionToken, beforeElectronIsReadyInjectionToken } from "./time-slots";
|
||||
import { runManySyncFor } from "@k8slens/run-many";
|
||||
import { curry } from "lodash";
|
||||
|
||||
type ToBeDecorated = (di: DiContainer, ...args: unknown[]) => (...args: unknown[]) => unknown;
|
||||
|
||||
const decorator = (toBeDecorated: unknown, di: DiContainer, ...args: unknown[]) => {
|
||||
const whenAppIsReady = di.inject(whenAppIsReadyInjectable);
|
||||
const runManySync = runManySyncFor(di);
|
||||
const beforeAnything = runManySync(beforeAnythingInjectionToken);
|
||||
const beforeElectronIsReady = runManySync(beforeElectronIsReadyInjectionToken);
|
||||
const startApplication = (toBeDecorated as ToBeDecorated)(di, ...args);
|
||||
|
||||
return (...startApplicationArgs: unknown[]) => {
|
||||
beforeAnything();
|
||||
beforeElectronIsReady();
|
||||
|
||||
return (async () => {
|
||||
await whenAppIsReady();
|
||||
|
||||
return startApplication(...startApplicationArgs);
|
||||
})();
|
||||
};
|
||||
};
|
||||
|
||||
const startElectronApplicationInjectable = getInjectable({
|
||||
id: "start-electron-application",
|
||||
instantiate: () =>
|
||||
createInstantiationTargetDecorator({
|
||||
target: startApplicationInjectionToken,
|
||||
decorate: (targetInstantiate) => (di) => {
|
||||
const whenAppIsReady = di.inject(whenAppIsReadyInjectable);
|
||||
const runManySync = runManySyncFor(di);
|
||||
const beforeAnything = runManySync(beforeAnythingInjectionToken);
|
||||
const beforeElectronIsReady = runManySync(beforeElectronIsReadyInjectionToken);
|
||||
const startApplication = targetInstantiate(di);
|
||||
|
||||
instantiate: () => ({
|
||||
decorate: curry(decorator),
|
||||
target: startApplicationInjectionToken,
|
||||
}),
|
||||
return () => {
|
||||
beforeAnything();
|
||||
beforeElectronIsReady();
|
||||
|
||||
return (async () => {
|
||||
await whenAppIsReady();
|
||||
|
||||
return startApplication();
|
||||
})();
|
||||
};
|
||||
},
|
||||
}),
|
||||
decorable: false,
|
||||
|
||||
injectionToken: instantiationDecoratorToken,
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
export default startElectronApplicationInjectable;
|
||||
Reference in new issue
Block a user