Corretor_Imoveis/Template-02/replace.ts
2026-05-13 19:17:36 -03:00

29 lines
763 B
TypeScript

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');