#276: Add build option to select keycloak default assets version

This commit is contained in:
garronej 2023-03-25 04:27:23 +01:00
parent f4f7ab3e49
commit fff4dba708
2 changed files with 9 additions and 7 deletions

View File

@ -22,6 +22,7 @@ type ParsedPackageJson = {
artifactId?: string; artifactId?: string;
groupId?: string; groupId?: string;
bundler?: Bundler; bundler?: Bundler;
keycloakVersionDefaultAssets?: string;
}; };
}; };
@ -38,7 +39,8 @@ const zParsedPackageJson = z.object({
"areAppAndKeycloakServerSharingSameDomain": z.boolean().optional(), "areAppAndKeycloakServerSharingSameDomain": z.boolean().optional(),
"artifactId": z.string().optional(), "artifactId": z.string().optional(),
"groupId": z.string().optional(), "groupId": z.string().optional(),
"bundler": z.enum(bundlers).optional() "bundler": z.enum(bundlers).optional(),
"keycloakVersionDefaultAssets": z.string().optional()
}) })
.optional() .optional()
}); });
@ -59,6 +61,7 @@ export namespace BuildOptions {
groupId: string; groupId: string;
artifactId: string; artifactId: string;
bundler: Bundler; bundler: Bundler;
keycloakVersionDefaultAssets: string;
}; };
export type Standalone = Common & { export type Standalone = Common & {
@ -125,7 +128,8 @@ export function readBuildOptions(params: {
const common: BuildOptions.Common = (() => { const common: BuildOptions.Common = (() => {
const { name, keycloakify = {}, version, homepage } = parsedPackageJson; const { name, keycloakify = {}, version, homepage } = parsedPackageJson;
const { extraPages, extraLoginPages, extraAccountPages, extraThemeProperties, groupId, artifactId, bundler } = keycloakify ?? {}; const { extraPages, extraLoginPages, extraAccountPages, extraThemeProperties, groupId, artifactId, bundler, keycloakVersionDefaultAssets } =
keycloakify ?? {};
const themeName = name const themeName = name
.replace(/^@(.*)/, "$1") .replace(/^@(.*)/, "$1")
@ -167,7 +171,8 @@ export function readBuildOptions(params: {
"extraLoginPages": [...(extraPages ?? []), ...(extraLoginPages ?? [])], "extraLoginPages": [...(extraPages ?? []), ...(extraLoginPages ?? [])],
extraAccountPages, extraAccountPages,
extraThemeProperties, extraThemeProperties,
isSilent isSilent,
"keycloakVersionDefaultAssets": keycloakVersionDefaultAssets ?? "11.0.3"
}; };
})(); })();

View File

@ -49,10 +49,7 @@ export async function main() {
})(), })(),
"reactAppBuildDirPath": pathJoin(reactProjectDirPath, "build"), "reactAppBuildDirPath": pathJoin(reactProjectDirPath, "build"),
buildOptions, buildOptions,
//We have to leave it at that otherwise we break our default theme. "keycloakVersion": buildOptions.keycloakVersionDefaultAssets
//Problem is that we can`t guarantee that the the old resources
//will still be available on the newer keycloak version.
"keycloakVersion": "11.0.3"
}); });
const { jarFilePath } = generateJavaStackFiles({ const { jarFilePath } = generateJavaStackFiles({