Files
BoosAPI/desktop/libs/markstream-vue/scripts/build-workers-rollup.mjs
T
boos e0a5f57793 feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as
a monorepo subdirectory under desktop/. Source only — node_modules,
dist, Cargo target and the upstream .git history are excluded.

desktop/ keeps its own independent Cargo workspace (desktop/src-tauri
with crates/*); it is not part of the backend boosapi crate, so a
`cargo check` at the metapi root still compiles only the backend. Build
the desktop app from desktop/src-tauri per desktop/README.md.

Note: app icons are still placeholder assets pending the final BoosAPI
logo. The updater signing keys live outside the repo and are not
included.
2026-06-22 11:32:57 +08:00

48 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
import fs from 'node:fs'
import path from 'node:path'
import process from 'node:process'
import typescript from '@rollup/plugin-typescript'
import { rollup } from 'rollup'
const root = path.resolve(new URL(import.meta.url).pathname, '..', '..')
const outdir = path.resolve(root, 'dist', 'workers')
async function buildWorker(entry, outName) {
const bundle = await rollup({
input: entry,
external: ['mermaid', 'katex'],
plugins: [
typescript({ tsconfig: path.resolve(root, 'tsconfig.json'), sourceMap: false }),
],
})
await bundle.write({
dir: outdir,
format: 'es',
entryFileNames: outName,
chunkFileNames: '[name].js',
sourcemap: false,
})
await bundle.close()
}
async function run() {
try {
if (!fs.existsSync(outdir))
fs.mkdirSync(outdir, { recursive: true })
await buildWorker(path.resolve(root, 'src/workers/katexRenderer.worker.ts'), 'katexRenderer.worker.js')
await buildWorker(path.resolve(root, 'src/workers/mermaidParser.worker.ts'), 'mermaidParser.worker.js')
console.log('Workers written to', outdir)
}
catch (err) {
console.error('Failed to build workers with rollup', err)
process.exit(1)
}
}
run()