-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-node.js
41 lines (34 loc) · 1.11 KB
/
compile-node.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
const fs = require("fs")
const path = require("path")
const excludeFolders = ["dts", "node_modules", ".vscode"];
const excludedExts = [".map", ".ts", ".scss", "tsconfig.json", "package.json", "package-lock.json", "yarn.lock"];
function copyExclude(src, dest) {
var exists = fs.existsSync(src);
var stats = exists && fs.statSync(src);
var isDirectory = exists && stats.isDirectory();
if (isDirectory) {
if (excludeFolders.find(q => src.toLowerCase().endsWith(q))) {
console.log("Skipping folder: " + src);
return;
}
fs.mkdirSync(dest);
fs.readdirSync(src).forEach(function (childItemName) {
copyExclude(path.join(src, childItemName),
path.join(dest, childItemName));
});
} else {
if (excludedExts.find(q => src.toLowerCase().endsWith(q))) {
console.log("Skipping: " + src);
return;
}
fs.copyFileSync(src, dest);
}
};
const src = ".\\ChromeExt";
const dest = ".\\bin";
try {
fs.rmdirSync(dest, {
recursive: true,
});
} catch (e) { }
copyExclude(src, dest);