keycloakify 10.0.0-rc.118 → 10.0.0-rc.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/bin/{490.index.js → 246.index.js} +20 -2
  2. package/bin/31.index.js +151 -159
  3. package/bin/440.index.js +27 -22
  4. package/bin/526.index.js +168 -56
  5. package/bin/599.index.js +560 -0
  6. package/bin/622.index.js +4 -2
  7. package/bin/{36.index.js → 678.index.js} +577 -71
  8. package/bin/{180.index.js → 697.index.js} +611 -526
  9. package/bin/743.index.js +70 -0
  10. package/bin/780.index.js +729 -0
  11. package/bin/932.index.js +725 -48
  12. package/bin/{966.index.js → 941.index.js} +2 -19
  13. package/bin/main.js +19 -7
  14. package/bin/shared/buildContext.d.ts +28 -19
  15. package/bin/shared/buildContext.js.map +1 -1
  16. package/bin/shared/getLatestsSemVersionedTag.d.ts +10 -0
  17. package/bin/shared/getLatestsSemVersionedTag.js.map +1 -0
  18. package/bin/shared/promptKeycloakVersion.js.map +1 -1
  19. package/package.json +24 -5
  20. package/src/bin/initialize-account-theme/copyBoilerplate.ts +32 -0
  21. package/src/bin/initialize-account-theme/index.ts +1 -0
  22. package/src/bin/initialize-account-theme/initialize-account-theme.ts +95 -0
  23. package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +21 -0
  24. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +150 -0
  25. package/src/bin/initialize-account-theme/src/multi-page/KcContext.ts +12 -0
  26. package/src/bin/initialize-account-theme/src/multi-page/KcPage.tsx +25 -0
  27. package/src/bin/initialize-account-theme/src/multi-page/KcPageStory.tsx +38 -0
  28. package/src/bin/initialize-account-theme/src/multi-page/i18n.ts +5 -0
  29. package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +7 -0
  30. package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +11 -0
  31. package/src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts +92 -0
  32. package/src/bin/keycloakify/buildJars/buildJar.ts +2 -2
  33. package/src/bin/keycloakify/buildJars/buildJars.ts +3 -4
  34. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +26 -20
  35. package/src/bin/keycloakify/keycloakify.ts +1 -1
  36. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +2 -2
  37. package/src/bin/main.ts +14 -0
  38. package/src/bin/shared/buildContext.ts +246 -225
  39. package/src/bin/shared/getLatestsSemVersionedTag.ts +180 -0
  40. package/src/bin/shared/promptKeycloakVersion.ts +8 -77
  41. package/src/bin/start-keycloak/appBuild.ts +13 -9
  42. package/src/bin/tools/downloadAndExtractArchive.ts +4 -2
  43. package/src/bin/tools/npmInstall.ts +63 -0
  44. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +3 -2
  45. package/src/bin/tsconfig.json +3 -1
  46. package/src/vite-plugin/vite-plugin.ts +7 -5
  47. package/vite-plugin/index.js +156 -180
  48. package/vite-plugin/vite-plugin.d.ts +6 -4
@@ -20,11 +20,9 @@ import type { KeycloakVersionRange } from "./KeycloakVersionRange";
20
20
  import { exclude } from "tsafe";
21
21
  import { crawl } from "../tools/crawl";
22
22
  import { THEME_TYPES } from "./constants";
23
- import { objectFromEntries } from "tsafe/objectFromEntries";
24
23
  import { objectEntries } from "tsafe/objectEntries";
25
24
  import { type ThemeType } from "./constants";
26
25
  import { id } from "tsafe/id";
27
- import { symToStr } from "tsafe/symToStr";
28
26
  import chalk from "chalk";
29
27
  import { getProxyFetchOptions, type ProxyFetchOptions } from "../tools/fetchProxyOptions";
30
28
 
