-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace-domain.js
More file actions
39 lines (32 loc) · 1.36 KB
/
replace-domain.js
File metadata and controls
39 lines (32 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const fs = require('fs');
const path = require('path');
// CONFIGURA AQUI: DOMÍNIO ANTIGO E NOVO
const OLD_DOMAIN = 'checkout.snkhouse.com';
const NEW_DOMAIN = 'checkout.snkhouse.com';
// TIPOS DE ARQUIVOS QUE SERÃO ANALISADOS
const VALID_EXTENSIONS = ['.js', '.json', '.html', '.txt'];
function replaceInFile(filePath, oldText, newText) {
const content = fs.readFileSync(filePath, 'utf8');
if (content.includes(oldText)) {
const updated = content.split(oldText).join(newText);
fs.writeFileSync(filePath, updated, 'utf8');
console.log(`✅ Substituído em: ${filePath}`);
return true;
}
return false;
}
function scanAndReplace(dir, oldText, newText) {
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
scanAndReplace(fullPath, oldText, newText);
} else if (VALID_EXTENSIONS.includes(path.extname(entry.name))) {
replaceInFile(fullPath, oldText, newText);
}
}
}
console.log(`🚀 Substituindo "${OLD_DOMAIN}" por "${NEW_DOMAIN}" em arquivos...`);
scanAndReplace(__dirname, OLD_DOMAIN, NEW_DOMAIN);
console.log('🎯 Substituição finalizada com sucesso!');
console.log('⚠️ LEMBRETE DO INFERNO: Vá até o Render.com e atualize os ENV com o novo domínio e os novos tokens, SENÃO ESSA PORRA VAI DAR PAU.');