Apply the name of the theme in the preconfigured realm

This commit is contained in:
Joseph Garrone 2024-06-12 10:50:00 +02:00
parent d39353d332
commit b2d381ba4b

View File

@ -9,7 +9,12 @@ import type { KeycloakVersionRange } from "../shared/KeycloakVersionRange";
import { getJarFileBasename } from "../shared/getJarFileBasename";
import { assert, type Equals } from "tsafe/assert";
import * as fs from "fs";
import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
import {
join as pathJoin,
relative as pathRelative,
sep as pathSep,
dirname as pathDirname
} from "path";
import * as child_process from "child_process";
import chalk from "chalk";
import chokidar from "chokidar";
@ -248,6 +253,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
});
}
const internalFilePath = await (async () => {
const dirPath = pathJoin(
getThisCodebaseRootDirPath(),
"src",
@ -290,6 +296,29 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
return pathJoin(dirPath, value);
})();
if (internalFilePath === undefined) {
return undefined;
}
const filePath = pathJoin(
buildContext.cacheDirPath,
pathDirname(internalFilePath)
);
fs.writeFileSync(
filePath,
Buffer.from(
fs
.readFileSync(internalFilePath)
.toString("utf8")
.replace(/keycloakify\-starter/g, buildContext.themeNames[0])
),
"utf8"
);
return filePath;
})();
const jarFilePath = pathJoin(buildContext.keycloakifyBuildDirPath, jarFileBasename);
async function extractThemeResourcesFromJar() {