fix: compatibility of fs-extra with esm (#4017)

This commit is contained in:
Vben
2024-08-03 09:49:46 +08:00
committed by GitHub
parent bf8a5ffb5d
commit 27ffc9e71b
11 changed files with 78 additions and 33 deletions

View File

@@ -1,4 +1,5 @@
import fs from 'fs-extra';
import fs from 'node:fs/promises';
import { format, getFileInfo, resolveConfig } from 'prettier';
async function prettierFormat(filepath: string) {
@@ -12,7 +13,7 @@ async function prettierFormat(filepath: string) {
parser: fileInfo.inferredParser as any,
});
if (output !== input) {
fs.writeFileSync(filepath, output, 'utf8');
await fs.writeFile(filepath, output, 'utf8');
}
return output;
}