the editable site (validation-lab)
deploy / build-and-publish (push) Successful in 1m37s

This commit is contained in:
2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 changed files with 2227005 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
// Copies the locally installed @sveltia/cms bundle into public/admin so
// the CMS page is fully self-hosted: the site bakes the bundle into its
// static output and nothing loads from a CDN at runtime. The bundle
// references its per-backend chunks relative to itself, so the chunks
// tree rides along. Source maps and the ESM wrapper stay out — the
// admin page loads sveltia-cms.js with a plain script tag.
//
// NOTE: the package's "." export is the bundler API wrapper
// (npm/index.js), NOT the standalone browser bundle — the script tag
// always loads dist/sveltia-cms.js.
import { cpSync, rmSync, readdirSync } from "node:fs";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
const distDir = join(process.cwd(), "node_modules", "@sveltia/cms", "dist");
const destDir = join(fileURLToPath(new URL(".", import.meta.url)), "public", "admin");
// Only the build outputs are removed — index.html and config.yml live in
// this directory and are tracked in git.
for (const stale of ["sveltia-cms.js", "sveltia-cms.mjs", "chunks"]) {
rmSync(join(destDir, stale), { recursive: true, force: true });
}
for (const entry of readdirSync(distDir)) {
if (entry === "sveltia-cms.mjs" || entry.endsWith(".map")) continue;
cpSync(join(distDir, entry), join(destDir, entry), {
recursive: true,
filter: (src) => !src.endsWith(".map"),
});
}
console.log(`copied @sveltia/cms dist -> ${destDir}`);