Convert runMany and runManySync to use injectManyWithMeta + move to seperate package (#7244)

* Convert runMany and runManySync to use injectManyWithMeta

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fixup type errors due to new Runnable requirements

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add documentation for verifyRunnablesAreDAG

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Simplify convertToWithIdWith

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Move all utility functions to separate package

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Move testing utilities to separate package

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Move run-many and run-many-sync to separate package

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Replace all internal uses of utilities with new packages

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Use new @k8slens/run-many package in core

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add dep to open-lens

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fixup type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fixup uses of @k8slens/test-utils

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fixup getGlobalOverride

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Move tests to new package too

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fixup uses of AsyncResult and autoBind

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fixup remaining import issues

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Finial fixups to fix build

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert moving "testUsingFakeTime" to separate package

- This fixes tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix integration tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix unit test failing due to spelling fix

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2023-03-10 10:07:28 +02:00
1 parent ad9bafe2a5
commit 2789bcebcb
754 files changed
+2715 -2752

No files matched your search

@@ -9,7 +9,6 @@ import { beforeFrameStartsFirstInjectionToken } from "../tokens";
const configureImmerInjectable = getInjectable({
id: "configure-immer",
instantiate: () => ({
id: "configure-immer",
run: () => {
// Docs: https://immerjs.github.io/immer/
// Required in `utils/storage-helper.ts`
@@ -9,7 +9,6 @@ import { beforeFrameStartsFirstInjectionToken } from "../tokens";
const configureMobxInjectable = getInjectable({
id: "configure-mobx",
instantiate: () => ({
id: "configure-mobx",
run: () => {
// Docs: https://mobx.js.org/configuration.html
configure({
@@ -10,7 +10,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
const loadMonacoThemesInjectable = getInjectable({
id: "load-monaco-themes",
instantiate: (di) => ({
id: "load-monaco-themes",
run: () => {
const customThemes = di.injectMany(customMonacoThemeInjectionToken);
const addNewMonacoTheme = di.inject(addNewMonacoThemeInjectable);
@@ -19,7 +19,6 @@ import maybeKubeApiInjectable from "../../../common/k8s-api/maybe-kube-api.injec
const setupAutoRegistrationInjectable = getInjectable({
id: "setup-auto-registration",
instantiate: (di) => ({
id: "setup-auto-registration",
run: () => {
const autoRegistrationEmitter = di.inject(autoRegistrationEmitterInjectable);
const beforeApiManagerInitializationCrds: CustomResourceDefinition[] = [];
@@ -12,7 +12,6 @@ import { beforeMainFrameStartsFirstInjectionToken } from "../tokens";
const setupCurrentClusterBroadcastInjectable = getInjectable({
id: "setup-current-cluster-broadcast",
instantiate: (di) => ({
id: "setup-current-cluster-broadcast",
run: () => {
const matchedClusterId = di.inject(matchedClusterIdInjectable);
const sendMessageToChannel = di.inject(sendMessageToChannelInjectionToken);
@@ -14,7 +14,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
const setupKubernetesClusterCatalogAddMenuListenerInjectable = getInjectable({
id: "setup-kubernetes-cluster-catalog-add-menu-listener",
instantiate: (di) => ({
id: "setup-kubernetes-cluster-catalog-add-menu-listener",
run: () => {
const navigateToAddCluster = di.inject(navigateToAddClusterInjectable);
const addSyncEntries = di.inject(addSyncEntriesInjectable);
@@ -13,7 +13,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
const setupKubernetesClusterContextMenuOpenInjectable = getInjectable({
id: "setup-kubernetes-cluster-context-menu-open",
instantiate: (di) => ({
id: "setup-kubernetes-cluster-context-menu-open",
run: () => {
const catalogCategoryRegistry = di.inject(catalogCategoryRegistryInjectable);
const openDeleteClusterDialog = di.inject(openDeleteClusterDialogInjectable);
@@ -10,7 +10,6 @@ import requestLensProxyCertificateInjectable from "../../certificate/request-len
const setupLensProxyCertificateInjectable = getInjectable({
id: "setup-lens-proxy-certificate",
instantiate: (di) => ({
id: "setup-lens-proxy-certificate",
run: async () => {
const requestLensProxyCertificate = di.inject(requestLensProxyCertificateInjectable);
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
@@ -9,7 +9,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
const setupRootMacClassnameInjectable = getInjectable({
id: "setup-root-mac-classname",
instantiate: (di) => ({
id: "setup-root-mac-classname",
run: () => {
const isMac = di.inject(isMacInjectable);
const rootElem = document.getElementById("app");
@@ -10,7 +10,6 @@ import { init } from "@sentry/electron/renderer";
const setupSentryInjectable = getInjectable({
id: "setup-sentry",
instantiate: (di) => ({
id: "setup-sentry",
run: () => {
const initializeSentryReportingWith = di.inject(initializeSentryReportingWithInjectable);
@@ -9,10 +9,9 @@ import { WeblinkAddCommand } from "../../components/catalog-entities/weblink-add
import commandOverlayInjectable from "../../components/command-palette/command-overlay.injectable";
import { beforeFrameStartsSecondInjectionToken } from "../tokens";
const setupWeblickContextMenuOpenInjectable = getInjectable({
id: "setup-weblick-context-menu-open",
const setupWeblinkContextMenuOpenInjectable = getInjectable({
id: "setup-weblink-context-menu-open",
instantiate: (di) => ({
id: "setup-weblick-context-menu-open",
run: () => {
const catalogCategoryRegistry = di.inject(catalogCategoryRegistryInjectable);
const commandOverlay = di.inject(commandOverlayInjectable);
@@ -31,4 +30,4 @@ const setupWeblickContextMenuOpenInjectable = getInjectable({
injectionToken: beforeFrameStartsSecondInjectionToken,
});
export default setupWeblickContextMenuOpenInjectable;
export default setupWeblinkContextMenuOpenInjectable;
@@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectionToken } from "@ogre-tools/injectable";
import type { Runnable } from "../../common/runnable/run-many-for";
import type { Runnable } from "@k8slens/run-many";
// NOTE: these are run before any other token, mostly to set up things that all other runnables need
export const beforeFrameStartsFirstInjectionToken = getInjectionToken<Runnable>({