mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fully convert ExtensionDiscovery to be injectable
- To fix unit tests Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
7f86a89cc2
commit
ac6e3e18e2
57 files changed
+878
-1013
No files matched your search
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import copyInjectable from "./copy.injectable";
|
||||
|
||||
export default getGlobalOverride(copyInjectable, () => async () => {
|
||||
throw new Error("tried to copy filepaths without override");
|
||||
});
|
||||
+2
-5
@@ -7,12 +7,9 @@ import fsInjectable from "./fs.injectable";
|
||||
|
||||
export type EnsureDirectory = (dirPath: string) => Promise<void>;
|
||||
|
||||
const ensureDirInjectable = getInjectable({
|
||||
const ensureDirectoryInjectable = getInjectable({
|
||||
id: "ensure-dir",
|
||||
|
||||
// TODO: Remove usages of ensureDir from business logic.
|
||||
// TODO: Read, Write, Watch etc. operations should do this internally.
|
||||
instantiate: (di): EnsureDirectory => di.inject(fsInjectable).ensureDir,
|
||||
});
|
||||
|
||||
export default ensureDirInjectable;
|
||||
export default ensureDirectoryInjectable;
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import lstatInjectable from "./lstat.injectable";
|
||||
|
||||
export default getGlobalOverride(lstatInjectable, () => async () => {
|
||||
throw new Error("tried to lstat a filepath without override");
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import readDirectoryInjectable from "./read-directory.injectable";
|
||||
|
||||
export default getGlobalOverride(readDirectoryInjectable, () => async () => {
|
||||
throw new Error("tried to read a directory's content without override");
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import removePathInjectable from "./remove.injectable";
|
||||
|
||||
export default getGlobalOverride(removePathInjectable, () => async () => {
|
||||
throw new Error("tried to remove path without override");
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import writeFileInjectable from "./write-file.injectable";
|
||||
|
||||
export default getGlobalOverride(writeFileInjectable, () => async () => {
|
||||
throw new Error("tried to write file without override");
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
export const extensionDiscoveryStateChannel = "extension-discovery:state";
|
||||
@@ -4,4 +4,4 @@
|
||||
*/
|
||||
|
||||
// @experimental
|
||||
export { bundledExtensionInjectionToken } from "../extensions/extension-discovery/bundled-extension-token";
|
||||
export { bundledExtensionInjectionToken } from "../features/extensions/common/bundled-extension-token";
|
||||
@@ -5,8 +5,8 @@
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
export interface SyncBox<Value> {
|
||||
id: string;
|
||||
value: IComputedValue<Value>;
|
||||
readonly id: string;
|
||||
readonly value: IComputedValue<Value>;
|
||||
set: (value: Value) => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ export const defaultFontSize = 12;
|
||||
export const defaultTerminalFontFamily = "RobotoMono";
|
||||
export const defaultEditorFontFamily = "RobotoMono";
|
||||
|
||||
export const manifestFilename = "package.json";
|
||||
|
||||
// Apis
|
||||
export const apiPrefix = "/api"; // local router apis
|
||||
export const apiKubePrefix = "/api-kube"; // k8s cluster apis
|
||||
|
||||
Reference in new issue
Block a user