mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove options from writeJsonFile for YAGNI
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
5567b0df30
commit
b7297e28b2
@ -13,19 +13,12 @@ interface Dependencies {
|
|||||||
ensureDir: (dir: string, options?: EnsureOptions | number) => Promise<void>;
|
ensureDir: (dir: string, options?: EnsureOptions | number) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const writeJsonFile = ({ writeJson, ensureDir }: Dependencies) => async (filePath: string, content: JsonValue, options?: WriteOptions | BufferEncoding) => {
|
const writeJsonFile = ({ writeJson, ensureDir }: Dependencies) => async (filePath: string, content: JsonValue) => {
|
||||||
await ensureDir(path.dirname(filePath), { mode: 0o755 });
|
await ensureDir(path.dirname(filePath), { mode: 0o755 });
|
||||||
|
|
||||||
const resolvedOptions = typeof options === "string"
|
|
||||||
? {
|
|
||||||
encoding: options,
|
|
||||||
}
|
|
||||||
: options;
|
|
||||||
|
|
||||||
await writeJson(filePath, content, {
|
await writeJson(filePath, content, {
|
||||||
encoding: "utf-8",
|
encoding: "utf-8",
|
||||||
spaces: 2,
|
spaces: 2,
|
||||||
...resolvedOptions,
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user