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( const accountV1RelativeDirPath = pathJoin(
"src", "src",
"main", "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( const modifiedSourceCode = Buffer.from(
sourceCode sourceCode
.toString("utf8") .toString("utf8")
.replace(`parent=${accountV1ThemeName}`, "parent=keycloak"), .replace(
`parent=${accountV1ThemeName}`,
"parent=keycloak"
),
"utf8" "utf8"
); );
@ -164,6 +165,7 @@ export async function buildJar(params: {
return { modifiedSourceCode }; return { modifiedSourceCode };
} }
}
return { modifiedSourceCode: sourceCode }; return { modifiedSourceCode: sourceCode };
}; };
@ -171,6 +173,9 @@ export async function buildJar(params: {
return { transformCodebase_patchForUsingBuiltinAccountV1 }; return { transformCodebase_patchForUsingBuiltinAccountV1 };
})(); })();
console.log("Transforming codebase...");
const start = Date.now();
transformCodebase({ transformCodebase({
srcDirPath: buildOptions.keycloakifyBuildDirPath, srcDirPath: buildOptions.keycloakifyBuildDirPath,
destDirPath: keycloakifyBuildTmpDirPath, destDirPath: keycloakifyBuildTmpDirPath,
@ -195,6 +200,8 @@ export async function buildJar(params: {
}); });
} }
}); });
console.log(`Transforming codebase done in ${Date.now() - start}ms`);
} }
route_legacy_pages: { route_legacy_pages: {