Remove premature optimization

This commit is contained in:
Joseph Garrone 2024-05-26 12:24:35 +02:00
parent 5670a71e6b
commit 6603852355

View File

@ -98,20 +98,6 @@ export async function buildJar(params: {
};
}
const themePropertiesFileRelativePathSet = new Set(
buildOptions.themeNames.map(themeName =>
pathJoin(
"src",
"main",
"resources",
"theme",
themeName,
"account",
"theme.properties"
)
)
);
const accountV1RelativeDirPath = pathJoin(
"src",
"main",
@ -152,11 +138,26 @@ export async function buildJar(params: {
};
}
if (themePropertiesFileRelativePathSet.has(fileRelativePath)) {
for (const themeName of buildOptions.themeNames) {
if (
fileRelativePath ===
pathJoin(
"src",
"main",
"resources",
"theme",
themeName,
"account",
"theme.properties"
)
) {
const modifiedSourceCode = Buffer.from(
sourceCode
.toString("utf8")
.replace(`parent=${accountV1ThemeName}`, "parent=keycloak"),
.replace(
`parent=${accountV1ThemeName}`,
"parent=keycloak"
),
"utf8"
);
@ -164,6 +165,7 @@ export async function buildJar(params: {
return { modifiedSourceCode };
}
}
return { modifiedSourceCode: sourceCode };
};
@ -171,6 +173,9 @@ export async function buildJar(params: {
return { transformCodebase_patchForUsingBuiltinAccountV1 };
})();
console.log("Transforming codebase...");
const start = Date.now();
transformCodebase({
srcDirPath: buildOptions.keycloakifyBuildDirPath,
destDirPath: keycloakifyBuildTmpDirPath,
@ -195,6 +200,8 @@ export async function buildJar(params: {
});
}
});
console.log(`Transforming codebase done in ${Date.now() - start}ms`);
}
route_legacy_pages: {