Create the cache dir path if not exist

This commit is contained in:
Joseph Garrone 2024-05-18 09:00:57 +02:00
parent a2563f0b7d
commit 49eae307cd

View File

@ -2,7 +2,7 @@ import { getLatestsSemVersionedTagFactory } from "../tools/octokit-addons/getLat
import { Octokit } from "@octokit/rest";
import cliSelect from "cli-select";
import { SemVer } from "../tools/SemVer";
import { join as pathJoin } from "path";
import { join as pathJoin, dirname as pathDirname } from "path";
import * as fs from "fs";
import type { ReturnType } from "tsafe";
import { id } from "tsafe/id";
@ -55,6 +55,14 @@ export async function promptKeycloakVersion(params: { startingFromMajor: number
"repo": "keycloak"
});
{
const dirPath = pathDirname(cacheFilePath);
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath, { "recursive": true });
}
}
fs.writeFileSync(
cacheFilePath,
JSON.stringify(