From 785ed095bc9a3f18942ee2a59b9f664ac39adceb Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sun, 8 Sep 2024 14:41:45 +0200 Subject: [PATCH] Repatriate keycloak v24 scripts --- .../build/createPublicDotKeycloakifyDir.ts | 21 +++++++++++++++++++ .../shared/downloadKeycloakDefaultTheme.ts | 12 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/scripts/build/createPublicDotKeycloakifyDir.ts b/scripts/build/createPublicDotKeycloakifyDir.ts index 667124ea..b2e19d71 100644 --- a/scripts/build/createPublicDotKeycloakifyDir.ts +++ b/scripts/build/createPublicDotKeycloakifyDir.ts @@ -68,6 +68,27 @@ export async function createPublicDotKeycloakifyDir() { WELL_KNOWN_DIRECTORY_BASE_NAME.RESOURCES_COMMON ) }); + + copy_v24_js: { + if (themeType !== "login") { + break copy_v24_js; + } + + const { extractedDirPath } = await downloadKeycloakDefaultTheme({ + keycloakVersionId: "LAST_24" + }); + + transformCodebase({ + srcDirPath: pathJoin( + extractedDirPath, + "base", + "login", + "resources", + "js" + ), + destDirPath: pathJoin(destDirPath, "js", "v24") + }); + } }) ); } diff --git a/scripts/shared/downloadKeycloakDefaultTheme.ts b/scripts/shared/downloadKeycloakDefaultTheme.ts index 3681ccd4..f5678ce6 100644 --- a/scripts/shared/downloadKeycloakDefaultTheme.ts +++ b/scripts/shared/downloadKeycloakDefaultTheme.ts @@ -7,7 +7,8 @@ import { assert, type Equals } from "tsafe/assert"; const KEYCLOAK_VERSION = { FOR_LOGIN_THEME: "25.0.4", - FOR_ACCOUNT_MULTI_PAGE: "21.1.2" + FOR_ACCOUNT_MULTI_PAGE: "21.1.2", + LAST_24: "24.0.4" } as const; export async function downloadKeycloakDefaultTheme(params: { @@ -72,6 +73,15 @@ export async function downloadKeycloakDefaultTheme(params: { return; } + break; + case KEYCLOAK_VERSION.LAST_24: + if ( + !fileRelativePath.startsWith( + pathJoin("base", "login", "resources", "js") + ) + ) { + return; + } break; default: assert>(false);