forked from Bitcoindefi/OpenAO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy-assets.cjs
More file actions
33 lines (24 loc) · 837 Bytes
/
Copy pathcopy-assets.cjs
File metadata and controls
33 lines (24 loc) · 837 Bytes
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 path = require("path");
const root = path.resolve(__dirname, "..");
const dist = path.join(root, "dist");
const assets = ["jsons", "mapas_source"];
function copyRecursive(source, target) {
if (!fs.existsSync(source)) {
return;
}
fs.mkdirSync(target, { recursive: true });
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
const sourcePath = path.join(source, entry.name);
const targetPath = path.join(target, entry.name);
if (entry.isDirectory()) {
copyRecursive(sourcePath, targetPath);
continue;
}
fs.copyFileSync(sourcePath, targetPath);
}
}
for (const asset of assets) {
copyRecursive(path.join(root, asset), path.join(dist, asset));
}
console.log("Assets copied to dist/");