geometria3d-lab / source /scripts /postbuild.mjs
Segizu's picture
Geometría 3D Lab v1: MoGe-2 ViT-S en el navegador (medidas 3D métricas)
ab0a0fc verified
Raw History Blame Contribute Delete
971 Bytes
// Ensambla la carpeta desplegable (dist/): app compilada + docs + copia del código fuente.
import { cpSync, mkdirSync, rmSync, existsSync } from 'node:fs';
const r = (p) => new URL('../' + p, import.meta.url).pathname;
for (const f of ['README.md', 'NOTICE', 'LICENSE', 'BROWSER_CHECKLIST.md']) if (existsSync(r(f))) cpSync(r(f), r('dist/' + f));
rmSync(r('dist/source'), { recursive: true, force: true });
mkdirSync(r('dist/source'), { recursive: true });
for (const f of ['src', 'tests', 'scripts', 'package.json', 'package-lock.json', 'vite.config.js', 'index.html', 'README.md', 'NOTICE', 'LICENSE', 'BROWSER_CHECKLIST.md'])
if (existsSync(r(f))) cpSync(r(f), r('dist/source/' + f), { recursive: true });
cpSync(r('public'), r('dist/source/public'), { recursive: true, filter: (p) => !p.includes('/public/wasm') });
// el bundle de vite ya incluye su propia copia del .wasm en assets/ si lo referencia; nos quedamos con public/wasm
console.log('dist assembled');