Rename jarTargets -> keycloakVersionTargets
This commit is contained in:
parent
287edabd90
commit
532655d2d5
@ -60,11 +60,11 @@ export type BuildOptions = {
|
|||||||
loginThemeResourcesFromKeycloakVersion?: string;
|
loginThemeResourcesFromKeycloakVersion?: string;
|
||||||
keycloakifyBuildDirPath?: string;
|
keycloakifyBuildDirPath?: string;
|
||||||
kcContextExclusionsFtl?: string;
|
kcContextExclusionsFtl?: string;
|
||||||
jarTargets?: BuildOptions.JarTargets;
|
keycloakVersionTargets?: BuildOptions.KeycloakVersionTargets;
|
||||||
};
|
};
|
||||||
|
|
||||||
export namespace BuildOptions {
|
export namespace BuildOptions {
|
||||||
export type JarTargets =
|
export type KeycloakVersionTargets =
|
||||||
| ({ hasAccountTheme: true } & Record<
|
| ({ hasAccountTheme: true } & Record<
|
||||||
KeycloakVersionRange.WithAccountTheme,
|
KeycloakVersionRange.WithAccountTheme,
|
||||||
string | boolean
|
string | boolean
|
||||||
@ -168,9 +168,11 @@ export function getBuildContext(params: {
|
|||||||
)
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
themeName: z.union([z.string(), z.array(z.string())]).optional(),
|
themeName: z.union([z.string(), z.array(z.string())]).optional(),
|
||||||
jarTargets: id<z.ZodType<BuildOptions.JarTargets>>(
|
keycloakVersionTargets: id<
|
||||||
|
z.ZodType<BuildOptions.KeycloakVersionTargets>
|
||||||
|
>(
|
||||||
(() => {
|
(() => {
|
||||||
const zJarTargets = z.union([
|
const zKeycloakVersionTargets = z.union([
|
||||||
z.object({
|
z.object({
|
||||||
hasAccountTheme: z.literal(true),
|
hasAccountTheme: z.literal(true),
|
||||||
"21-and-below": z.union([
|
"21-and-below": z.union([
|
||||||
@ -192,12 +194,12 @@ export function getBuildContext(params: {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
{
|
{
|
||||||
type Got = z.infer<typeof zJarTargets>;
|
type Got = z.infer<typeof zKeycloakVersionTargets>;
|
||||||
type Expected = BuildOptions.JarTargets;
|
type Expected = BuildOptions.KeycloakVersionTargets;
|
||||||
assert<Equals<Got, Expected>>();
|
assert<Equals<Got, Expected>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return zJarTargets;
|
return zKeycloakVersionTargets;
|
||||||
})()
|
})()
|
||||||
).optional()
|
).optional()
|
||||||
});
|
});
|
||||||
@ -584,31 +586,31 @@ export function getBuildContext(params: {
|
|||||||
return jarTargets;
|
return jarTargets;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
if (buildOptions.jarTargets === undefined) {
|
if (buildOptions.keycloakVersionTargets === undefined) {
|
||||||
return jarTargets_default;
|
return jarTargets_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
buildOptions.jarTargets.hasAccountTheme !==
|
buildOptions.keycloakVersionTargets.hasAccountTheme !==
|
||||||
recordIsImplementedByThemeType.account
|
recordIsImplementedByThemeType.account
|
||||||
) {
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
chalk.red(
|
chalk.red(
|
||||||
(() => {
|
(() => {
|
||||||
const { jarTargets } = buildOptions;
|
const { keycloakVersionTargets } = buildOptions;
|
||||||
|
|
||||||
let message = `Bad ${symToStr({ jarTargets })} configuration.\n`;
|
let message = `Bad ${symToStr({ keycloakVersionTargets })} configuration.\n`;
|
||||||
|
|
||||||
if (jarTargets.hasAccountTheme) {
|
if (keycloakVersionTargets.hasAccountTheme) {
|
||||||
message +=
|
message +=
|
||||||
"Your codebase does not seem to implement an account theme ";
|
"Your codebase does not seem to implement an account theme ";
|
||||||
} else {
|
} else {
|
||||||
message += "Your codebase implements an account theme ";
|
message += "Your codebase implements an account theme ";
|
||||||
}
|
}
|
||||||
|
|
||||||
const { hasAccountTheme } = jarTargets;
|
const { hasAccountTheme } = keycloakVersionTargets;
|
||||||
|
|
||||||
message += `but you have set ${symToStr({ jarTargets })}.${symToStr({ hasAccountTheme })}`;
|
message += `but you have set ${symToStr({ keycloakVersionTargets })}.${symToStr({ hasAccountTheme })}`;
|
||||||
message += ` to ${hasAccountTheme} in your `;
|
message += ` to ${hasAccountTheme} in your `;
|
||||||
message += (() => {
|
message += (() => {
|
||||||
switch (bundler) {
|
switch (bundler) {
|
||||||
@ -624,8 +626,8 @@ export function getBuildContext(params: {
|
|||||||
"and fill up the relevant keycloak version ranges.\n";
|
"and fill up the relevant keycloak version ranges.\n";
|
||||||
message += "Example:\n";
|
message += "Example:\n";
|
||||||
message += JSON.stringify(
|
message += JSON.stringify(
|
||||||
id<Pick<BuildOptions, "jarTargets">>({
|
id<Pick<BuildOptions, "keycloakVersionTargets">>({
|
||||||
jarTargets: {
|
keycloakVersionTargets: {
|
||||||
hasAccountTheme:
|
hasAccountTheme:
|
||||||
recordIsImplementedByThemeType.account,
|
recordIsImplementedByThemeType.account,
|
||||||
...objectFromEntries(
|
...objectFromEntries(
|
||||||
@ -655,7 +657,7 @@ export function getBuildContext(params: {
|
|||||||
|
|
||||||
const jarTargets: BuildContext["jarTargets"] = [];
|
const jarTargets: BuildContext["jarTargets"] = [];
|
||||||
|
|
||||||
const { hasAccountTheme, ...rest } = buildOptions.jarTargets;
|
const { hasAccountTheme, ...rest } = buildOptions.keycloakVersionTargets;
|
||||||
|
|
||||||
for (const [keycloakVersionRange, jarNameOrBoolean] of objectEntries(rest)) {
|
for (const [keycloakVersionRange, jarNameOrBoolean] of objectEntries(rest)) {
|
||||||
if (jarNameOrBoolean === false) {
|
if (jarNameOrBoolean === false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user