feat: validate published static asset release inputs and document custom domain rollback behavior

This commit is contained in:
Matthew Meszaros
2026-11-03 16:34:35 +01:00
parent 6e4de3c636
commit 20a715969e
4 changed files with 29 additions and 5 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ export function prepareStaticAssets({ target, sourceRoot, destination, sourceSha
}
}
check(output);
if (!existsSync(join(output, "index.html")) || !existsSync(join(output, "_headers"))) throw new Error("Frontend index and response headers required");
const isRegularFile = (name) => existsSync(join(output, name)) && lstatSync(join(output, name)).isFile();
if (!isRegularFile("index.html") || !isRegularFile("_headers")) throw new Error("Frontend index and response headers required");
if (existsSync(join(output, "_worker.js")) || existsSync(join(output, "_routes.json"))) throw new Error("Only static artifacts are supported");
mkdirSync(dest, { recursive: true });
cpSync(output, join(dest, "assets"), { recursive: true });
@@ -75,3 +75,12 @@ test("changed admin redirect behavior requires explicit review", () => {
assert.throws(() => prepareStaticAssets({ target, sourceRoot: root, destination, sourceSha: sha, release: "v0.6.74" }));
});
});
test("requires regular frontend entrypoint and response header files", () => {
for (const name of ["index.html", "_headers"]) fixture("web", ({ root, target, output, destination }) => {
rmSync(join(output, name));
mkdirSync(join(output, name));
assert.throws(() => prepareStaticAssets({ target, sourceRoot: root, destination, sourceSha: sha, release: "v0.6.74" }), /Frontend index and response headers required/);
assert.equal(existsSync(destination), false);
});
});