1
0
Files
kobopatch-webui/electron/copy-dist.mjs
Nico Verbruggen b117f3290b Make Electron build
I historically have never liked Electron, and I don't like it now, but
unfortunately due to poor browser support, I don't have a choice to
ship anything more lightweight if I want to use the Filesystem API
as part of the packaged build, which is kind of the point.

I guess it's true:
"You either die a hero or you live long enough to become the villain."

This is an experimental build.
2026-03-22 13:47:54 +01:00

17 lines
531 B
JavaScript

import { cpSync, rmSync, existsSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const dir = dirname(fileURLToPath(import.meta.url));
const src = join(dir, '..', 'web', 'dist');
const dst = join(dir, 'dist');
if (!existsSync(src)) {
console.error('web/dist/ does not exist — run "cd web && npm run build" first.');
process.exit(1);
}
rmSync(dst, { recursive: true, force: true });
cpSync(src, dst, { recursive: true });
console.log(`Copied ${src} -> ${dst}`);