-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (26 loc) · 846 Bytes
/
index.js
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
const fs = require("fs");
const { exit } = require("process");
const originDomain = "origin-pragmaticplay.net";
(async () => {
const newDomain = process.argv[2];
if (!newDomain) {
console.log("No domain input");
exit();
}
let files = fs.readdirSync("./");
let cnt = 1;
for (const file of files) {
if (!isNaN(Number(file.split("-")[0]))) {
++cnt;
}
}
let newDir = "./" + cnt + "-" + newDomain;
fs.mkdirSync(newDir);
files = fs.readdirSync("./src");
for (const file of files) {
const content = fs.readFileSync("./src/" + file, 'utf-8');
const newContent = content.replaceAll(originDomain, newDomain);
const newFile = file.replace(originDomain, newDomain);
fs.writeFileSync(newDir + "/" + newFile, newContent);
}
})();