-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
47 lines (38 loc) · 1.26 KB
/
build.js
File metadata and controls
47 lines (38 loc) · 1.26 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
46
47
// build.js - Handles TypeScript compilation + copying renderer assets
const { execSync } = require("child_process");
const fs = require("fs");
const path = require("path");
console.log("🔨 Building Local Copilot...\n");
// 1. Compile TypeScript
console.log("📦 Compiling TypeScript...");
try {
execSync("npx tsc", { stdio: "inherit" });
console.log("✅ TypeScript compiled\n");
} catch {
console.error("❌ TypeScript compilation failed");
process.exit(1);
}
// 2. Copy renderer folder (HTML + JS + CSS)
console.log("📄 Copying renderer files...");
function copyDir(src, dest) {
fs.mkdirSync(dest, { recursive: true });
for (const entry of fs.readdirSync(src)) {
const srcPath = path.join(src, entry);
const destPath = path.join(dest, entry);
if (fs.statSync(srcPath).isDirectory()) {
copyDir(srcPath, destPath);
} else {
fs.copyFileSync(srcPath, destPath);
}
}
}
try {
const rendererSrc = path.join(__dirname, "app", "renderer");
const rendererDest = path.join(__dirname, "dist", "renderer");
copyDir(rendererSrc, rendererDest);
console.log("✅ Renderer files copied\n");
} catch (error) {
console.error("❌ Failed to copy renderer files:", error.message);
process.exit(1);
}
console.log("✨ Build complete!\n");