import * as fs from 'fs'; import * as path from 'path'; function replaceStone(filePath: string) { let content = fs.readFileSync(filePath, 'utf8'); let original = content; content = content.replace(/zinc-/g, "stone-"); if (content !== original) { fs.writeFileSync(filePath, content, 'utf8'); console.log('Updated stone in ' + filePath); } } function processDirectory(dir: string) { const files = fs.readdirSync(dir); for (const file of files) { const fullPath = path.join(dir, file); const stat = fs.statSync(fullPath); if (stat.isDirectory()) { processDirectory(fullPath); } else if (fullPath.endsWith('.tsx') || fullPath.endsWith('.ts')) { replaceStone(fullPath); } } } processDirectory('./src');