Integrate flyfish CAD viewer

This commit is contained in:
2026-10-26 18:07:00 +08:00
parent e4eee1b3b7
commit e01c7eaecb
28 changed files with 560 additions and 5376 deletions
+27
View File
@@ -0,0 +1,27 @@
import fs from 'node:fs'
import path from 'node:path'
const source = path.join('node_modules', '@flyfish-dev', 'cad-viewer', 'dist', 'wasm')
const target = path.join('public', 'wasm')
const files = [
'dwg-worker.js',
'dwfv-render.wasm',
'libredwg-web.js',
'libredwg-web.wasm'
]
if (!fs.existsSync(source)) {
console.warn(`[cad-wasm] source not found: ${source}`)
process.exit(0)
}
fs.mkdirSync(target, { recursive: true })
for (const file of files) {
const from = path.join(source, file)
if (!fs.existsSync(from)) {
console.warn(`[cad-wasm] missing: ${from}`)
continue
}
fs.copyFileSync(from, path.join(target, file))
}
console.log(`[cad-wasm] copied ${files.length} runtime files to ${target}`)