@contextvm/ctxcn
Version:
A command-line utility inspired by shadcn that streamlines the integration of ContextVM (CVM) servers into your TypeScript projects
25 lines • 651 B
JavaScript
import { promises as fs } from "fs";
import path from "path";
export async function ensureDirectoryExists(dirPath) {
try {
await fs.access(dirPath);
}
catch (error) {
await fs.mkdir(dirPath, { recursive: true });
}
}
export async function fileExists(filePath) {
try {
await fs.access(filePath);
return true;
}
catch (error) {
return false;
}
}
export async function writeFileWithDir(filePath, content) {
const dir = path.dirname(filePath);
await ensureDirectoryExists(dir);
await fs.writeFile(filePath, content, "utf-8");
}
//# sourceMappingURL=file-operations.js.map