mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-12 12:53:20 +08:00
Ship uds-auth offline tgz without npm qrcode fetch (0.2.20).
Bundle qrcode SVG into lib/qrcode-bundled.cjs and drop the runtime dependency so Desktop field installs work without registry.npmjs.org. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
5b5c0a1418
commit
3ba4461566
7 changed files with 2131 additions and 15 deletions
35
uds-auth/scripts/bundle-qrcode.mjs
Normal file
35
uds-auth/scripts/bundle-qrcode.mjs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Bundle `qrcode` (SVG path) into lib/qrcode-bundled.cjs so Desktop tgz
|
||||
* installs need no npm registry fetch for dependencies.
|
||||
*
|
||||
* Usage: bun run scripts/bundle-qrcode.mjs
|
||||
*/
|
||||
import { mkdirSync, writeFileSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const entry = join(root, 'scripts', 'qrcode-entry.cjs')
|
||||
const out = join(root, 'lib', 'qrcode-bundled.cjs')
|
||||
|
||||
mkdirSync(dirname(out), { recursive: true })
|
||||
|
||||
const result = await Bun.build({
|
||||
entrypoints: [entry],
|
||||
outfile: out,
|
||||
target: 'node',
|
||||
format: 'cjs',
|
||||
sourcemap: 'none',
|
||||
minify: false,
|
||||
})
|
||||
|
||||
if (!result.success) {
|
||||
console.error(result.logs)
|
||||
throw new Error('bundle qrcode failed')
|
||||
}
|
||||
|
||||
// Bun may write via outfile; also ensure content if outputs differ.
|
||||
if (result.outputs[0]) {
|
||||
writeFileSync(out, await result.outputs[0].text(), 'utf8')
|
||||
}
|
||||
console.log(`wrote ${out}`)
|
||||
Loading…
Add table
Add a link
Reference in a new issue