MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseManifest

Function parseManifest

scripts/merge-latest-mac-yml.ts:42–61  ·  view source on GitHub ↗
(source: string, path: string)

Source from the content-addressed store, hash-verified

40};
41
42const parseManifest = (source: string, path: string): UpdateManifest => {
43 const raw = Bun.YAML.parse(source) as Record<string, unknown>;
44 const files = Array.isArray(raw["files"]) ? raw["files"].filter(isUpdateFileEntry) : [];
45 if (
46 typeof raw["version"] !== "string" ||
47 typeof raw["path"] !== "string" ||
48 typeof raw["sha512"] !== "string" ||
49 typeof raw["releaseDate"] !== "string" ||
50 files.length === 0
51 ) {
52 throw new Error(`Unrecognized electron-builder update manifest at ${path}`);
53 }
54 return {
55 version: raw["version"],
56 files,
57 path: raw["path"],
58 sha512: raw["sha512"],
59 releaseDate: raw["releaseDate"],
60 };
61};
62
63const serializeManifest = (manifest: UpdateManifest): string =>
64 [

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected