Include the theme version in kcContext

This commit is contained in:
garronej
2023-04-06 16:38:13 +02:00
parent c1e0563eba
commit feaf34c124
7 changed files with 15 additions and 11 deletions

View File

@ -13,7 +13,7 @@ export type BuildOptions = BuildOptions.Standalone | BuildOptions.ExternalAssets
export namespace BuildOptions {
export type Common = {
isSilent: boolean;
version: string;
themeVersion: string;
themeName: string;
extraLoginPages: string[] | undefined;
extraAccountPages: string[] | undefined;
@ -139,7 +139,7 @@ export function readBuildOptions(params: { projectDirPath: string; isExternalAss
.join(".") ?? fallbackGroupId) + ".keycloak"
);
})(),
"version": process.env.KEYCLOAKIFY_VERSION ?? version,
"themeVersion": process.env.KEYCLOAKIFY_THEME_VERSION ?? process.env.KEYCLOAKIFY_VERSION ?? version ?? "0.0.0",
"extraLoginPages": [...(extraPages ?? []), ...(extraLoginPages ?? [])],
extraAccountPages,
extraThemeProperties,

View File

@ -118,8 +118,9 @@
};
</#if>
out["pageId"] = "PAGE_ID_xIgLsPgGId9D8e";
out["keycloakifyVersion"] = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
out["themeVersion"] = "KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx";
out["pageId"] = "PAGE_ID_xIgLsPgGId9D8e";
return out;

View File

@ -18,6 +18,7 @@ export type BuildOptionsLike = BuildOptionsLike.Standalone | BuildOptionsLike.Ex
export namespace BuildOptionsLike {
export type Common = {
customUserAttributes: string[];
themeVersion: string;
};
export type Standalone = Common & {
@ -130,7 +131,8 @@ export function generateFtlFilesCodeFactory(params: {
"CUSTOM_USER_ATTRIBUTES_eKsIY4ZsZ4xeM",
buildOptions.customUserAttributes.length === 0 ? "" : ", " + buildOptions.customUserAttributes.map(name => `"${name}"`).join(", ")
)
.replace("KEYCLOAKIFY_VERSION_xEdKd3xEdr", keycloakifyVersion),
.replace("KEYCLOAKIFY_VERSION_xEdKd3xEdr", keycloakifyVersion)
.replace("KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx", buildOptions.themeVersion),
"<!-- xIdLqMeOedErIdLsPdNdI9dSlxI -->": [
"<#if scripts??>",
" <#list scripts as script>",

View File

@ -9,7 +9,7 @@ export type BuildOptionsLike = {
themeName: string;
groupId: string;
artifactId?: string;
version: string;
themeVersion: string;
};
{
@ -26,7 +26,7 @@ export function generateJavaStackFiles(params: {
jarFilePath: string;
} {
const {
buildOptions: { groupId, themeName, version, artifactId },
buildOptions: { groupId, themeName, themeVersion, artifactId },
keycloakThemeBuildingDirPath,
doBundlesEmailTemplate
} = params;
@ -43,7 +43,7 @@ export function generateJavaStackFiles(params: {
` <modelVersion>4.0.0</modelVersion>`,
` <groupId>${groupId}</groupId>`,
` <artifactId>${artifactId}</artifactId>`,
` <version>${version}</version>`,
` <version>${themeVersion}</version>`,
` <name>${artifactId}</name>`,
` <description />`,
`</project>`
@ -83,6 +83,6 @@ export function generateJavaStackFiles(params: {
}
return {
"jarFilePath": pathJoin(keycloakThemeBuildingDirPath, "target", `${artifactId}-${version}.jar`)
"jarFilePath": pathJoin(keycloakThemeBuildingDirPath, "target", `${artifactId}-${themeVersion}.jar`)
};
}

View File

@ -20,6 +20,7 @@ export namespace BuildOptionsLike {
extraThemeProperties?: string[];
isSilent: boolean;
customUserAttributes: string[];
themeVersion: string;
};
export type Standalone = Common & {

View File

@ -63,7 +63,7 @@ export async function main() {
logger.log("🫶 Let keycloakify do its thang");
await jar({
"rootPath": pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources"),
"version": buildOptions.version,
"version": buildOptions.themeVersion,
"groupId": buildOptions.groupId,
"artifactId": buildOptions.artifactId,
"targetPath": jarFilePath

View File

@ -8,7 +8,7 @@ export const bundlers = ["mvn", "keycloakify", "none"] as const;
export type Bundler = (typeof bundlers)[number];
export type ParsedPackageJson = {
name: string;
version: string;
version?: string;
homepage?: string;
keycloakify?: {
/** @deprecated: use extraLoginPages instead */
@ -30,7 +30,7 @@ export type ParsedPackageJson = {
export const zParsedPackageJson = z.object({
"name": z.string(),
"version": z.string(),
"version": z.string().optional(),
"homepage": z.string().optional(),
"keycloakify": z
.object({