import { cpSync, mkdirSync, rmSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const buildDir = path.join(rootDir, "build");

rmSync(buildDir, { recursive: true, force: true });
mkdirSync(buildDir, { recursive: true });

cpSync(path.join(rootDir, "src"), buildDir, { recursive: true });
cpSync(path.join(rootDir, "package.json"), path.join(buildDir, "package.json"));
cpSync(path.join(rootDir, "config.json"), path.join(buildDir, "config.json"));

console.log(`Server sources copied to ${buildDir}`);
