新增兼容层,适配WebCAD v16材质版本

This commit is contained in:
CZY committed 2026-10-28 15:06:27 +08:00
1 parent ae9d88c6d7
commit fc94b6721a
10 files changed
+516 -29

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { build } from "vite";
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { spawnSync } from "node:child_process";
const directory = await mkdtemp(join(tmpdir(), "material-editor-test-"));
try {
await build({
configFile: false,
logLevel: "warn",
define: { "process.env.NODE_ENV": '"production"' },
build: {
target: "esnext",
outDir: directory,
emptyOutDir: false,
minify: false,
lib: { entry: "tests/MaterialSerializer.test.ts", formats: ["es"], fileName: () => "tests.mjs" },
rollupOptions: { external: ["node:test", "node:assert/strict"] },
},
});
const result = spawnSync(process.execPath, ["--test", join(directory, "tests.mjs")], { stdio: "inherit" });
if (result.error) throw result.error;
process.exitCode = result.status ?? 1;
} finally {
await rm(directory, { recursive: true, force: true });
}