summaryrefslogtreecommitdiff
path: root/apps/desktop/scripts/copy-web.mjs
blob: f5f6f4f6afa115c33e2708d40a758dab0b706611 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { cpSync, existsSync, rmSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

const desktopDir = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
const source = path.join(desktopDir, "..", "web", "out");
const target = path.join(desktopDir, "web");

if (!existsSync(source)) {
	process.stderr.write(
		`Web bundle not found at ${source}. Run \`bun build:web\` first.\n`,
	);
	process.exit(1);
}

rmSync(target, { recursive: true, force: true });
cpSync(source, target, { recursive: true });
process.stdout.write(`Copied ${source} -> ${target}\n`);