Pulling the message resources of the account theme from the installed keycloak-account-ui version
This commit is contained in:
parent
74317a1f3c
commit
dbae909903
@ -4,8 +4,7 @@ import {
|
|||||||
join as pathJoin,
|
join as pathJoin,
|
||||||
resolve as pathResolve,
|
resolve as pathResolve,
|
||||||
relative as pathRelative,
|
relative as pathRelative,
|
||||||
dirname as pathDirname,
|
dirname as pathDirname
|
||||||
basename as pathBasename
|
|
||||||
} from "path";
|
} from "path";
|
||||||
import { replaceImportsInJsCode } from "../replacers/replaceImportsInJsCode";
|
import { replaceImportsInJsCode } from "../replacers/replaceImportsInJsCode";
|
||||||
import { replaceImportsInCssCode } from "../replacers/replaceImportsInCssCode";
|
import { replaceImportsInCssCode } from "../replacers/replaceImportsInCssCode";
|
||||||
@ -43,7 +42,7 @@ import {
|
|||||||
} from "../../shared/metaInfKeycloakThemes";
|
} from "../../shared/metaInfKeycloakThemes";
|
||||||
import { objectEntries } from "tsafe/objectEntries";
|
import { objectEntries } from "tsafe/objectEntries";
|
||||||
import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
|
import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
|
||||||
import { downloadAndExtractArchive } from "../../tools/downloadAndExtractArchive";
|
import * as child_process from "child_process";
|
||||||
|
|
||||||
export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
||||||
BuildContextLike_downloadKeycloakStaticResources &
|
BuildContextLike_downloadKeycloakStaticResources &
|
||||||
@ -56,6 +55,7 @@ export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
|||||||
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
||||||
themeSrcDirPath: string;
|
themeSrcDirPath: string;
|
||||||
bundler: "vite" | "webpack";
|
bundler: "vite" | "webpack";
|
||||||
|
packageJsonFilePath: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
assert<BuildContext extends BuildContextLike ? true : false>();
|
assert<BuildContext extends BuildContextLike ? true : false>();
|
||||||
@ -313,27 +313,23 @@ export async function generateResourcesForMainTheme(params: {
|
|||||||
break bring_in_account_v3_i18n_messages;
|
break bring_in_account_v3_i18n_messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { extractedDirPath } = await downloadAndExtractArchive({
|
const accountUiDirPath = child_process
|
||||||
url: "https://repo1.maven.org/maven2/org/keycloak/keycloak-account-ui/25.0.1/keycloak-account-ui-25.0.1.jar",
|
.execSync("npm list @keycloakify/keycloak-account-ui --parseable", {
|
||||||
cacheDirPath: buildContext.cacheDirPath,
|
cwd: pathDirname(buildContext.packageJsonFilePath)
|
||||||
fetchOptions: buildContext.fetchOptions,
|
})
|
||||||
uniqueIdOfOnArchiveFile: "bring_in_account_v3_i18n_messages",
|
.toString("utf8")
|
||||||
onArchiveFile: async ({ fileRelativePath, writeFile }) => {
|
.trim();
|
||||||
if (
|
|
||||||
!fileRelativePath.startsWith(
|
const messagesDirPath = pathJoin(accountUiDirPath, "messages");
|
||||||
pathJoin("theme", "keycloak.v3", "account", "messages")
|
|
||||||
)
|
if (!fs.existsSync(messagesDirPath)) {
|
||||||
) {
|
throw new Error(
|
||||||
return;
|
`Please update @keycloakify/keycloak-account-ui to 25.0.4-rc.5 or later.`
|
||||||
}
|
);
|
||||||
await writeFile({
|
}
|
||||||
fileRelativePath: pathBasename(fileRelativePath)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
srcDirPath: extractedDirPath,
|
srcDirPath: messagesDirPath,
|
||||||
destDirPath: pathJoin(
|
destDirPath: pathJoin(
|
||||||
getThemeTypeDirPath({ themeType: "account" }),
|
getThemeTypeDirPath({ themeType: "account" }),
|
||||||
"messages"
|
"messages"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user