Update injectable library (#4842)

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>
This commit is contained in:
Janne SavolainenandMikko Aspiala authored and GitHub committed 2022-02-25 11:10:13 -05:00
1 parent e8ca1ddf87
commit b65f6e00ec
231 files changed
+630 -613

No files matched your search

@@ -2,11 +2,13 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import { getInjectable } from "@ogre-tools/injectable";
import type { TabId } from "../dock/store";
import createResourceTabStoreInjectable from "./store.injectable";
const clearCreateResourceTabDataInjectable = getInjectable({
id: "clear-create-resource-tab-data",
instantiate: (di) => {
const createResourceTabStore = di.inject(createResourceTabStoreInjectable);
@@ -14,8 +16,6 @@ const clearCreateResourceTabDataInjectable = getInjectable({
createResourceTabStore.clearData(tabId);
};
},
lifecycle: lifecycleEnum.singleton,
});
export default clearCreateResourceTabDataInjectable;
@@ -2,11 +2,13 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import { getInjectable } from "@ogre-tools/injectable";
import dockStoreInjectable from "../dock/store.injectable";
import { DockTabCreateSpecific, TabKind } from "../dock/store";
const createResourceTabInjectable = getInjectable({
id: "create-resource-tab",
instantiate: (di) => {
const dockStore = di.inject(dockStoreInjectable);
@@ -17,8 +19,6 @@ const createResourceTabInjectable = getInjectable({
kind: TabKind.CREATE_RESOURCE,
});
},
lifecycle: lifecycleEnum.singleton,
});
export default createResourceTabInjectable;
@@ -2,7 +2,7 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx";
import type { GroupSelectOption, SelectOption } from "../../select";
import userCreateResourceTemplatesInjectable from "./user-templates.injectable";
@@ -11,6 +11,8 @@ import lensCreateResourceTemplatesInjectable from "./lens-templates.injectable";
export type RawTemplates = [group: string, items: [file: string, contents: string][]];
const createResourceTemplatesInjectable = getInjectable({
id: "create-resource-templates",
instantiate: async (di) => {
const lensResourceTemplates = await di.inject(lensCreateResourceTemplatesInjectable);
const userResourceTemplates = di.inject(userCreateResourceTemplatesInjectable);
@@ -27,8 +29,6 @@ const createResourceTemplatesInjectable = getInjectable({
}) as GroupSelectOption<SelectOption<string>>);
});
},
lifecycle: lifecycleEnum.singleton,
});
export default createResourceTemplatesInjectable;
@@ -2,7 +2,7 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import { getInjectable } from "@ogre-tools/injectable";
import path from "path";
import { hasCorrectExtension } from "./has-correct-extension";
import "../../../../common/vars";
@@ -33,6 +33,8 @@ async function getTemplates({ readDir, readFile }: Dependencies) {
}
const lensCreateResourceTemplatesInjectable = getInjectable({
id: "lens-create-resource-templates",
instantiate: async (di): Promise<RawTemplates> => {
const templates = await getTemplates({
readFile: di.inject(readFileInjectable),
@@ -41,8 +43,6 @@ const lensCreateResourceTemplatesInjectable = getInjectable({
return ["lens", templates];
},
lifecycle: lifecycleEnum.singleton,
});
export default lensCreateResourceTemplatesInjectable;
@@ -2,16 +2,16 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import { getInjectable } from "@ogre-tools/injectable";
import { CreateResourceTabStore } from "./store";
import createStorageInjectable from "../../../utils/create-storage/create-storage.injectable";
const createResourceTabStoreInjectable = getInjectable({
id: "create-resource-tab-store",
instantiate: (di) => new CreateResourceTabStore({
createStorage: di.inject(createStorageInjectable),
}),
lifecycle: lifecycleEnum.singleton,
});
export default createResourceTabStoreInjectable;
@@ -2,7 +2,7 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import { getInjectable } from "@ogre-tools/injectable";
import { computed, IComputedValue, observable } from "mobx";
import path from "path";
import os from "os";
@@ -95,8 +95,8 @@ function watchUserCreateResourceTemplates(): IComputedValue<RawTemplates[]> {
}
const userCreateResourceTemplatesInjectable = getInjectable({
id: "user-create-resource-templates",
instantiate: () => watchUserCreateResourceTemplates(),
lifecycle: lifecycleEnum.singleton,
});
export default userCreateResourceTemplatesInjectable;