INNER CODE UNIT · TypeScript
ensureBuildArtifacts
SveltyCMS/SveltyCMS · scripts/benchmark-matrix/index.ts:699
const ensureBuildArtifacts = () => {
if (NO_BUILD) return; // --no-build: trust the existing production build
const handler = path.join(process.cwd(), "build", "handler.js");
const adapterEntry = path.join(process.cwd(), "build", "index.js");
const yjs = path.join(process.cwd(), "build", "yjs-sync-server.js");
const needsHandler = !fs.existsSync(handler);
const needsAdapter = !fs.existsSync(adapterEntry);
const needsYjs = serverEntry.endsWith("index.cjs") && !fs.existsSync(yjs);
// Detect deploy-stripped builds (testing backdoor removed)
let stripped = false;
if (fs.existsSync(handler)) {
try {
const sample = fs.readFileSync(handler, "utf8");
stripped =
sample.includes("SVELTY_TEST_BACKDOOR_STRIPPED") ||
sample.includes("virtual:test-noop");
} catch {
/* ignore */