Stop passing as parameter the non variadic srcMainResource path
This commit is contained in:
parent
d5bb7679ca
commit
f935922241
@ -10,14 +10,15 @@ import { rmSync } from "../../tools/fs.rmSync";
|
||||
type BuildOptionsLike = {
|
||||
cacheDirPath: string;
|
||||
npmWorkspaceRootDirPath: string;
|
||||
keycloakifyBuildDirPath: string;
|
||||
};
|
||||
|
||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||
|
||||
export async function bringInAccountV1(params: { buildOptions: BuildOptionsLike; srcMainResourcesDirPath: string }) {
|
||||
const { buildOptions, srcMainResourcesDirPath } = params;
|
||||
export async function bringInAccountV1(params: { buildOptions: BuildOptionsLike }) {
|
||||
const { buildOptions } = params;
|
||||
|
||||
const builtinKeycloakThemeTmpDirPath = pathJoin(srcMainResourcesDirPath, "..", "tmp_yxdE2_builtin_keycloak_theme");
|
||||
const builtinKeycloakThemeTmpDirPath = pathJoin(buildOptions.cacheDirPath, "tmp_yxdE2_builtin_keycloak_theme");
|
||||
|
||||
await downloadBuiltinKeycloakTheme({
|
||||
"destDirPath": builtinKeycloakThemeTmpDirPath,
|
||||
@ -25,7 +26,7 @@ export async function bringInAccountV1(params: { buildOptions: BuildOptionsLike;
|
||||
buildOptions
|
||||
});
|
||||
|
||||
const accountV1DirPath = pathJoin(srcMainResourcesDirPath, "theme", accountV1ThemeName, "account");
|
||||
const accountV1DirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme", accountV1ThemeName, "account");
|
||||
|
||||
transformCodebase({
|
||||
"srcDirPath": pathJoin(builtinKeycloakThemeTmpDirPath, "base", "account"),
|
||||
|
@ -35,22 +35,19 @@ export type BuildOptionsLike = {
|
||||
urlPathname: string | undefined;
|
||||
npmWorkspaceRootDirPath: string;
|
||||
reactAppRootDirPath: string;
|
||||
keycloakifyBuildDirPath: string;
|
||||
};
|
||||
|
||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||
|
||||
export async function generateSrcMainResources(params: {
|
||||
themeName: string;
|
||||
buildOptions: BuildOptionsLike;
|
||||
srcMainResourcesDirPath: string;
|
||||
}): Promise<void> {
|
||||
const { themeName, buildOptions, srcMainResourcesDirPath } = params;
|
||||
export async function generateSrcMainResources(params: { themeName: string; buildOptions: BuildOptionsLike }): Promise<void> {
|
||||
const { themeName, buildOptions } = params;
|
||||
|
||||
const { themeSrcDirPath } = getThemeSrcDirPath({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath });
|
||||
|
||||
const getThemeTypeDirPath = (params: { themeType: ThemeType | "email" }) => {
|
||||
const { themeType } = params;
|
||||
return pathJoin(srcMainResourcesDirPath, "theme", themeName, themeType);
|
||||
return pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme", themeName, themeType);
|
||||
};
|
||||
|
||||
const cssGlobalsToDefine: Record<string, string> = {};
|
||||
@ -245,7 +242,6 @@ export async function generateSrcMainResources(params: {
|
||||
}
|
||||
|
||||
await bringInAccountV1({
|
||||
srcMainResourcesDirPath,
|
||||
buildOptions
|
||||
});
|
||||
|
||||
@ -256,7 +252,14 @@ export async function generateSrcMainResources(params: {
|
||||
}
|
||||
|
||||
{
|
||||
const keycloakThemeJsonFilePath = pathJoin(srcMainResourcesDirPath, "META-INF", "keycloak-themes.json");
|
||||
const keycloakThemeJsonFilePath = pathJoin(
|
||||
buildOptions.keycloakifyBuildDirPath,
|
||||
"src",
|
||||
"main",
|
||||
"resources",
|
||||
"META-INF",
|
||||
"keycloak-themes.json"
|
||||
);
|
||||
|
||||
try {
|
||||
fs.mkdirSync(pathDirname(keycloakThemeJsonFilePath));
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { join as pathJoin } from "path";
|
||||
import type { BuildOptions } from "../../shared/buildOptions";
|
||||
import { assert } from "tsafe/assert";
|
||||
import { generateSrcMainResources, type BuildOptionsLike as BuildOptionsLike_generateSrcMainResources } from "./generateSrcMainResources";
|
||||
@ -16,11 +15,8 @@ export async function generateTheme(params: { buildOptions: BuildOptionsLike }):
|
||||
|
||||
const [themeName, ...themeVariantNames] = buildOptions.themeNames;
|
||||
|
||||
const srcMainResourcesDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources");
|
||||
|
||||
await generateSrcMainResources({
|
||||
themeName,
|
||||
srcMainResourcesDirPath,
|
||||
buildOptions
|
||||
});
|
||||
|
||||
@ -28,7 +24,7 @@ export async function generateTheme(params: { buildOptions: BuildOptionsLike }):
|
||||
generateThemeVariations({
|
||||
themeName,
|
||||
themeVariantName,
|
||||
srcMainResourcesDirPath
|
||||
buildOptions
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,19 @@
|
||||
import { join as pathJoin, extname as pathExtname, sep as pathSep } from "path";
|
||||
import { transformCodebase } from "../../tools/transformCodebase";
|
||||
import type { BuildOptions } from "../../shared/buildOptions";
|
||||
import { assert } from "tsafe/assert";
|
||||
import * as fs from "fs";
|
||||
|
||||
export function generateThemeVariations(params: { themeName: string; themeVariantName: string; srcMainResourcesDirPath: string }) {
|
||||
const { themeName, themeVariantName, srcMainResourcesDirPath } = params;
|
||||
export type BuildOptionsLike = {
|
||||
keycloakifyBuildDirPath: string;
|
||||
};
|
||||
|
||||
const mainThemeDirPath = pathJoin(srcMainResourcesDirPath, "theme", themeName);
|
||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||
|
||||
export function generateThemeVariations(params: { themeName: string; themeVariantName: string; buildOptions: BuildOptionsLike }) {
|
||||
const { themeName, themeVariantName, buildOptions } = params;
|
||||
|
||||
const mainThemeDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme", themeName);
|
||||
|
||||
transformCodebase({
|
||||
"srcDirPath": mainThemeDirPath,
|
||||
@ -30,7 +37,14 @@ export function generateThemeVariations(params: { themeName: string; themeVarian
|
||||
});
|
||||
|
||||
{
|
||||
const keycloakThemeJsonFilePath = pathJoin(srcMainResourcesDirPath, "META-INF", "keycloak-themes.json");
|
||||
const keycloakThemeJsonFilePath = pathJoin(
|
||||
buildOptions.keycloakifyBuildDirPath,
|
||||
"src",
|
||||
"main",
|
||||
"resources",
|
||||
"META-INF",
|
||||
"keycloak-themes.json"
|
||||
);
|
||||
|
||||
const modifiedParsedJson = JSON.parse(fs.readFileSync(keycloakThemeJsonFilePath).toString("utf8")) as {
|
||||
themes: { name: string; types: string[] }[];
|
||||
|
@ -41,6 +41,9 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: find from META-INF/keycloak-themes.json
|
||||
const doesImplementAccountTheme = true;
|
||||
|
||||
await buildJars({
|
||||
doesImplementAccountTheme,
|
||||
buildOptions
|
||||
|
Loading…
x
Reference in New Issue
Block a user