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
@@ -0,0 +1,150 @@
1
+ import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
2
+ import type { BuildContext } from "../shared/buildContext";
3
+ import * as fs from "fs";
4
+ import chalk from "chalk";
5
+ import { getLatestsSemVersionedTag } from "../shared/getLatestsSemVersionedTag";
6
+ import fetch from "make-fetch-happen";
7
+ import { z } from "zod";
8
+ import { assert, type Equals } from "tsafe/assert";
9
+ import { is } from "tsafe/is";
10
+ import { id } from "tsafe/id";
11
+ import { npmInstall } from "../tools/npmInstall";
12
+ import { copyBoilerplate } from "./copyBoilerplate";
13
+ import { getThisCodebaseRootDirPath } from "../tools/getThisCodebaseRootDirPath";
14
+
15
+ type BuildContextLike = {
16
+ cacheDirPath: string;
17
+ fetchOptions: BuildContext["fetchOptions"];
18
+ packageJsonFilePath: string;
19
+ };
20
+
21
+ assert<BuildContext extends BuildContextLike ? true : false>();
22
+
23
+ export async function initializeAccountTheme_singlePage(params: {
24
+ accountThemeSrcDirPath: string;
25
+ buildContext: BuildContextLike;
26
+ }) {
27
+ const { accountThemeSrcDirPath, buildContext } = params;
28
+
29
+ const OWNER = "keycloakify";
30
+ const REPO = "keycloak-account-ui";
31
+
32
+ const [semVersionedTag] = await getLatestsSemVersionedTag({
33
+ cacheDirPath: buildContext.cacheDirPath,
34
+ owner: OWNER,
35
+ repo: REPO,
36
+ count: 1,
37
+ doIgnoreReleaseCandidates: false
38
+ });
39
+
40
+ const dependencies = await fetch(
41
+ `https://raw.githubusercontent.com/${OWNER}/${REPO}/${semVersionedTag.tag}/dependencies.gen.json`,
42
+ buildContext.fetchOptions
43
+ )
44
+ .then(r => r.json())
45
+ .then(
46
+ (() => {
47
+ type Dependencies = {
48
+ dependencies: Record<string, string>;
49
+ devDependencies?: Record<string, string>;
50
+ };
51
+
52
+ const zDependencies = (() => {
53
+ type TargetType = Dependencies;
54
+
55
+ const zTargetType = z.object({
56
+ dependencies: z.record(z.string()),
57
+ devDependencies: z.record(z.string()).optional()
58
+ });
59
+
60
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
61
+
62
+ return id<z.ZodType<TargetType>>(zTargetType);
63
+ })();
64
+
65
+ return o => zDependencies.parse(o);
66
+ })()
67
+ );
68
+
69
+ dependencies.dependencies["@keycloakify/keycloak-account-ui"] = semVersionedTag.tag;
70
+
71
+ const parsedPackageJson = (() => {
72
+ type ParsedPackageJson = {
73
+ dependencies?: Record<string, string>;
74
+ devDependencies?: Record<string, string>;
75
+ };
76
+
77
+ const zParsedPackageJson = (() => {
78
+ type TargetType = ParsedPackageJson;
79
+
80
+ const zTargetType = z.object({
81
+ dependencies: z.record(z.string()).optional(),
82
+ devDependencies: z.record(z.string()).optional()
83
+ });
84
+
85
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
86
+
87
+ return id<z.ZodType<TargetType>>(zTargetType);
88
+ })();
89
+ const parsedPackageJson = JSON.parse(
90
+ fs.readFileSync(buildContext.packageJsonFilePath).toString("utf8")
91
+ );
92
+
93
+ zParsedPackageJson.parse(parsedPackageJson);
94
+
95
+ assert(is<ParsedPackageJson>(parsedPackageJson));
96
+
97
+ return parsedPackageJson;
98
+ })();
99
+
100
+ parsedPackageJson.dependencies = {
101
+ ...parsedPackageJson.dependencies,
102
+ ...dependencies.dependencies
103
+ };
104
+
105
+ parsedPackageJson.devDependencies = {
106
+ ...parsedPackageJson.devDependencies,
107
+ ...dependencies.devDependencies
108
+ };
109
+
110
+ if (Object.keys(parsedPackageJson.devDependencies).length === 0) {
111
+ delete parsedPackageJson.devDependencies;
112
+ }
113
+
114
+ fs.writeFileSync(
115
+ buildContext.packageJsonFilePath,
116
+ JSON.stringify(parsedPackageJson, undefined, 4)
117
+ );
118
+
119
+ run_npm_install: {
120
+ if (
121
+ JSON.parse(
122
+ fs
123
+ .readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json"))
124
+ .toString("utf8")
125
+ )["version"] === "0.0.0"
126
+ ) {
127
+ //NOTE: Linked version
128
+ break run_npm_install;
129
+ }
130
+
131
+ npmInstall({ packageJsonDirPath: pathDirname(buildContext.packageJsonFilePath) });
132
+ }
133
+
134
+ copyBoilerplate({
135
+ accountThemeType: "Single-Page",
136
+ accountThemeSrcDirPath
137
+ });
138
+
139
+ console.log(
140
+ [
141
+ chalk.green(
142
+ "The Single-Page account theme has been successfully initialized."
143
+ ),
144
+ `Using Account UI of Keycloak version: ${chalk.bold(semVersionedTag.tag.split("-")[0])}`,
145
+ `Directory created: ${chalk.bold(pathRelative(process.cwd(), accountThemeSrcDirPath))}`,
146
+ `Dependencies added to your project's package.json: `,
147
+ chalk.bold(JSON.stringify(dependencies, null, 2))
148
+ ].join("\n")
149
+ );
150
+ }
@@ -0,0 +1,12 @@
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ import type { ExtendKcContext } from "keycloakify/account";
3
+ import type { KcEnvName, ThemeName } from "../kc.gen";
4
+
5
+ export type KcContextExtension = {
6
+ themeName: ThemeName;
7
+ properties: Record<KcEnvName, string> & {};
8
+ };
9
+
10
+ export type KcContextExtensionPerPage = {};
11
+
12
+ export type KcContext = ExtendKcContext<KcContextExtension, KcContextExtensionPerPage>;
@@ -0,0 +1,25 @@
1
+ import { Suspense } from "react";
2
+ import type { ClassKey } from "keycloakify/account";
3
+ import type { KcContext } from "./KcContext";
4
+ import { useI18n } from "./i18n";
5
+ import DefaultPage from "keycloakify/account/DefaultPage";
6
+ import Template from "keycloakify/account/Template";
7
+
8
+ export default function KcPage(props: { kcContext: KcContext }) {
9
+ const { kcContext } = props;
10
+
11
+ const { i18n } = useI18n({ kcContext });
12
+
13
+ return (
14
+ <Suspense>
15
+ {(() => {
16
+ switch (kcContext.pageId) {
17
+ default:
18
+ return <DefaultPage kcContext={kcContext} i18n={i18n} classes={classes} Template={Template} doUseDefaultCss={true} />;
19
+ }
20
+ })()}
21
+ </Suspense>
22
+ );
23
+ }
24
+
25
+ const classes = {} satisfies { [key in ClassKey]?: string };
@@ -0,0 +1,38 @@
1
+ import type { DeepPartial } from "keycloakify/tools/DeepPartial";
2
+ import type { KcContext } from "./KcContext";
3
+ import { createGetKcContextMock } from "keycloakify/account/KcContext";
4
+ import type { KcContextExtension, KcContextExtensionPerPage } from "./KcContext";
5
+ import KcPage from "./KcPage";
6
+ import { themeNames, kcEnvDefaults } from "../kc.gen";
7
+
8
+ const kcContextExtension: KcContextExtension = {
9
+ themeName: themeNames[0],
10
+ properties: {
11
+ ...kcEnvDefaults
12
+ }
13
+ };
14
+ const kcContextExtensionPerPage: KcContextExtensionPerPage = {};
15
+
16
+ export const { getKcContextMock } = createGetKcContextMock({
17
+ kcContextExtension,
18
+ kcContextExtensionPerPage,
19
+ overrides: {},
20
+ overridesPerPage: {}
21
+ });
22
+
23
+ export function createKcPageStory<PageId extends KcContext["pageId"]>(params: { pageId: PageId }) {
24
+ const { pageId } = params;
25
+
26
+ function KcPageStory(props: { kcContext?: DeepPartial<Extract<KcContext, { pageId: PageId }>> }) {
27
+ const { kcContext: overrides } = props;
28
+
29
+ const kcContextMock = getKcContextMock({
30
+ pageId,
31
+ overrides
32
+ });
33
+
34
+ return <KcPage kcContext={kcContextMock} />;
35
+ }
36
+
37
+ return { KcPageStory };
38
+ }
@@ -0,0 +1,5 @@
1
+ import { createUseI18n } from "keycloakify/account";
2
+
3
+ export const { useI18n, ofTypeI18n } = createUseI18n({});
4
+
5
+ export type I18n = typeof ofTypeI18n;
@@ -0,0 +1,7 @@
1
+ import type { KcContextLike } from "@keycloakify/keycloak-account-ui";
2
+ import type { KcEnvName } from "../kc.gen";
3
+
4
+ export type KcContext = KcContextLike & {
5
+ themeType: "account";
6
+ properties: Record<KcEnvName, string>;
7
+ };
@@ -0,0 +1,11 @@
1
+ import { lazy } from "react";
2
+ import { KcAccountUiLoader } from "@keycloakify/keycloak-account-ui";
3
+ import type { KcContext } from "./KcContext";
4
+
5
+ const KcAccountUi = lazy(() => import("@keycloakify/keycloak-account-ui/KcAccountUi"));
6
+
7
+ export default function KcPage(props: { kcContext: KcContext }) {
8
+ const { kcContext } = props;
9
+
10
+ return <KcAccountUiLoader kcContext={kcContext} KcAccountUi={KcAccountUi} />;
11
+ }
@@ -0,0 +1,92 @@
1
+ import { join as pathJoin } from "path";
2
+ import { assert, type Equals } from "tsafe/assert";
3
+ import type { BuildContext } from "../shared/buildContext";
4
+ import * as fs from "fs";
5
+ import chalk from "chalk";
6
+ import { z } from "zod";
7
+ import { id } from "tsafe/id";
8
+
9
+ export type BuildContextLike = {
10
+ bundler: BuildContext["bundler"];
11
+ };
12
+
13
+ assert<BuildContext extends BuildContextLike ? true : false>();
14
+
15
+ export function updateAccountThemeImplementationInConfig(params: {
16
+ buildContext: BuildContext;
17
+ accountThemeType: "Single-Page" | "Multi-Page";
18
+ }) {
19
+ const { buildContext, accountThemeType } = params;
20
+
21
+ switch (buildContext.bundler) {
22
+ case "vite":
23
+ {
24
+ const viteConfigPath = pathJoin(
25
+ buildContext.projectDirPath,
26
+ "vite.config.ts"
27
+ );
28
+
29
+ if (!fs.existsSync(viteConfigPath)) {
30
+ console.log(
31
+ chalk.bold(
32
+ `You must manually set the accountThemeImplementation to "${accountThemeType}" in your vite config`
33
+ )
34
+ );
35
+ break;
36
+ }
37
+
38
+ const viteConfigContent = fs
39
+ .readFileSync(viteConfigPath)
40
+ .toString("utf8");
41
+
42
+ const modifiedViteConfigContent = viteConfigContent.replace(
43
+ /accountThemeImplementation\s*:\s*"none"/,
44
+ `accountThemeImplementation: "${accountThemeType}"`
45
+ );
46
+
47
+ if (modifiedViteConfigContent === viteConfigContent) {
48
+ console.log(
49
+ chalk.bold(
50
+ `You must manually set the accountThemeImplementation to "${accountThemeType}" in your vite.config.ts`
51
+ )
52
+ );
53
+ break;
54
+ }
55
+
56
+ fs.writeFileSync(viteConfigPath, modifiedViteConfigContent);
57
+ }
58
+ break;
59
+ case "webpack":
60
+ {
61
+ const parsedPackageJson = (() => {
62
+ type ParsedPackageJson = {
63
+ keycloakify: Record<string, string>;
64
+ };
65
+
66
+ const zParsedPackageJson = (() => {
67
+ type TargetType = ParsedPackageJson;
68
+
69
+ const zTargetType = z.object({
70
+ keycloakify: z.record(z.string())
71
+ });
72
+
73
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
74
+
75
+ return id<z.ZodType<TargetType>>(zTargetType);
76
+ })();
77
+
78
+ return zParsedPackageJson.parse(
79
+ JSON.parse(
80
+ fs
81
+ .readFileSync(buildContext.packageJsonFilePath)
82
+ .toString("utf8")
83
+ )
84
+ );
85
+ })();
86
+
87
+ parsedPackageJson.keycloakify.accountThemeImplementation =
88
+ accountThemeType;
89
+ }
90
+ break;
91
+ }
92
+ }
@@ -24,7 +24,7 @@ export type BuildContextLike = BuildContextLike_generatePom & {
24
24
  artifactId: string;
25
25
  themeVersion: string;
26
26
  cacheDirPath: string;
27
- recordIsImplementedByThemeType: BuildContext["recordIsImplementedByThemeType"];
27
+ implementedThemeTypes: BuildContext["implementedThemeTypes"];
28
28
  };
