Include keycloakfiy version number in kcContext (for debug purpose)
This commit is contained in:
parent
f6c2ccb0d6
commit
49e495dbbe
@ -6,6 +6,7 @@ export type KcContext = KcContext.Password | KcContext.Account;
|
|||||||
|
|
||||||
export declare namespace KcContext {
|
export declare namespace KcContext {
|
||||||
export type Common = {
|
export type Common = {
|
||||||
|
keycloakifyVersion: string;
|
||||||
locale?: {
|
locale?: {
|
||||||
supported: {
|
supported: {
|
||||||
url: string;
|
url: string;
|
||||||
|
@ -7,6 +7,7 @@ import type { KcContext } from "./KcContext";
|
|||||||
const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";
|
const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";
|
||||||
|
|
||||||
export const kcContextCommonMock: KcContext.Common = {
|
export const kcContextCommonMock: KcContext.Common = {
|
||||||
|
"keycloakifyVersion": "0.0.0",
|
||||||
"url": {
|
"url": {
|
||||||
"resourcesPath": pathJoin(PUBLIC_URL, mockTestingResourcesPath),
|
"resourcesPath": pathJoin(PUBLIC_URL, mockTestingResourcesPath),
|
||||||
"resourcesCommonPath": pathJoin(PUBLIC_URL, mockTestingResourcesCommonPath),
|
"resourcesCommonPath": pathJoin(PUBLIC_URL, mockTestingResourcesCommonPath),
|
||||||
|
@ -119,6 +119,7 @@
|
|||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
out["pageId"] = "PAGE_ID_xIgLsPgGId9D8e";
|
out["pageId"] = "PAGE_ID_xIgLsPgGId9D8e";
|
||||||
|
out["keycloakifyVersion"] = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
|
@ -53,8 +53,9 @@ export function generateFtlFilesCodeFactory(params: {
|
|||||||
//NOTE: Expected to be an empty object if external assets mode is enabled.
|
//NOTE: Expected to be an empty object if external assets mode is enabled.
|
||||||
cssGlobalsToDefine: Record<string, string>;
|
cssGlobalsToDefine: Record<string, string>;
|
||||||
buildOptions: BuildOptionsLike;
|
buildOptions: BuildOptionsLike;
|
||||||
|
keycloakifyVersion: string;
|
||||||
}) {
|
}) {
|
||||||
const { cssGlobalsToDefine, indexHtmlCode, buildOptions } = params;
|
const { cssGlobalsToDefine, indexHtmlCode, buildOptions, keycloakifyVersion } = params;
|
||||||
|
|
||||||
const $ = cheerio.load(indexHtmlCode);
|
const $ = cheerio.load(indexHtmlCode);
|
||||||
|
|
||||||
@ -128,7 +129,8 @@ export function generateFtlFilesCodeFactory(params: {
|
|||||||
.replace(
|
.replace(
|
||||||
"CUSTOM_USER_ATTRIBUTES_eKsIY4ZsZ4xeM",
|
"CUSTOM_USER_ATTRIBUTES_eKsIY4ZsZ4xeM",
|
||||||
buildOptions.customUserAttributes.length === 0 ? "" : ", " + buildOptions.customUserAttributes.map(name => `"${name}"`).join(", ")
|
buildOptions.customUserAttributes.length === 0 ? "" : ", " + buildOptions.customUserAttributes.map(name => `"${name}"`).join(", ")
|
||||||
),
|
)
|
||||||
|
.replace("KEYCLOAKIFY_VERSION_xEdKd3xEdr", keycloakifyVersion),
|
||||||
"<!-- xIdLqMeOedErIdLsPdNdI9dSlxI -->": [
|
"<!-- xIdLqMeOedErIdLsPdNdI9dSlxI -->": [
|
||||||
"<#if scripts??>",
|
"<#if scripts??>",
|
||||||
" <#list scripts as script>",
|
" <#list scripts as script>",
|
||||||
@ -161,7 +163,6 @@ export function generateFtlFilesCodeFactory(params: {
|
|||||||
|
|
||||||
Object.entries({
|
Object.entries({
|
||||||
...replaceValueBySearchValue,
|
...replaceValueBySearchValue,
|
||||||
//If updated, don't forget to change in the ftl script as well.
|
|
||||||
"PAGE_ID_xIgLsPgGId9D8e": pageId
|
"PAGE_ID_xIgLsPgGId9D8e": pageId
|
||||||
}).map(([searchValue, replaceValue]) => (ftlCode = ftlCode.replace(searchValue, replaceValue)));
|
}).map(([searchValue, replaceValue]) => (ftlCode = ftlCode.replace(searchValue, replaceValue)));
|
||||||
|
|
||||||
|
@ -54,8 +54,9 @@ export async function generateKeycloakThemeResources(params: {
|
|||||||
emailThemeSrcDirPath: string | undefined;
|
emailThemeSrcDirPath: string | undefined;
|
||||||
keycloakVersion: string;
|
keycloakVersion: string;
|
||||||
buildOptions: BuildOptionsLike;
|
buildOptions: BuildOptionsLike;
|
||||||
|
keycloakifyVersion: string;
|
||||||
}): Promise<{ doBundlesEmailTemplate: boolean }> {
|
}): Promise<{ doBundlesEmailTemplate: boolean }> {
|
||||||
const { reactAppBuildDirPath, keycloakThemeBuildingDirPath, emailThemeSrcDirPath, keycloakVersion, buildOptions } = params;
|
const { reactAppBuildDirPath, keycloakThemeBuildingDirPath, emailThemeSrcDirPath, keycloakVersion, buildOptions, keycloakifyVersion } = params;
|
||||||
|
|
||||||
const getThemeDirPath = (themeType: ThemeType | "email") =>
|
const getThemeDirPath = (themeType: ThemeType | "email") =>
|
||||||
pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", buildOptions.themeName, themeType);
|
pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", buildOptions.themeName, themeType);
|
||||||
@ -138,7 +139,8 @@ export async function generateKeycloakThemeResources(params: {
|
|||||||
const { generateFtlFilesCode } = generateFtlFilesCodeFactory({
|
const { generateFtlFilesCode } = generateFtlFilesCodeFactory({
|
||||||
"indexHtmlCode": fs.readFileSync(pathJoin(reactAppBuildDirPath, "index.html")).toString("utf8"),
|
"indexHtmlCode": fs.readFileSync(pathJoin(reactAppBuildDirPath, "index.html")).toString("utf8"),
|
||||||
"cssGlobalsToDefine": allCssGlobalsToDefine,
|
"cssGlobalsToDefine": allCssGlobalsToDefine,
|
||||||
buildOptions
|
buildOptions,
|
||||||
|
keycloakifyVersion
|
||||||
});
|
});
|
||||||
|
|
||||||
return generateFtlFilesCode;
|
return generateFtlFilesCode;
|
||||||
|
@ -11,6 +11,7 @@ import jar from "../tools/jar";
|
|||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { Equals } from "tsafe";
|
import { Equals } from "tsafe";
|
||||||
import { getEmailThemeSrcDirPath } from "../getSrcDirPath";
|
import { getEmailThemeSrcDirPath } from "../getSrcDirPath";
|
||||||
|
import { getProjectRoot } from "../tools/getProjectRoot";
|
||||||
|
|
||||||
export async function main() {
|
export async function main() {
|
||||||
const { isSilent, hasExternalAssets } = getCliOptions(process.argv.slice(2));
|
const { isSilent, hasExternalAssets } = getCliOptions(process.argv.slice(2));
|
||||||
@ -38,7 +39,14 @@ export async function main() {
|
|||||||
})(),
|
})(),
|
||||||
"reactAppBuildDirPath": buildOptions.reactAppBuildDirPath,
|
"reactAppBuildDirPath": buildOptions.reactAppBuildDirPath,
|
||||||
buildOptions,
|
buildOptions,
|
||||||
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets
|
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
||||||
|
"keycloakifyVersion": (() => {
|
||||||
|
const version = JSON.parse(fs.readFileSync(pathJoin(getProjectRoot(), "package.json")).toString("utf8"))["version"];
|
||||||
|
|
||||||
|
assert(typeof version === "string");
|
||||||
|
|
||||||
|
return version;
|
||||||
|
})()
|
||||||
});
|
});
|
||||||
|
|
||||||
const { jarFilePath } = generateJavaStackFiles({
|
const { jarFilePath } = generateJavaStackFiles({
|
||||||
|
@ -36,6 +36,7 @@ export type KcContext =
|
|||||||
|
|
||||||
export declare namespace KcContext {
|
export declare namespace KcContext {
|
||||||
export type Common = {
|
export type Common = {
|
||||||
|
keycloakifyVersion: string;
|
||||||
url: {
|
url: {
|
||||||
loginAction: string;
|
loginAction: string;
|
||||||
resourcesPath: string;
|
resourcesPath: string;
|
||||||
|
@ -101,6 +101,7 @@ const attributes: Attribute[] = [
|
|||||||
const attributesByName = Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any;
|
const attributesByName = Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any;
|
||||||
|
|
||||||
export const kcContextCommonMock: KcContext.Common = {
|
export const kcContextCommonMock: KcContext.Common = {
|
||||||
|
"keycloakifyVersion": "0.0.0",
|
||||||
"url": {
|
"url": {
|
||||||
"loginAction": "#",
|
"loginAction": "#",
|
||||||
"resourcesPath": pathJoin(PUBLIC_URL, mockTestingResourcesPath),
|
"resourcesPath": pathJoin(PUBLIC_URL, mockTestingResourcesPath),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user