14 lines
804 B
JavaScript
14 lines
804 B
JavaScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const root = path.dirname(new URL(import.meta.url).pathname);
|
|
const packageJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
const runtimePackages = Object.keys(packageJson.dependencies ?? {});
|
|
for (const name of runtimePackages) {
|
|
const packagePath = path.join(root, "node_modules", ...name.split("/"));
|
|
if (!fs.existsSync(packagePath)) throw new Error(`runtime dependency is not installed locally: ${name}`);
|
|
}
|
|
if (runtimePackages.includes("three")) throw new Error("Three.js must use the vendored project copy");
|
|
if (packageJson.dependencies?.["@sqlite.org/sqlite-wasm"]) throw new Error("SQLite WASM is not a current runtime dependency");
|
|
console.log(`runtime-deps-local packages=${runtimePackages.join(",")}`);
|