Add missing font and optimize keycloak theme resources extraction
This commit is contained in:
@ -17,8 +17,8 @@ export async function downloadKeycloakDefaultTheme(params: {
|
|||||||
}): Promise<{ defaultThemeDirPath: string }> {
|
}): Promise<{ defaultThemeDirPath: string }> {
|
||||||
const { keycloakVersion, buildContext } = params;
|
const { keycloakVersion, buildContext } = params;
|
||||||
|
|
||||||
let kcNodeModulesKeepFilePaths: string[] | undefined = undefined;
|
let kcNodeModulesKeepFilePaths: Set<string> | undefined = undefined;
|
||||||
let kcNodeModulesKeepFilePaths_lastAccountV1: string[] | undefined = undefined;
|
let kcNodeModulesKeepFilePaths_lastAccountV1: Set<string> | undefined = undefined;
|
||||||
|
|
||||||
const { extractedDirPath } = await downloadAndExtractArchive({
|
const { extractedDirPath } = await downloadAndExtractArchive({
|
||||||
url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
|
url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
|
||||||
@ -72,16 +72,19 @@ export async function downloadKeycloakDefaultTheme(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
skip_node_modules: {
|
skip_node_modules: {
|
||||||
if (
|
const nodeModulesRelativeDirPath = pathJoin(
|
||||||
!fileRelativePath.startsWith(
|
"keycloak",
|
||||||
pathJoin("keycloak", "common", "resources", "node_modules")
|
"common",
|
||||||
)
|
"resources",
|
||||||
) {
|
"node_modules"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fileRelativePath.startsWith(nodeModulesRelativeDirPath)) {
|
||||||
break skip_node_modules;
|
break skip_node_modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kcNodeModulesKeepFilePaths_lastAccountV1 === undefined) {
|
if (kcNodeModulesKeepFilePaths_lastAccountV1 === undefined) {
|
||||||
kcNodeModulesKeepFilePaths_lastAccountV1 = [
|
kcNodeModulesKeepFilePaths_lastAccountV1 = new Set([
|
||||||
pathJoin("patternfly", "dist", "css", "patternfly.min.css"),
|
pathJoin("patternfly", "dist", "css", "patternfly.min.css"),
|
||||||
pathJoin(
|
pathJoin(
|
||||||
"patternfly",
|
"patternfly",
|
||||||
@ -125,14 +128,20 @@ export async function downloadKeycloakDefaultTheme(params: {
|
|||||||
"fonts",
|
"fonts",
|
||||||
"PatternFlyIcons-webfont.woff"
|
"PatternFlyIcons-webfont.woff"
|
||||||
)
|
)
|
||||||
];
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const keepPath of kcNodeModulesKeepFilePaths_lastAccountV1) {
|
const fileRelativeToNodeModulesPath = fileRelativePath.substring(
|
||||||
if (fileRelativePath.endsWith(keepPath)) {
|
nodeModulesRelativeDirPath.length + 1
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
kcNodeModulesKeepFilePaths_lastAccountV1.has(
|
||||||
|
fileRelativeToNodeModulesPath
|
||||||
|
)
|
||||||
|
) {
|
||||||
break skip_node_modules;
|
break skip_node_modules;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -165,16 +174,19 @@ export async function downloadKeycloakDefaultTheme(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
skip_node_modules: {
|
skip_node_modules: {
|
||||||
if (
|
const nodeModulesRelativeDirPath = pathJoin(
|
||||||
!fileRelativePath.startsWith(
|
"keycloak",
|
||||||
pathJoin("keycloak", "common", "resources", "node_modules")
|
"common",
|
||||||
)
|
"resources",
|
||||||
) {
|
"node_modules"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fileRelativePath.startsWith(nodeModulesRelativeDirPath)) {
|
||||||
break skip_node_modules;
|
break skip_node_modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kcNodeModulesKeepFilePaths === undefined) {
|
if (kcNodeModulesKeepFilePaths === undefined) {
|
||||||
kcNodeModulesKeepFilePaths = [
|
kcNodeModulesKeepFilePaths = new Set([
|
||||||
pathJoin("@patternfly", "patternfly", "patternfly.min.css"),
|
pathJoin("@patternfly", "patternfly", "patternfly.min.css"),
|
||||||
pathJoin("patternfly", "dist", "css", "patternfly.min.css"),
|
pathJoin("patternfly", "dist", "css", "patternfly.min.css"),
|
||||||
pathJoin(
|
pathJoin(
|
||||||
@ -231,16 +243,24 @@ export async function downloadKeycloakDefaultTheme(params: {
|
|||||||
"fonts",
|
"fonts",
|
||||||
"PatternFlyIcons-webfont.woff"
|
"PatternFlyIcons-webfont.woff"
|
||||||
),
|
),
|
||||||
|
pathJoin(
|
||||||
|
"patternfly",
|
||||||
|
"dist",
|
||||||
|
"fonts",
|
||||||
|
"OpenSans-Semibold-webfont.woff2"
|
||||||
|
),
|
||||||
pathJoin("patternfly", "dist", "img", "bg-login.jpg"),
|
pathJoin("patternfly", "dist", "img", "bg-login.jpg"),
|
||||||
pathJoin("jquery", "dist", "jquery.min.js")
|
pathJoin("jquery", "dist", "jquery.min.js")
|
||||||
];
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const keepPath of kcNodeModulesKeepFilePaths) {
|
const fileRelativeToNodeModulesPath = fileRelativePath.substring(
|
||||||
if (fileRelativePath.endsWith(keepPath)) {
|
nodeModulesRelativeDirPath.length + 1
|
||||||
|
);
|
||||||
|
|
||||||
|
if (kcNodeModulesKeepFilePaths.has(fileRelativeToNodeModulesPath)) {
|
||||||
break skip_node_modules;
|
break skip_node_modules;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user