UNPKG

zonder

Version:

Ergonomic multi-chain indexing framework with dual runtime support for Ponder and Envio.

12 lines (11 loc) 487 B
import { existsSync, writeFileSync } from 'fs'; export function safeWriteFileSync(path, content, options = {}) { const { overwrite = false } = options; if (!overwrite && existsSync(path)) { console.warn(`⚠️ File already exists: ${path}`); console.warn(' Use --overwrite flag to overwrite existing files'); return; } writeFileSync(path, content); console.log(`✅ ${overwrite && existsSync(path) ? 'Overwrote' : 'Created'}: ${path}`); }