Files
hd4k-downloader/frontend/build.js
T
2026-10-11 12:56:38 +08:00

26 lines
923 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 前端「构建」:本项目无框架、无打包步骤,纯静态文件直接拷贝。
//
// 之所以还留这个脚本:Wails 的 embed 指向 frontend/dist,
// 需要一个入口把源码同步进去。顺带避免手工拷贝漏文件。
const fs = require('fs');
const path = require('path');
const FRONTEND = __dirname;
const DIST = path.join(FRONTEND, 'dist');
// 需要原样拷贝的入口文件与目录(wailsjs 不用拷 —— 那是 wails build 自动生成的绑定)
const ENTRIES = ['index.html', 'css', 'js'];
function copy() {
fs.mkdirSync(DIST, { recursive: true });
for (const name of ENTRIES) {
const src = path.join(FRONTEND, name);
if (!fs.existsSync(src)) continue;
fs.rmSync(path.join(DIST, name), { recursive: true, force: true });
fs.cpSync(src, path.join(DIST, name), { recursive: true });
}
console.log('[frontend] 资源已同步到 dist/');
}
copy();