diff --git a/src/util/extract-tar-gz.ts b/src/util/extract-tar-gz.ts index cbf141c..c87000b 100644 --- a/src/util/extract-tar-gz.ts +++ b/src/util/extract-tar-gz.ts @@ -1,7 +1,7 @@ import { logFatal } from "../util/util"; import * as tar from "tar"; import { resolve, join } from "path"; -import { existsSync } from "fs"; +import { existsSync, mkdirSync } from "fs"; const requiredFiles = ["index.html", "nomo_icon.svg", "nomo_manifest.json"]; const cacheDirectory = "./cache"; @@ -12,6 +12,11 @@ export async function extractAndCache(args: { }) { const { tarFilePath, destinationDir = cacheDirectory } = args; + if (!existsSync(destinationDir)) { + console.log(`Creating cache directory: ${destinationDir}`); + mkdirSync(destinationDir); + } + try { await tar.x({ file: tarFilePath,