From 49eae307cd0d5de087b2dc166badae6d6a95d3ea Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sat, 18 May 2024 09:00:57 +0200 Subject: [PATCH] Create the cache dir path if not exist --- src/bin/shared/promptKeycloakVersion.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bin/shared/promptKeycloakVersion.ts b/src/bin/shared/promptKeycloakVersion.ts index d6945f12..c1a5e431 100644 --- a/src/bin/shared/promptKeycloakVersion.ts +++ b/src/bin/shared/promptKeycloakVersion.ts @@ -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(