Web CAD: preserve the existing VibeMake platform integration
Recover the ZIP snapshot baseline at 147b4049cf from 6616 matching files and the archive timestamp. Preserve the existing browser assistant, host workspace bridge, theme, translations, and integration documents before updating upstream.
Generated validation media and logs remain in a local backup. The initial cargo xtask ci run stopped at those local media files lacking attribution; the integrated source tree will be checked after the upstream merge.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
// Independent Rust/WASM artifact. No fallback or alternate geometry kernel.
|
||||
import { createHash } from 'node:crypto';
|
||||
import { mkdirSync, readFileSync, readdirSync, cpSync, writeFileSync, existsSync } from 'node:fs';
|
||||
import { resolve, relative, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
const root = resolve(fileURLToPath(new URL('..', import.meta.url)));
|
||||
const raw = join(root, 'target/vibemake-cad-raw');
|
||||
const destination = resolve(process.env.VIBEMAKE_CAD_ENGINE_OUT || join(root, 'dist/vibemake-cad-engine'));
|
||||
execFileSync('trunk', ['build', '--release', '--dist', raw], { cwd: join(root, 'apps/solidcraft-web'), stdio: 'inherit' });
|
||||
const walk = (directory) => readdirSync(directory, { withFileTypes: true }).flatMap((entry) => entry.isDirectory() ? walk(join(directory, entry.name)) : [join(directory, entry.name)]);
|
||||
const selected = walk(raw).filter((file) => /\.(js|wasm|ttf|otf|txt)$/i.test(file) && !file.endsWith('/sw.js')).sort();
|
||||
const js = selected.find((file) => /solidcraft-web.*\.js$/.test(file));
|
||||
const wasm = selected.find((file) => /solidcraft-web.*_bg\.wasm$/.test(file));
|
||||
const font = selected.find((file) => file.endsWith('/CraftUI-SC.otf'));
|
||||
if (!js || !wasm || !font) throw new Error('Engine JS, WASM or Chinese font is missing');
|
||||
const digest = (file) => createHash('sha256').update(readFileSync(file)).digest('hex');
|
||||
const buildId = createHash('sha256').update(selected.map((file) => `${relative(raw, file)}:${digest(file)}`).join('\n')).digest('hex').slice(0, 24);
|
||||
const prefix = `/cad/_assets/${buildId}/`;
|
||||
const files = selected.map((file) => ({ path: prefix + relative(raw, file).replaceAll('\\', '/'), size: readFileSync(file).length, sha256: digest(file) }));
|
||||
for (const file of selected) { const out = join(destination, '_assets', buildId, relative(raw, file)); mkdirSync(resolve(out, '..'), { recursive: true }); cpSync(file, out); }
|
||||
const manifest = { bridgeVersion: 1, engineKind: 'solidcraft', buildId, builtAt: new Date().toISOString(), kernel: 'smlib',
|
||||
js: prefix + relative(raw, js), wasm: prefix + relative(raw, wasm), chineseFont: prefix + relative(raw, font), files };
|
||||
mkdirSync(destination, { recursive: true }); writeFileSync(join(destination, 'engine.json'), JSON.stringify(manifest, null, 2) + '\n');
|
||||
if (!existsSync(join(destination, '_assets', buildId))) throw new Error('Engine output failed');
|
||||
console.log(`VIBEMAKE_CAD_ENGINE_DIST=${destination}`);
|
||||
Reference in New Issue
Block a user