Import scripts/build-bundle.mjs

This commit is contained in:
QQ 2026-11-11 22:30:19 +08:00
parent 138fdadd1a
commit e4611ef294
1 changed files with 16 additions and 0 deletions

16
scripts/build-bundle.mjs Normal file
View File

@ -0,0 +1,16 @@
// Build step (runs last, after tsdown): assemble the merged host artifact.
// - lib/groups.js + lib/client.js come from tsdown.
// - lib/remote-ssh/index.js is the vendored upstream host half with the
// bundle's one local patch applied at build time (it must stay unbundled
// — see bundle/index.js — and the vendor tree stays pristine; see
// scripts/patch-remote-ssh.mjs).
// - lib/index.js is the composition entry from bundle/index.js.
import { copyFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'
import { writePatchedRemoteSsh } from './patch-remote-ssh.mjs'
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
writePatchedRemoteSsh(root)
copyFileSync(join(root, 'bundle/index.js'), join(root, 'lib/index.js'))
console.log('bundle assembled: lib/index.js (composition) + lib/groups.js + lib/remote-ssh/index.js (patched) + lib/client.js')