Compare commits

..

2 Commits

Author SHA1 Message Date
4900200c06 Release candidate 2024-07-13 09:27:10 +02:00
6d82a74db4 Improve incremental build time 2024-07-13 09:26:48 +02:00
2 changed files with 11 additions and 15 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "keycloakify", "name": "keycloakify",
"version": "10.0.0-rc.109", "version": "10.0.0-rc.110",
"description": "Create Keycloak themes using React", "description": "Create Keycloak themes using React",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -45,20 +45,21 @@ export async function buildJar(params: {
buildContext buildContext
} = params; } = params;
const keycloakifyBuildTmpDirPath = pathJoin( const keycloakifyBuildCacheDirPath = pathJoin(
buildContext.cacheDirPath, buildContext.cacheDirPath,
"maven",
jarFileBasename.replace(".jar", "") jarFileBasename.replace(".jar", "")
); );
rmSync(keycloakifyBuildTmpDirPath, { recursive: true, force: true });
const tmpResourcesDirPath = pathJoin( const tmpResourcesDirPath = pathJoin(
keycloakifyBuildTmpDirPath, keycloakifyBuildCacheDirPath,
"src", "src",
"main", "main",
"resources" "resources"
); );
rmSync(tmpResourcesDirPath, { recursive: true, force: true });
transformCodebase({ transformCodebase({
srcDirPath: resourcesDirPath, srcDirPath: resourcesDirPath,
destDirPath: tmpResourcesDirPath, destDirPath: tmpResourcesDirPath,
@ -155,10 +156,7 @@ export async function buildJar(params: {
(["register.ftl", "login-update-profile.ftl"] as const).forEach(pageId => (["register.ftl", "login-update-profile.ftl"] as const).forEach(pageId =>
buildContext.themeNames.map(themeName => { buildContext.themeNames.map(themeName => {
const ftlFilePath = pathJoin( const ftlFilePath = pathJoin(
keycloakifyBuildTmpDirPath, tmpResourcesDirPath,
"src",
"main",
"resources",
"theme", "theme",
themeName, themeName,
"login", "login",
@ -200,15 +198,15 @@ export async function buildJar(params: {
}); });
await fs.writeFile( await fs.writeFile(
pathJoin(keycloakifyBuildTmpDirPath, "pom.xml"), pathJoin(keycloakifyBuildCacheDirPath, "pom.xml"),
Buffer.from(pomFileCode, "utf8") Buffer.from(pomFileCode, "utf8")
); );
} }
await new Promise<void>((resolve, reject) => await new Promise<void>((resolve, reject) =>
child_process.exec( child_process.exec(
`mvn clean install -Dmaven.repo.local="${pathJoin(keycloakifyBuildTmpDirPath, ".m2")}"`, `mvn install -Dmaven.repo.local="${pathJoin(keycloakifyBuildCacheDirPath, ".m2")}"`,
{ cwd: keycloakifyBuildTmpDirPath }, { cwd: keycloakifyBuildCacheDirPath },
error => { error => {
if (error !== null) { if (error !== null) {
console.error( console.error(
@ -233,12 +231,10 @@ export async function buildJar(params: {
await fs.rename( await fs.rename(
pathJoin( pathJoin(
keycloakifyBuildTmpDirPath, keycloakifyBuildCacheDirPath,
"target", "target",
`${buildContext.artifactId}-${buildContext.themeVersion}.jar` `${buildContext.artifactId}-${buildContext.themeVersion}.jar`
), ),
pathJoin(buildContext.keycloakifyBuildDirPath, jarFileBasename) pathJoin(buildContext.keycloakifyBuildDirPath, jarFileBasename)
); );
rmSync(keycloakifyBuildTmpDirPath, { recursive: true });
} }