29
29
 
30
30
  assert<BuildContext extends BuildContextLike ? true : false>();
@@ -135,7 +135,7 @@ export async function buildJar(params: {
135
135
  }
136
136
 
137
137
  route_legacy_pages: {
138
- if (!buildContext.recordIsImplementedByThemeType.login) {
138
+ if (!buildContext.implementedThemeTypes.login.isImplemented) {
139
139
  break route_legacy_pages;
140
140
  }
141
141
 
@@ -10,9 +10,8 @@ import type { BuildContext } from "../../shared/buildContext";
10
10
  export type BuildContextLike = BuildContextLike_buildJar & {
11
11
  projectDirPath: string;
12
12
  keycloakifyBuildDirPath: string;
13
- recordIsImplementedByThemeType: BuildContext["recordIsImplementedByThemeType"];
13
+ implementedThemeTypes: BuildContext["implementedThemeTypes"];
14
14
  jarTargets: BuildContext["jarTargets"];
15
- doUseAccountV3: boolean;
16
15
  };
17
16
 
18
17
  assert<BuildContext extends BuildContextLike ? true : false>();
@@ -24,8 +23,8 @@ export async function buildJars(params: {
24
23
  const { resourcesDirPath, buildContext } = params;
25
24
 
26
25
  const doesImplementAccountV1Theme =
27
- buildContext.recordIsImplementedByThemeType.account &&
28
- !buildContext.doUseAccountV3;
26
+ buildContext.implementedThemeTypes.account.isImplemented &&
27
+ buildContext.implementedThemeTypes.account.type === "Multi-Page";
29
28
 
30
29
  await Promise.all(
31
30
  keycloakAccountV1Versions
@@ -53,10 +53,9 @@ export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
53
53
  projectDirPath: string;
54
54
  projectBuildDirPath: string;
55
55
  environmentVariables: { name: string; default: string }[];
56
- recordIsImplementedByThemeType: BuildContext["recordIsImplementedByThemeType"];
56
+ implementedThemeTypes: BuildContext["implementedThemeTypes"];
57
57
  themeSrcDirPath: string;
58
- bundler: { type: "vite" } | { type: "webpack" };
59
- doUseAccountV3: boolean;
58
+ bundler: "vite" | "webpack";
60
59
  };
61
60
 
62
61
  assert<BuildContext extends BuildContextLike ? true : false>();
@@ -74,11 +73,15 @@ export async function generateResourcesForMainTheme(params: {
74
73
  };
75
74
 
76
75
  for (const themeType of ["login", "account"] as const) {
77
- const isAccountV3 = themeType === "account" && buildContext.doUseAccountV3;
78
- if (!buildContext.recordIsImplementedByThemeType[themeType]) {
76
+ if (!buildContext.implementedThemeTypes[themeType].isImplemented) {
79
77
  continue;
80
78
  }
81
79
 
80
+ const isForAccountSpa =
81
+ themeType === "account" &&
82
+ (assert(buildContext.implementedThemeTypes.account.isImplemented),
83
+ buildContext.implementedThemeTypes.account.type === "Single-Page");
84
+
82
85
  const themeTypeDirPath = getThemeTypeDirPath({ themeType });
83
86
 
84
87
  apply_replacers_and_move_to_theme_resources: {
@@ -93,7 +96,7 @@ export async function generateResourcesForMainTheme(params: {
93
96
 
94
97
  if (
95
98
  themeType === "account" &&
96
- buildContext.recordIsImplementedByThemeType.login
99
+ buildContext.implementedThemeTypes.login.isImplemented
97
100
  ) {
98
101
  // NOTE: We prevent doing it twice, it has been done for the login theme.
99
102
 
@@ -118,7 +121,7 @@ export async function generateResourcesForMainTheme(params: {
118
121
  );
119
122
 
120
123
  if (fs.existsSync(dirPath)) {
121
- assert(buildContext.bundler.type === "webpack");
124
+ assert(buildContext.bundler === "webpack");
122
125
 
123
126
  throw new Error(
124
127
  [
@@ -184,10 +187,10 @@ export async function generateResourcesForMainTheme(params: {
184
187
  case "login":
185
188
  return LOGIN_THEME_PAGE_IDS;
186
189
  case "account":
187
- return isAccountV3 ? ["index.ftl"] : ACCOUNT_THEME_PAGE_IDS;
190
+ return isForAccountSpa ? ["index.ftl"] : ACCOUNT_THEME_PAGE_IDS;
188
191
  }
189
192
  })(),
190
- ...(isAccountV3
193
+ ...(isForAccountSpa
191
194
  ? []
192
195
  : readExtraPagesNames({
193
196
  themeType,
@@ -203,7 +206,7 @@ export async function generateResourcesForMainTheme(params: {
203
206
  });
204
207
 
205
208
  i18n_messages_generation: {
206
- if (isAccountV3) {
209
+ if (isForAccountSpa) {
207
210
  break i18n_messages_generation;
208
211
  }
209
212
 
@@ -230,7 +233,7 @@ export async function generateResourcesForMainTheme(params: {
230
233
  }
231
234
 
232
235
  keycloak_static_resources: {
233
- if (isAccountV3) {
236
+ if (isForAccountSpa) {
234
237
  break keycloak_static_resources;
235
238
  }
236
239
 
@@ -256,13 +259,13 @@ export async function generateResourcesForMainTheme(params: {
256
259
  `parent=${(() => {
257
260
  switch (themeType) {
258
261
  case "account":
259
- return isAccountV3 ? "base" : ACCOUNT_V1_THEME_NAME;
262
+ return isForAccountSpa ? "base" : ACCOUNT_V1_THEME_NAME;
260
263
  case "login":
261
264
  return "keycloak";
262
265
  }
263
266
  assert<Equals<typeof themeType, never>>(false);
264
267
  })()}`,
265
- ...(isAccountV3 ? ["deprecatedMode=false"] : []),
268
+ ...(isForAccountSpa ? ["deprecatedMode=false"] : []),
266
269
  ...(buildContext.extraThemeProperties ?? []),
267
270
  ...buildContext.environmentVariables.map(
268
271
  ({ name, default: defaultValue }) =>
@@ -275,7 +278,7 @@ export async function generateResourcesForMainTheme(params: {
275
278
  }
276
279
 
277
280
  email: {
278
- if (!buildContext.recordIsImplementedByThemeType.email) {
281
+ if (!buildContext.implementedThemeTypes.email.isImplemented) {
279
282
  break email;
280
283
  }
281
284
 
@@ -288,11 +291,11 @@ export async function generateResourcesForMainTheme(params: {
288
291
  }
289
292
 
290
293
  bring_in_account_v1: {
291
- if (buildContext.doUseAccountV3) {
294
+ if (!buildContext.implementedThemeTypes.account.isImplemented) {
292
295
  break bring_in_account_v1;
293
296
  }
294
297
 
295
- if (!buildContext.recordIsImplementedByThemeType.account) {
298
+ if (buildContext.implementedThemeTypes.account.type !== "Multi-Page") {
296
299
  break bring_in_account_v1;
297
300
  }
298
301
 
@@ -303,7 +306,10 @@ export async function generateResourcesForMainTheme(params: {
303
306
  }
304
307
 
305
308
  bring_in_account_v3_i18n_messages: {
306
- if (!buildContext.doUseAccountV3) {
309
+ if (!buildContext.implementedThemeTypes.account.isImplemented) {
310
+ break bring_in_account_v3_i18n_messages;
311
+ }
312
+ if (buildContext.implementedThemeTypes.account.type !== "Single-Page") {
307
313
  break bring_in_account_v3_i18n_messages;
308
314
  }
309
315
 
@@ -340,12 +346,12 @@ export async function generateResourcesForMainTheme(params: {
340
346
 
341
347
  metaInfKeycloakThemes.themes.push({
342
348
  name: themeName,
343
- types: objectEntries(buildContext.recordIsImplementedByThemeType)
344
- .filter(([, isImplemented]) => isImplemented)
349
+ types: objectEntries(buildContext.implementedThemeTypes)
350
+ .filter(([, { isImplemented }]) => isImplemented)
345
351
  .map(([themeType]) => themeType)
346
352
  });
347
353
 
348
- if (buildContext.recordIsImplementedByThemeType.account) {
354
+ if (buildContext.implementedThemeTypes.account.isImplemented) {
349
355
  metaInfKeycloakThemes.themes.push({
350
356
  name: ACCOUNT_V1_THEME_NAME,
351
357
  types: ["account"]
@@ -85,7 +85,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
85
85
  });
86
86
 
87
87
  run_post_build_script: {
88
- if (buildContext.bundler.type !== "vite") {
88
+ if (buildContext.bundler !== "vite") {
89
89
  break run_post_build_script;
90
90
  }
91
91
 
@@ -8,7 +8,7 @@ export type BuildContextLike = {
8
8
  projectBuildDirPath: string;
9
9
  assetsDirPath: string;
10
10
  urlPathname: string | undefined;
11
- bundler: { type: "vite" } | { type: "webpack" };
11
+ bundler: "vite" | "webpack";
12
12
  };
13
13
 
14
14
  assert<BuildContext extends BuildContextLike ? true : false>();
@@ -20,7 +20,7 @@ export function replaceImportsInJsCode(params: {
20
20
  const { jsCode, buildContext } = params;
21
21
 
22
22
  const { fixedJsCode } = (() => {
23
- switch (buildContext.bundler.type) {
23
+ switch (buildContext.bundler) {
24
24
  case "vite":
25
25
  return replaceImportsInJsCode_vite({
26
26
  jsCode,
package/src/bin/main.ts CHANGED
@@ -179,6 +179,20 @@ program
179
179
  }
180
180
  });
181
181
 
182
+ program
183
+ .command({
184
+ name: "initialize-account-theme",
185
+ description: "Initialize the account theme."
186
+ })
187
+ .task({
188
+ skip,
189
+ handler: async cliCommandOptions => {
190
+ const { command } = await import("./initialize-account-theme");
191
+
192
+ await command({ cliCommandOptions });
193
+ }
194
+ });
195
+
182
196
  program
183
197
  .command({
184
198
  name: "copy-keycloak-resources-to-public",