-
Notifications
You must be signed in to change notification settings - Fork 23
/
setup.js
50 lines (46 loc) · 1.15 KB
/
setup.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import fs from "fs";
import path from "path";
async function fileExists(filePath) {
try {
await fs.promises.access(filePath);
return true;
} catch {
return false;
}
}
async function copyFile(src, dest) {
try {
if (await fileExists(dest)) {
console.log(`File already exists at ${dest}, skipping copy.`);
} else {
await fs.promises.copyFile(src, dest);
console.log(`Copied ${src} to ${dest}`);
}
} catch (err) {
console.error(`Error copying file from ${src} to ${dest}:`, err);
}
}
const copyOperations = [
{
src: path.join("config", "config_tmp.js"),
dest: path.join("config", "config.js"),
},
{
src: path.join("config", "proxy_list_tmp.js"),
dest: path.join("config", "proxy_list.js"),
},
{
src: path.join("accounts", "accounts_tmp.js"),
dest: path.join("accounts", "accounts.js"),
},
];
(async () => {
console.log(`Copying Template File`);
for (let { src, dest } of copyOperations) {
await copyFile(src, dest);
}
console.log(`\nSetup Complete`);
console.log(
`Open and configure\n- accounts/accounts.js\n- config/config.js\n- config/proxy_list.js`
);
})();