mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Fix cluster frame display issue - Add some defensive code to prevent this sort of infinite loop - Add some unit tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix unit tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix build Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * Factor out injectable for getting of cluster config data Signed-off-by: Sebastian Malton <sebastian@malton.name>
20 lines
578 B
TypeScript
20 lines
578 B
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable } from "@ogre-tools/injectable";
|
|
import fsInjectable from "./fs.injectable";
|
|
|
|
export type ReadFileSync = (filePath: string) => string;
|
|
|
|
const readFileSyncInjectable = getInjectable({
|
|
id: "read-file-sync",
|
|
instantiate: (di): ReadFileSync => {
|
|
const { readFileSync } = di.inject(fsInjectable);
|
|
|
|
return (filePath) => readFileSync(filePath, "utf-8");
|
|
},
|
|
});
|
|
|
|
export default readFileSyncInjectable;
|