forked from Acode-Foundation/Acode
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathupdateAce.js
More file actions
45 lines (36 loc) · 1.16 KB
/
updateAce.js
File metadata and controls
45 lines (36 loc) · 1.16 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
40
41
42
43
44
45
const fs = require("node:fs");
const path = require("node:path");
const sourceDir = "./ace-builds/src-min";
const destDir = "./www/js/ace";
function updateAce() {
try {
// Remove existing destination directory if it exists
if (fs.existsSync(destDir)) {
fs.rmSync(destDir, { recursive: true });
console.log("Removed existing destination directory");
}
// Create destination directory
fs.mkdirSync(destDir, { recursive: true });
console.log("Created new destination directory");
// Read all files from source directory
const files = fs.readdirSync(sourceDir);
files.forEach((file) => {
const sourcePath = path.join(sourceDir, file);
const destPath = path.join(destDir, file);
// Skip snippets directory and worker files
if (file === "snippets" || file.startsWith("worker-")) {
console.log(`Skipping: ${file}`);
return;
}
// Copy if it's a file
if (fs.statSync(sourcePath).isFile()) {
fs.copyFileSync(sourcePath, destPath);
console.log(`Copied: ${file}`);
}
});
console.log("Ace editor files updated successfully!");
} catch (error) {
console.error("Error updating Ace editor files:", error);
}
}
updateAce();