refactor: establish unified viewer workspaces

This commit is contained in:
2026-07-29 09:11:14 +09:00
parent bedb357259
commit 3279ac099e
27 changed files with 591 additions and 4483 deletions
+7 -3
View File
@@ -2,14 +2,16 @@
// runtime paths /draco/ and /basis/ resolve (version-matched to installed three).
// Also copies the web-ifc single-thread WASM to public/web-ifc/ for the IFC path.
// Runs automatically via `npm install` (postinstall). Safe to re-run.
import { cpSync, copyFileSync, existsSync, mkdirSync } from 'node:fs';
import { cpSync, copyFileSync, existsSync, mkdirSync, rmSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, '..');
const libs = resolve(root, 'node_modules/three/examples/jsm/libs');
const threeEntry = fileURLToPath(import.meta.resolve('three'));
const threeRoot = resolve(dirname(threeEntry), '..');
const libs = resolve(threeRoot, 'examples/jsm/libs');
const targets = [
[resolve(libs, 'draco/gltf'), resolve(root, 'public/draco')],
[resolve(libs, 'basis'), resolve(root, 'public/basis')],
@@ -25,13 +27,15 @@ for (const [src, dest] of targets) {
console.warn(`[copy-decoders] source missing: ${src}`);
continue;
}
rmSync(dest, { force: true, recursive: true });
mkdirSync(dest, { recursive: true });
cpSync(src, dest, { recursive: true });
console.log(`[copy-decoders] ${src} -> ${dest}`);
}
// web-ifc single-thread WASM (+ MT build if present) for the IFC load path.
const ifcSrcDir = resolve(root, 'node_modules/web-ifc');
const ifcEntry = fileURLToPath(import.meta.resolve('web-ifc'));
const ifcSrcDir = dirname(ifcEntry);
const ifcDest = resolve(root, 'public/web-ifc');
if (existsSync(ifcSrcDir)) {
mkdirSync(ifcDest, { recursive: true });