diff --git a/src/LayerCache.ts b/src/LayerCache.ts index f64f4a45..01f3be67 100644 --- a/src/LayerCache.ts +++ b/src/LayerCache.ts @@ -347,9 +347,9 @@ class LayerCache { async getLayerTarFiles(): Promise { const getTarFilesFromManifest = (manifest: Manifest) => manifest.Layers; - const tarFilesThatMayDuplicate = (await this.getManifests()).flatMap( - getTarFilesFromManifest - ); + const tarFilesThatMayDuplicate: string = ( + await this.getManifests() + ).flatMap(getTarFilesFromManifest); const tarFiles = [...new Set(tarFilesThatMayDuplicate)]; return tarFiles; } diff --git a/src/Tar.ts b/src/Tar.ts index 9602cacd..11a95042 100644 --- a/src/Tar.ts +++ b/src/Tar.ts @@ -1,26 +1,20 @@ -import { assertType } from 'typescript-is' -import { promises as fs } from 'fs' -import * as path from 'path' +import { promises as fs } from "fs"; +import * as path from "path"; export interface Manifest { - Config: string - RepoTags: string[] | null - Layers: string[] + Config: string; + RepoTags: string[] | null; + Layers: string[]; } -export type Manifests = Manifest[] - -export function assertManifests(x: unknown): asserts x is Manifests { - assertType(x) -} +export type Manifests = Manifest[]; export async function loadRawManifests(rootPath: string) { - return (await fs.readFile(path.join(rootPath, `manifest.json`))).toString() + return (await fs.readFile(path.join(rootPath, `manifest.json`))).toString(); } export async function loadManifests(path: string) { - const raw = await loadRawManifests(path) - const manifests = JSON.parse(raw.toString()) - assertManifests(manifests) - return manifests + const raw = await loadRawManifests(path); + const manifests = JSON.parse(raw.toString()); + return manifests; }