Next.js app that plays real .vpx tables via @valknar/vpinball-wasm (WebAssembly Visual Pinball). Demo mode with the bundled default table, drag-and-drop custom table upload, a cabinet-styled UI with a coin-door HUD (fullscreen/stats/info/eject), a custom 404 page, PWA support (hand-rolled service worker), and a static Docker Compose deployment behind nginx. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hQoM3jJT1Lx7CMTciMzvD
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
// Copies the vpinball-wasm engine's build output into public/vendor/vpinball-wasm/
|
|
// so it's served as plain static files (see lib/pinball/usePinballInstance.ts for why:
|
|
// the package's own loadPinball() does a dynamic import() of its glue script that must
|
|
// never pass through webpack's module graph).
|
|
import { cp, mkdir, rm } from "node:fs/promises";
|
|
import { existsSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const rootDir = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
const pkgDistDir = path.join(rootDir, "node_modules", "@valknar", "vpinball-wasm", "dist");
|
|
const targetDir = path.join(rootDir, "public", "vendor", "vpinball-wasm");
|
|
|
|
if (!existsSync(pkgDistDir)) {
|
|
console.error(
|
|
`vpinball-wasm not found at ${pkgDistDir} — run "pnpm install" first.`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
await rm(targetDir, { recursive: true, force: true });
|
|
await mkdir(targetDir, { recursive: true });
|
|
await cp(pkgDistDir, targetDir, { recursive: true });
|
|
|
|
console.log(`Copied vpinball-wasm engine assets to ${path.relative(rootDir, targetDir)}/`);
|