Removed fs-extra dependency (#481)

* Removed `fs-extra` dependency

* use `fs/promises` consistently
This commit is contained in:
Mateusz Burzyński
2025-05-15 21:41:09 +02:00
committed by GitHub
parent 9f7e23e7ee
commit 0564b8428f
6 changed files with 23 additions and 28 deletions
+8
View File
@@ -1,6 +1,7 @@
import unified from "unified";
import remarkParse from "remark-parse";
import remarkStringify from "remark-stringify";
import fs from "node:fs/promises";
import type { Root } from "mdast";
// @ts-ignore
import mdastToString from "mdast-util-to-string";
@@ -105,3 +106,10 @@ export function isErrorWithCode(err: unknown, code: string) {
err.code === code
);
}
export function fileExists(filePath: string) {
return fs.access(filePath, fs.constants.F_OK).then(
() => true,
() => false
);
}