From 47f2bd3748b3fb9e7b6e73a704f13260f8cae3c5 Mon Sep 17 00:00:00 2001 From: johnny Date: Fri, 2 Dec 2022 14:08:09 -0700 Subject: [PATCH] Remove manifest check --- src/LayerCache.ts | 6 +++--- src/Tar.ts | 26 ++++++++++---------------- 2 files changed, 13 insertions(+), 19 deletions(-) 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; }