import { readFile, writeFile, unlink, copyFile, mkdir, stat, readdir, access, } from 'node:fs/promises' import pkgJson from '../../package.json' with { type: 'json' } export const readFileAsync = readFile export const writeFileAsync = writeFile export const unlinkAsync = unlink export const copyFileAsync = copyFile export const mkdirAsync = mkdir export const statAsync = stat export const readdirAsync = readdir export function fileExists(path: string): Promise { return access(path).then( () => true, () => false, ) } export async function dirExistsAsync(path: string) { try { const stats = await statAsync(path) return stats.isDirectory() } catch { return false } } export const CLI_VERSION = pkgJson.version