fix: build id mismatch between CI + deploy (#1681)

This commit is contained in:
Marvin Hagemeister
2023-08-28 12:49:49 +02:00
committed by GitHub
parent fb6d11747b
commit efcaa2dee2
7 changed files with 67 additions and 15 deletions
+8 -3
View File
@@ -2,6 +2,8 @@ import { ServerContext } from "../server/context.ts";
import { FreshOptions, Manifest } from "../server/mod.ts";
import { dirname, fromFileUrl, join, toFileUrl } from "../server/deps.ts";
import { fs } from "./deps.ts";
import { BuildSnapshotJson } from "../build/mod.ts";
import { BUILD_ID } from "$fresh/src/server/build_id.ts";
export async function build(
manifestPath: string,
@@ -32,12 +34,15 @@ export async function build(
}));
// Write dependency snapshot file to disk
const deps: Record<string, string[]> = {};
const jsonSnapshot: BuildSnapshotJson = {
build_id: BUILD_ID,
files: {},
};
for (const filePath of snapshot.paths) {
const dependencies = snapshot.dependencies(filePath);
deps[filePath] = dependencies;
jsonSnapshot.files[filePath] = dependencies;
}
const snapshotPath = join(outDir, "snapshot.json");
await Deno.writeTextFile(snapshotPath, JSON.stringify(deps, null, 2));
await Deno.writeTextFile(snapshotPath, JSON.stringify(jsonSnapshot, null, 2));
}