@@ -49,23 +47,23 @@ export type BuildContext = {
49
47
  kcContextExclusionsFtlCode: string | undefined;
50
48
  environmentVariables: { name: string; default: string }[];
51
49
  themeSrcDirPath: string;
52
- recordIsImplementedByThemeType: Readonly<Record<ThemeType | "email", boolean>>;
50
+ implementedThemeTypes: {
51
+ login: { isImplemented: boolean };
52
+ email: { isImplemented: boolean };
53
+ account:
54
+ | { isImplemented: false }
55
+ | { isImplemented: true; type: "Single-Page" | "Multi-Page" };
56
+ };
57
+ packageJsonFilePath: string;
58
+ bundler: "vite" | "webpack";
53
59
  jarTargets: {
54
60
  keycloakVersionRange: KeycloakVersionRange;
55
61
  jarFileBasename: string;
56
62
  }[];
57
- bundler:
58
- | {
59
- type: "vite";
60
- }
61
- | {
62
- type: "webpack";
63
- packageJsonDirPath: string;
64
- packageJsonScripts: Record<string, string>;
65
- };
66
- doUseAccountV3: boolean;
67
63
  };
68
64
 
65
+ assert<Equals<keyof BuildContext["implementedThemeTypes"], ThemeType | "email">>();
66
+
69
67
  export type BuildOptions = {
70
68
  themeName?: string | string[];
71
69
  themeVersion?: string;
@@ -76,21 +74,30 @@ export type BuildOptions = {
76
74
  loginThemeResourcesFromKeycloakVersion?: string;
77
75
  keycloakifyBuildDirPath?: string;
78
76
  kcContextExclusionsFtl?: string;
79
- /** https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions */
80
- keycloakVersionTargets?: BuildOptions.KeycloakVersionTargets;
81
- doUseAccountV3?: boolean;
82
- };
77
+ } & BuildOptions.AccountThemeImplAndKeycloakVersionTargets;
83
78
 
84
79
  export namespace BuildOptions {
85
- export type KeycloakVersionTargets =
86
- | ({ hasAccountTheme: true } & Record<
87
- KeycloakVersionRange.WithAccountV1Theme,
88
- string | boolean
89
- >)
90
- | ({ hasAccountTheme: false } & Record<
91
- KeycloakVersionRange.WithoutAccountV1Theme,
92
- string | boolean
93
- >);
80
+ export type AccountThemeImplAndKeycloakVersionTargets =
81
+ | AccountThemeImplAndKeycloakVersionTargets.MultiPageApp
82
+ | AccountThemeImplAndKeycloakVersionTargets.SinglePageAppOrNone;
83
+
84
+ export namespace AccountThemeImplAndKeycloakVersionTargets {
85
+ export type MultiPageApp = {
86
+ accountThemeImplementation: "Multi-Page";
87
+ keycloakVersionTargets?: Record<
88
+ KeycloakVersionRange.WithAccountV1Theme,
89
+ string | boolean
90
+ >;
91
+ };
92
+
93
+ export type SinglePageAppOrNone = {
94
+ accountThemeImplementation: "Single-Page" | "none";
95
+ keycloakVersionTargets?: Record<
96
+ KeycloakVersionRange.WithoutAccountV1Theme,
97
+ string | boolean
98
+ >;
99
+ };
100
+ }
94
101
  }
95
102
 
