import { assertType } from 'typescript-is' ; import { promises as fs } from 'fs' ; import * as path from 'path' ; export interface Manifest { Config : string ; RepoTags : string [ ] | null ; Layers : string [ ] ; } export type Manifests = Manifest [ ] ; export function assertManifests ( x ) { assertType < Manifests > ( x ) ; } export async function loadRawManifests ( rootPath ) { return ( await fs . readFile ( path . join ( rootPath , `manifest.json` ) ) ) . toString ( ) ; } export async function loadManifests ( path ) { const raw = await loadRawManifests ( path ) ; const manifests = JSON . parse ( raw . toString ( ) ) ; assertManifests ( manifests ) ; return manifests ; }