Skip to content

Commit

Permalink
Remove manifest check
Browse files Browse the repository at this point in the history
  • Loading branch information
jpribyl committed Dec 2, 2022
1 parent 7012290 commit 47f2bd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/LayerCache.ts
Expand Up @@ -347,9 +347,9 @@ class LayerCache {
async getLayerTarFiles(): Promise<string[]> {
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;
}
Expand Down
26 changes: 10 additions & 16 deletions 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<Manifests>(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;
}

0 comments on commit 47f2bd3

Please sign in to comment.