feat(globe): port to CeliumJS
This commit is contained in:
parent
ec03425067
commit
eb7698e034
51 changed files with 3521 additions and 1992 deletions
24
scripts/copy-cesium.js
Normal file
24
scripts/copy-cesium.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Copies Cesium's runtime assets into static/ so they are served at /cesium/.
|
||||
// Cesium fetches Workers/Assets/Widgets/ThirdParty at runtime by URL (see
|
||||
// CESIUM_BASE_URL in src/app.html); they cannot be bundled by Vite. static/ is
|
||||
// copied verbatim in both dev and build, so this needs no Vite plugin.
|
||||
// Regenerated on every `npm install` via the prepare script.
|
||||
import { cpSync, existsSync, mkdirSync, rmSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const src = join(root, 'node_modules', 'cesium', 'Build', 'Cesium');
|
||||
const dest = join(root, 'static', 'cesium');
|
||||
|
||||
if (!existsSync(src)) {
|
||||
console.error(`[copy-cesium] missing ${src} — is cesium installed?`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
rmSync(dest, { recursive: true, force: true });
|
||||
mkdirSync(dest, { recursive: true });
|
||||
for (const dir of ['Assets', 'ThirdParty', 'Widgets', 'Workers']) {
|
||||
cpSync(join(src, dir), join(dest, dir), { recursive: true });
|
||||
}
|
||||
console.log('[copy-cesium] assets copied to static/cesium/');
|
||||
Loading…
Add table
Add a link
Reference in a new issue