@t1mmen/srtd
Version:
Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀
16 lines • 568 B
JavaScript
import fs from 'node:fs/promises';
import path from 'node:path';
import { fileExists } from './fileExists.js';
export async function safeCreate(filepath, content) {
// Create directory structure if needed
const dir = path.dirname(filepath);
await fs.mkdir(dir, { recursive: true });
if (await fileExists(filepath)) {
// If file exists, overwrite it rather than skipping
await fs.writeFile(filepath, content);
return true;
}
await fs.writeFile(filepath, content);
return true;
}
//# sourceMappingURL=safeCreate.js.map