Add project scripts and tooling
This commit is contained in:
26
tools/copy-cesium-assets.mjs
Normal file
26
tools/copy-cesium-assets.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
import { cpSync, existsSync, mkdirSync, rmSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
const candidateBuilds = [
|
||||
join(root, "node_modules", "cesium", "Build", "Cesium"),
|
||||
join(root, "web-test", "node_modules", "cesium", "Build", "Cesium"),
|
||||
];
|
||||
const cesiumBuild = candidateBuilds.find((value) => existsSync(value));
|
||||
const target = join(root, "web-test", "public", "cesium");
|
||||
|
||||
if (!cesiumBuild) {
|
||||
throw new Error("Cesium package is not installed. Run npm.cmd install first.");
|
||||
}
|
||||
|
||||
mkdirSync(target, { recursive: true });
|
||||
|
||||
for (const name of ["Assets", "ThirdParty", "Workers", "Widgets"]) {
|
||||
const source = join(cesiumBuild, name);
|
||||
const destination = join(target, name);
|
||||
rmSync(destination, { recursive: true, force: true });
|
||||
cpSync(source, destination, { recursive: true });
|
||||
}
|
||||
|
||||
console.log(`Copied Cesium runtime assets to ${target}`);
|
||||
Reference in New Issue
Block a user