96
103
  export type ResolvedViteConfig = {
@@ -231,7 +238,6 @@ export function getBuildContext(params: {
231
238
  projectBuildDirPath?: string;
232
239
  staticDirPathInProjectBuildDirPath?: string;
233
240
  publicDirPath?: string;
234
- doUseAccountV3?: boolean;
235
241
  };
236
242
 
237
243
  type ParsedPackageJson = {
@@ -241,85 +247,120 @@ export function getBuildContext(params: {
241
247
  keycloakify?: BuildOptions_packageJson;
242
248
  };
243
249
 
244
- const zParsedPackageJson = z.object({
245
- name: z.string().optional(),
246
- version: z.string().optional(),
247
- homepage: z.string().optional(),
248
- keycloakify: id<z.ZodType<BuildOptions_packageJson>>(
249
- (() => {
250
- const zBuildOptions_packageJson = z.object({
251
- extraThemeProperties: z.array(z.string()).optional(),
252
- artifactId: z.string().optional(),
253
- groupId: z.string().optional(),
254
- loginThemeResourcesFromKeycloakVersion: z.string().optional(),
255
- projectBuildDirPath: z.string().optional(),
256
- keycloakifyBuildDirPath: z.string().optional(),
257
- kcContextExclusionsFtl: z.string().optional(),
258
- environmentVariables: z
259
- .array(
260
- z.object({
261
- name: z.string(),
262
- default: z.string()
263
- })
264
- )
265
- .optional(),
266
- themeName: z.union([z.string(), z.array(z.string())]).optional(),
267
- themeVersion: z.string().optional(),
268
- staticDirPathInProjectBuildDirPath: z.string().optional(),
269
- publicDirPath: z.string().optional(),
270
- keycloakVersionTargets: id<
271
- z.ZodType<BuildOptions.KeycloakVersionTargets>
272
- >(
273
- (() => {
274
- const zKeycloakVersionTargets = z.union([
275
- z.object({
276
- hasAccountTheme: z.literal(true),
277
- "21-and-below": z.union([
278
- z.boolean(),
279
- z.string()
280
- ]),
281
- "23": z.union([z.boolean(), z.string()]),
282
- "24": z.union([z.boolean(), z.string()]),
283
- "25-and-above": z.union([z.boolean(), z.string()])
284
- }),
285
- z.object({
286
- hasAccountTheme: z.literal(false),
287
- "21-and-below": z.union([
288
- z.boolean(),
289
- z.string()
290
- ]),
291
- "22-and-above": z.union([z.boolean(), z.string()])
292
- })
293
- ]);
294
-
295
- {
296
- type Got = z.infer<typeof zKeycloakVersionTargets>;
297
- type Expected = BuildOptions.KeycloakVersionTargets;
298
- assert<Equals<Got, Expected>>();
299
- }
300
-
301
- return zKeycloakVersionTargets;
302
- })()
303
- ).optional(),
304
- doUseAccountV3: z.boolean().optional()
305
- });
250
+ const zMultiPageApp = (() => {
251
+ type TargetType =
252
+ BuildOptions.AccountThemeImplAndKeycloakVersionTargets.MultiPageApp;
253
+
254
+ const zTargetType = z.object({
255
+ accountThemeImplementation: z.literal("Multi-Page"),
256
+ keycloakVersionTargets: z
257
+ .object({
258
+ "21-and-below": z.union([z.boolean(), z.string()]),
259
+ "23": z.union([z.boolean(), z.string()]),
260
+ "24": z.union([z.boolean(), z.string()]),
261
+ "25-and-above": z.union([z.boolean(), z.string()])
262
+ })
263
+ .optional()
264
+ });
265
+
266
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
267
+
268
+ return id<z.ZodType<TargetType>>(zTargetType);
269
+ })();
306
270
 
307
- {
308
- type Got = z.infer<typeof zBuildOptions_packageJson>;
309
- type Expected = BuildOptions_packageJson;
310
- assert<Equals<Got, Expected>>();
311
- }
271
+ const zSinglePageApp = (() => {
272
+ type TargetType =
273
+ BuildOptions.AccountThemeImplAndKeycloakVersionTargets.SinglePageAppOrNone;
274
+
275
+ const zTargetType = z.object({
276
+ accountThemeImplementation: z.union([
277
+ z.literal("Single-Page"),
278
+ z.literal("none")
279
+ ]),
280
+ keycloakVersionTargets: z
281
+ .object({
282
+ "21-and-below": z.union([z.boolean(), z.string()]),
283
+ "22-and-above": z.union([z.boolean(), z.string()])
284
+ })
285
+ .optional()
286
+ });
287
+
288
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
289
+
290
+ return id<z.ZodType<TargetType>>(zTargetType);
291
+ })();
312
292
 
313
- return zBuildOptions_packageJson;
314
- })()
315
- ).optional()
316
- });
293
+ const zAccountThemeImplAndKeycloakVersionTargets = (() => {
294
+ type TargetType = BuildOptions.AccountThemeImplAndKeycloakVersionTargets;
317
295
 
318
- {
319
- type Got = z.infer<typeof zParsedPackageJson>;
320
- type Expected = ParsedPackageJson;
321
- assert<Equals<Got, Expected>>();
322
- }
296
+ const zTargetType = z.union([zMultiPageApp, zSinglePageApp]);
297
+
298
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
299
+
300
+ return id<z.ZodType<TargetType>>(zTargetType);
301
+ })();
302
+
303
+ const zBuildOptions = (() => {
304
+ type TargetType = BuildOptions;
305
+
306
+ const zTargetType = z.intersection(
307
+ z.object({
308
+ themeName: z.union([z.string(), z.array(z.string())]).optional(),
309
+ themeVersion: z.string().optional(),
310
+ environmentVariables: z
311
+ .array(
312
+ z.object({
313
+ name: z.string(),
314
+ default: z.string()
315
+ })
316
+ )
317
+ .optional(),
318
+ extraThemeProperties: z.array(z.string()).optional(),
319
+ artifactId: z.string().optional(),
320
+ groupId: z.string().optional(),
321
+ loginThemeResourcesFromKeycloakVersion: z.string().optional(),
322
+ keycloakifyBuildDirPath: z.string().optional(),
323
+ kcContextExclusionsFtl: z.string().optional()
324
+ }),
325
+ zAccountThemeImplAndKeycloakVersionTargets
326
+ );
327
+
328
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
329
+
330
+ return id<z.ZodType<TargetType>>(zTargetType);
331
+ })();
332
+
333
+ const zBuildOptions_packageJson = (() => {
334
+ type TargetType = BuildOptions_packageJson;
335
+
336
+ const zTargetType = z.intersection(
337
+ zBuildOptions,
338
+ z.object({
339
+ projectBuildDirPath: z.string().optional(),
340
+ staticDirPathInProjectBuildDirPath: z.string().optional(),
341
+ publicDirPath: z.string().optional()
342
+ })
343
+ );
344
+
345
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
346
+
347
+ return id<z.ZodType<TargetType>>(zTargetType);
348
+ })();
349
+
350
+ const zParsedPackageJson = (() => {
351
+ type TargetType = ParsedPackageJson;
352
+
353
+ const zTargetType = z.object({
354
+ name: z.string().optional(),
355
+ version: z.string().optional(),
356
+ homepage: z.string().optional(),
357
+ keycloakify: zBuildOptions_packageJson.optional()
358
+ });
359
+
360
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
361
+
362
+ return id<z.ZodType<TargetType>>(zTargetType);
363
+ })();
323
364
 
324
365
  const configurationPackageJsonFilePath = (() => {
325
366
  const rootPackageJsonFilePath = pathJoin(projectDirPath, "package.json");
@@ -334,17 +375,63 @@ export function getBuildContext(params: {
334
375
  );
335
376
  })();
336
377
 
337
- const buildOptions = {
338
- ...parsedPackageJson.keycloakify,
339
- ...resolvedViteConfig?.buildOptions
378
+ const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
379
+
380
+ if (bundler === "vite" && parsedPackageJson.keycloakify !== undefined) {
381
+ console.error(
382
+ chalk.red(
383
+ `In vite projects, provide your Keycloakify options in vite.config.ts, not in package.json`
384
+ )
385
+ );
386
+ process.exit(-1);
387
+ }
388
+
389
+ const buildOptions: BuildOptions = (() => {
390
+ switch (bundler) {
391
+ case "vite":
392
+ assert(resolvedViteConfig !== undefined);
393
+ return resolvedViteConfig.buildOptions;
394
+ case "webpack":
395
+ assert(parsedPackageJson.keycloakify !== undefined);
396
+ return parsedPackageJson.keycloakify;
397
+ }
398
+ assert<Equals<typeof bundler, never>>(false);
399
+ })();
400
+
401
+ const implementedThemeTypes: BuildContext["implementedThemeTypes"] = {
402
+ login: {
403
+ isImplemented: fs.existsSync(pathJoin(themeSrcDirPath, "login"))
404
+ },
405
+ email: {
406
+ isImplemented: fs.existsSync(pathJoin(themeSrcDirPath, "email"))
407
+ },
408
+ account: (() => {
409
+ if (buildOptions.accountThemeImplementation === "none") {
410
+ return { isImplemented: false };
411
+ }
412
+
413
+ return {
414
+ isImplemented: true,
415
+ type: buildOptions.accountThemeImplementation
416
+ };
417
+ })()
340
418
  };
341
419
 
342
- const recordIsImplementedByThemeType = objectFromEntries(
343
- (["login", "account", "email"] as const).map(themeType => [
344
- themeType,
345
- fs.existsSync(pathJoin(themeSrcDirPath, themeType))
346
- ])
347
- );
420
+ if (
421
+ implementedThemeTypes.account.isImplemented &&
422
+ !fs.existsSync(pathJoin(themeSrcDirPath, "account"))
423
+ ) {
424
+ console.error(
425
+ chalk.red(
426
+ [
427
+ `You have set 'accountThemeImplementation' to '${implementedThemeTypes.account.type}'`,
428
+ `but the 'account' directory is missing in your theme source directory`,
429
+ "Use the `npx keycloakify initialize-account-theme` command to create it"
430
+ ].join(" ")
431
+ )
432
+ );
433
+ process.exit(-1);
434
+ }
348
435
 
349
436
  const themeNames = ((): [string, ...string[]] => {
350
437
  if (buildOptions.themeName === undefined) {
@@ -371,13 +458,15 @@ export function getBuildContext(params: {
371
458
 
372
459
  const projectBuildDirPath = (() => {
373
460
  webpack: {
374
- if (resolvedViteConfig !== undefined) {
461
+ if (bundler !== "webpack") {
375
462
  break webpack;
376
463
  }
377
464
 
378
- if (buildOptions.projectBuildDirPath !== undefined) {
465
+ assert(parsedPackageJson.keycloakify !== undefined);
466
+
467
+ if (parsedPackageJson.keycloakify.projectBuildDirPath !== undefined) {
379
468
  return getAbsoluteAndInOsFormatPath({
380
- pathIsh: buildOptions.projectBuildDirPath,
469
+ pathIsh: parsedPackageJson.keycloakify.projectBuildDirPath,
381
470
  cwd: projectDirPath
382
471
  });
383
472
  }
@@ -385,34 +474,15 @@ export function getBuildContext(params: {
385
474
  return pathJoin(projectDirPath, "build");
386
475
  }
387
476
 
477
+ assert(bundler === "vite");
478
+ assert(resolvedViteConfig !== undefined);
479
+
388
480
  return pathJoin(projectDirPath, resolvedViteConfig.buildDir);
389
481
  })();
390
482
 
391
- const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
392
-
393
- const doUseAccountV3 = buildOptions.doUseAccountV3 ?? false;
394
-
395
483
  return {
396
- bundler:
397
- resolvedViteConfig !== undefined
398
- ? { type: "vite" }
399
- : (() => {
400
- const { scripts } = z
401
- .object({
402
- scripts: z.record(z.string()).optional()
403
- })
404
- .parse(
405
- JSON.parse(
406
- fs.readFileSync(packageJsonFilePath).toString("utf8")
407
- )
408
- );
409
-
410
- return {
411
- type: "webpack",
412
- packageJsonDirPath: pathDirname(packageJsonFilePath),
413
- packageJsonScripts: scripts ?? {}
414
- };
415
- })(),
484
+ bundler,
485
+ packageJsonFilePath,
416
486
  themeVersion: buildOptions.themeVersion ?? parsedPackageJson.version ?? "0.0.0",
417
487
  themeNames,
418
488
  extraThemeProperties: buildOptions.extraThemeProperties,
@@ -463,13 +533,15 @@ export function getBuildContext(params: {
463
533
  }
464
534
 
465
535
  webpack: {
466
- if (resolvedViteConfig !== undefined) {
536
+ if (bundler !== "webpack") {
467
537
  break webpack;
468
538
  }
469
539
 
470
- if (buildOptions.publicDirPath !== undefined) {
540
+ assert(parsedPackageJson.keycloakify !== undefined);
541
+
542
+ if (parsedPackageJson.keycloakify.publicDirPath !== undefined) {
471
543
  return getAbsoluteAndInOsFormatPath({
472
- pathIsh: buildOptions.publicDirPath,
544
+ pathIsh: parsedPackageJson.keycloakify.publicDirPath,
473
545
  cwd: projectDirPath
474
546
  });
475
547
  }
@@ -477,6 +549,9 @@ export function getBuildContext(params: {
477
549
  return pathJoin(projectDirPath, "public");
478
550
  }
479
551
 
552
+ assert(bundler === "vite");
553
+ assert(resolvedViteConfig !== undefined);
554
+
480
555
  return pathJoin(projectDirPath, resolvedViteConfig.publicDir);
481
556
  })(),
482
557
  cacheDirPath: (() => {
@@ -502,7 +577,7 @@ export function getBuildContext(params: {
502
577
  })(),
503
578
  urlPathname: (() => {
504
579
  webpack: {
505
- if (resolvedViteConfig !== undefined) {
580
+ if (bundler !== "webpack") {
506
581
  break webpack;
507
582
  }
508
583
 
@@ -522,23 +597,35 @@ export function getBuildContext(params: {
522
597
  return out === "/" ? undefined : out;
523
598
  }
524
599
 
600
+ assert(bundler === "vite");
601
+ assert(resolvedViteConfig !== undefined);
602
+
525
603
  return resolvedViteConfig.urlPathname;
526
604
  })(),
527
605
  assetsDirPath: (() => {
528
606
  webpack: {
529
- if (resolvedViteConfig !== undefined) {
607
+ if (bundler !== "webpack") {
530
608
  break webpack;
531
609
  }
532
610
 
533
- if (buildOptions.staticDirPathInProjectBuildDirPath !== undefined) {
611
+ assert(parsedPackageJson.keycloakify !== undefined);
612
+
613
+ if (
614
+ parsedPackageJson.keycloakify.staticDirPathInProjectBuildDirPath !==
615
+ undefined
616
+ ) {
534
617
  getAbsoluteAndInOsFormatPath({
535
- pathIsh: buildOptions.staticDirPathInProjectBuildDirPath,
618
+ pathIsh:
619
+ parsedPackageJson.keycloakify
620
+ .staticDirPathInProjectBuildDirPath,
536
621
  cwd: projectBuildDirPath
537
622
  });
538
623
  }
539
624
 
540
625
  return pathJoin(projectBuildDirPath, "static");
541
626
  }
627
+ assert(bundler === "vite");
628
+ assert(resolvedViteConfig !== undefined);
542
629
 
543
630
  return pathJoin(projectBuildDirPath, resolvedViteConfig.assetsDir);
544
631
  })(),
@@ -559,7 +646,7 @@ export function getBuildContext(params: {
559
646
  return buildOptions.kcContextExclusionsFtl;
560
647
  })(),
561
648
  environmentVariables: buildOptions.environmentVariables ?? [],
562
- recordIsImplementedByThemeType,
649
+ implementedThemeTypes,
563
650
  themeSrcDirPath,
564
651
  fetchOptions: getProxyFetchOptions({
565
652
  npmConfigGetCwd: (function callee(upCount: number): string {
@@ -613,10 +700,10 @@ export function getBuildContext(params: {
613
700
  }
614
701
 
615
702
  const keycloakVersionRange: KeycloakVersionRange = (() => {
616
- const doesImplementAccountV1Theme =
617
- !doUseAccountV3 && recordIsImplementedByThemeType.account;
618
-
619
- if (doesImplementAccountV1Theme) {
703
+ if (
704
+ implementedThemeTypes.account.isImplemented &&
705
+ implementedThemeTypes.account.type === "Multi-Page"
706
+ ) {
620
707
  const keycloakVersionRange = (() => {
621
708
  if (buildForKeycloakMajorVersionNumber <= 21) {
622
709
  return "21-and-below" as const;
@@ -703,7 +790,10 @@ export function getBuildContext(params: {
703
790
  const jarTargets_default = (() => {
704
791
  const jarTargets: BuildContext["jarTargets"] = [];
705
792
 
706
- if (!doUseAccountV3 && recordIsImplementedByThemeType.account) {
793
+ if (
794
+ implementedThemeTypes.account.isImplemented &&
795
+ implementedThemeTypes.account.type === "Multi-Page"
796
+ ) {
707
797
  for (const keycloakVersionRange of [
708
798
  "21-and-below",
709
799
  "23",
@@ -748,79 +838,11 @@ export function getBuildContext(params: {
748
838
  return jarTargets_default;
749
839
  }
750
840
 
751
- if (
752
- buildOptions.keycloakVersionTargets.hasAccountTheme !== doUseAccountV3
753
- ? false
754
- : recordIsImplementedByThemeType.account
755
- ) {
756
- console.log(
757
- chalk.red(
758
- (() => {
759
- const { keycloakVersionTargets } = buildOptions;
760
-
761
- let message = `Bad ${symToStr({ keycloakVersionTargets })} configuration.\n`;
762
-
763
- if (keycloakVersionTargets.hasAccountTheme) {
764
- message +=
765
- "Your codebase does not seem to implement an account theme ";
766
- } else {
767
- message += "Your codebase implements an account theme ";
768
- }
769
-
770
- const { hasAccountTheme } = keycloakVersionTargets;
771
-
772
- message += `but you have set ${symToStr({ keycloakVersionTargets })}.${symToStr({ hasAccountTheme })}`;
773
- message += ` to ${hasAccountTheme} in your `;
774
- message += (() => {
775
- switch (bundler) {
776
- case "vite":
777
- return "vite.config.ts";
778
- case "webpack":
779
- return "package.json";
780
- }
781
- assert<Equals<typeof bundler, never>>(false);
782
- })();
783
- message += `. Please set it to ${!hasAccountTheme} `;
784
- message +=
785
- "and fill up the relevant keycloak version ranges.\n";
786
- message += "Example:\n";
787
- message += JSON.stringify(
788
- id<Pick<BuildOptions, "keycloakVersionTargets">>({
789
- keycloakVersionTargets: {
790
- hasAccountTheme:
791
- recordIsImplementedByThemeType.account,
792
- ...objectFromEntries(
793
- jarTargets_default.map(
794
- ({
795
- keycloakVersionRange,
796
- jarFileBasename
797
- }) => [
798
- keycloakVersionRange,
799
- jarFileBasename
800
- ]
801
- )
802
- )
803
- }
804
- }),
805
- null,
806
- 2
807
- );
808
- message +=
809
- "\nSee: https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions";
810
-
811
- return message;
812
- })()
813
- )
814
- );
815
-
816
- process.exit(1);
817
- }
818
-
819
841
  const jarTargets: BuildContext["jarTargets"] = [];
820
842
 
821
- const { hasAccountTheme, ...rest } = buildOptions.keycloakVersionTargets;
822
-
823
- for (const [keycloakVersionRange, jarNameOrBoolean] of objectEntries(rest)) {
843
+ for (const [keycloakVersionRange, jarNameOrBoolean] of objectEntries(
844
+ buildOptions.keycloakVersionTargets
845
+ )) {
824
846
  if (jarNameOrBoolean === false) {
825
847
  continue;
826
848
  }
@@ -871,7 +893,6 @@ export function getBuildContext(params: {
871
893
  }
872
894
 
873
895
  return jarTargets;
874
- })(),
875
- doUseAccountV3
896
+ })()
876
897
  };
877
898
  }