mirror of
https://github.com/withastro/astro.git
synced 2025-02-10 22:38:53 -05:00
* Upgraded nft * Handle monorepo better * Changeset * Fixed common ancestor * Fixed outdir
17 lines
553 B
TypeScript
17 lines
553 B
TypeScript
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 removeDir(dir: PathLike) {
|
|
await fs.rm(dir, { recursive: true, force: true, maxRetries: 3 });
|
|
}
|
|
|
|
export async function emptyDir(dir: PathLike): Promise<void> {
|
|
await removeDir(dir);
|
|
await fs.mkdir(dir, { recursive: true });
|
|
}
|
|
|
|
export const getVercelOutput = (root: URL) => new URL('./.vercel/output/', root);
|