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

View File

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

View File

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