blob: d7a833cd08c11be77b7aebd560737fd53c7bdf5d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import type { PathLike } from 'node:fs';
import * as fs from 'node:fs/promises';
export async function writeJson<T>(path: PathLike, data: T) {
await fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' });
}
export async function emptyDir(dir: PathLike): Promise<void> {
await fs.rm(dir, { recursive: true, force: true, maxRetries: 3 });
await fs.mkdir(dir, { recursive: true });
}
export const getVercelOutput = (root: URL) => new URL('./.vercel/output/', root);
|