Add themeName option

This commit is contained in:
garronej 2023-04-01 14:02:32 +02:00
parent 44402c9571
commit ee23f629f6
3 changed files with 11 additions and 8 deletions

View File

@ -3,8 +3,7 @@ import { id } from "tsafe/id";
import { parse as urlParse } from "url";
import { typeGuard } from "tsafe/typeGuard";
import { symToStr } from "tsafe/symToStr";
import { bundlers, getParsedPackageJson } from "./parsed-package-json";
import type { Bundler } from "./parsed-package-json";
import { bundlers, getParsedPackageJson, type Bundler } from "./parsedPackageJson";
import { getAppInputPath, getKeycloakBuildPath } from "./build-paths";
/** Consolidated build option gathered form CLI arguments and config in package.json */
@ -91,10 +90,12 @@ export function readBuildOptions(params: { CNAME: string | undefined; isExternal
const { extraPages, extraLoginPages, extraAccountPages, extraThemeProperties, groupId, artifactId, bundler, keycloakVersionDefaultAssets } =
keycloakify ?? {};
const themeName = name
.replace(/^@(.*)/, "$1")
.split("/")
.join("-");
const themeName =
keycloakify.themeName ??
name
.replace(/^@(.*)/, "$1")
.split("/")
.join("-");
return {
themeName,

View File

@ -2,7 +2,7 @@ import * as fs from "fs";
import { exclude } from "tsafe";
import { crawl } from "../tools/crawl";
import { pathJoin } from "../tools/pathJoin";
import { getParsedPackageJson } from "./parsed-package-json";
import { getParsedPackageJson } from "./parsedPackageJson";
const DEFAULT_APP_INPUT_PATH = "build";

View File

@ -25,6 +25,7 @@ type ParsedPackageJson = {
appInputPath?: string;
keycloakBuildPath?: string;
customUserAttributes?: string[];
themeName?: string;
};
};
@ -45,7 +46,8 @@ const zParsedPackageJson = z.object({
"keycloakVersionDefaultAssets": z.string().optional(),
"appInputPath": z.string().optional(),
"keycloakBuildPath": z.string().optional(),
"customUserAttributes": z.array(z.string()).optional()
"customUserAttributes": z.array(z.string()).optional(),
"themeName": z.string().optional()
})
.optional()
});