Some checks are pending
Security Checks / security (push) Waiting to run
统一 frontend、backend、test、test-log 和 out 目录,更新构建、部署及测试入口;纳入配置管理兼容与首次安全引导修复;排除本机配置、密钥和测试产物。
17 lines
882 B
JavaScript
17 lines
882 B
JavaScript
import { cp, mkdir, readdir, readFile } from 'node:fs/promises'
|
||
import { fileURLToPath } from 'node:url'
|
||
import path from 'node:path'
|
||
|
||
const root = fileURLToPath(new URL('../', import.meta.url))
|
||
const plugin = process.argv[2] === 'telegram'
|
||
const source = path.join(root, 'out', ...(plugin ? ['plugins', 'telegram-ui'] : ['frontend']))
|
||
const target = path.join(root, ...(plugin ? ['plugins', 'pmail_telegram_push', 'hook', 'dist'] : ['backend', 'listen', 'http_server', 'dist']))
|
||
|
||
// Go 嵌入文件不能越过模块目录;这里仅同步构建中间文件,不保存运行数据。
|
||
await readFile(path.join(source, 'index.html'))
|
||
await mkdir(target, { recursive: true })
|
||
for (const entry of await readdir(source)) {
|
||
await cp(path.join(source, entry), path.join(target, entry), { recursive: true })
|
||
}
|
||
console.log('前端产物已生成至 out,并同步 Go 嵌入目录。')
|