(source: string, path: string)
| 40 | }; |
| 41 | |
| 42 | const 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 | |
| 63 | const serializeManifest = (manifest: UpdateManifest): string => |
| 64 | [ |
no outgoing calls
no test coverage detected