keycloakify 10.0.0-rc.65 → 10.0.0-rc.66

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 (38) hide show
  1. package/bin/193.index.js +51 -0
  2. package/bin/246.index.js +371 -75118
  3. package/bin/363.index.js +64 -165
  4. package/bin/453.index.js +603 -23
  5. package/bin/{890.index.js → 456.index.js} +1831 -3
  6. package/bin/490.index.js +75195 -0
  7. package/bin/526.index.js +294 -173
  8. package/bin/538.index.js +1 -509
  9. package/bin/{203.index.js → 751.index.js} +306 -305
  10. package/bin/772.index.js +1 -1
  11. package/bin/{190.index.js → 837.index.js} +259 -35
  12. package/bin/932.index.js +1 -578
  13. package/bin/97.index.js +594 -14
  14. package/bin/main.js +8 -8
  15. package/bin/shared/buildContext.d.ts +16 -0
  16. package/bin/shared/constants.d.ts +1 -1
  17. package/bin/shared/constants.js +1 -1
  18. package/bin/shared/constants.js.map +1 -1
  19. package/package.json +5 -10
  20. package/src/bin/add-story.ts +1 -6
  21. package/src/bin/eject-page.ts +7 -8
  22. package/src/bin/initialize-email-theme.ts +1 -6
  23. package/src/bin/keycloakify/buildJars/buildJars.ts +23 -49
  24. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +15 -20
  25. package/src/bin/keycloakify/keycloakify.ts +6 -8
  26. package/src/bin/shared/buildContext.ts +434 -42
  27. package/src/bin/shared/constants.ts +2 -1
  28. package/src/bin/shared/generateKcGenTs.ts +2 -6
  29. package/src/bin/start-keycloak/keycloakifyBuild.ts +4 -4
  30. package/src/bin/start-keycloak/start-keycloak.ts +40 -83
  31. package/src/vite-plugin/vite-plugin.ts +5 -4
  32. package/vite-plugin/index.js +341 -117
  33. package/bin/480.index.js +0 -466
  34. package/bin/818.index.js +0 -1802
  35. package/bin/827.index.js +0 -1094
  36. package/src/bin/shared/getImplementedThemeTypes.ts +0 -38
  37. package/src/bin/shared/getJarFileBasename.ts +0 -11
  38. package/src/bin/shared/getThemeSrcDirPath.ts +0 -62
package/bin/main.js CHANGED
@@ -7666,7 +7666,7 @@ var _DefaultRenderer = class _DefaultRenderer {
7666
7666
  async render() {
7667
7667
  const { createLogUpdate } = await Promise.all(/* import() */[__nccwpck_require__.e(509), __nccwpck_require__.e(772)]).then(__nccwpck_require__.bind(__nccwpck_require__, 41772));
7668
7668
  const { default: truncate } = await Promise.all(/* import() */[__nccwpck_require__.e(509), __nccwpck_require__.e(420)]).then(__nccwpck_require__.bind(__nccwpck_require__, 32420));
7669
- const { default: wrap } = await Promise.all(/* import() */[__nccwpck_require__.e(509), __nccwpck_require__.e(480)]).then(__nccwpck_require__.bind(__nccwpck_require__, 19246));
7669
+ const { default: wrap } = await Promise.all(/* import() */[__nccwpck_require__.e(509), __nccwpck_require__.e(246)]).then(__nccwpck_require__.bind(__nccwpck_require__, 19246));
7670
7670
  this.updater = createLogUpdate(this.logger.process.stdout);
7671
7671
  this.truncate = truncate;
7672
7672
  this.wrap = wrap;
@@ -9213,7 +9213,7 @@ program
9213
9213
  .task({
9214
9214
  skip,
9215
9215
  handler: async (cliCommandOptions) => {
9216
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(890), __nccwpck_require__.e(818), __nccwpck_require__.e(430), __nccwpck_require__.e(525), __nccwpck_require__.e(246), __nccwpck_require__.e(203), __nccwpck_require__.e(190), __nccwpck_require__.e(363)]).then(__nccwpck_require__.bind(__nccwpck_require__, 52363));
9216
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(456), __nccwpck_require__.e(430), __nccwpck_require__.e(525), __nccwpck_require__.e(490), __nccwpck_require__.e(751), __nccwpck_require__.e(837), __nccwpck_require__.e(363)]).then(__nccwpck_require__.bind(__nccwpck_require__, 52363));
9217
9217
  await command({ cliCommandOptions });
9218
9218
  }
9219
9219
  });
@@ -9261,7 +9261,7 @@ program
9261
9261
  .task({
9262
9262
  skip,
9263
9263
  handler: async (cliCommandOptions) => {
9264
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(890), __nccwpck_require__.e(818), __nccwpck_require__.e(430), __nccwpck_require__.e(180), __nccwpck_require__.e(36), __nccwpck_require__.e(203), __nccwpck_require__.e(526)]).then(__nccwpck_require__.bind(__nccwpck_require__, 80526));
9264
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(456), __nccwpck_require__.e(430), __nccwpck_require__.e(180), __nccwpck_require__.e(36), __nccwpck_require__.e(751), __nccwpck_require__.e(526)]).then(__nccwpck_require__.bind(__nccwpck_require__, 80526));
9265
9265
  await command({ cliCommandOptions });
9266
9266
  }
9267
9267
  });
@@ -9273,7 +9273,7 @@ program
9273
9273
  .task({
9274
9274
  skip,
9275
9275
  handler: async (cliCommandOptions) => {
9276
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(890), __nccwpck_require__.e(818), __nccwpck_require__.e(827), __nccwpck_require__.e(453)]).then(__nccwpck_require__.bind(__nccwpck_require__, 93453));
9276
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(456), __nccwpck_require__.e(751), __nccwpck_require__.e(453)]).then(__nccwpck_require__.bind(__nccwpck_require__, 93453));
9277
9277
  await command({ cliCommandOptions });
9278
9278
  }
9279
9279
  });
@@ -9285,7 +9285,7 @@ program
9285
9285
  .task({
9286
9286
  skip,
9287
9287
  handler: async (cliCommandOptions) => {
9288
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(890), __nccwpck_require__.e(818), __nccwpck_require__.e(827), __nccwpck_require__.e(97)]).then(__nccwpck_require__.bind(__nccwpck_require__, 98097));
9288
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(456), __nccwpck_require__.e(751), __nccwpck_require__.e(97)]).then(__nccwpck_require__.bind(__nccwpck_require__, 98097));
9289
9289
  await command({ cliCommandOptions });
9290
9290
  }
9291
9291
  });
@@ -9297,7 +9297,7 @@ program
9297
9297
  .task({
9298
9298
  skip,
9299
9299
  handler: async (cliCommandOptions) => {
9300
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(890), __nccwpck_require__.e(818), __nccwpck_require__.e(430), __nccwpck_require__.e(525), __nccwpck_require__.e(180), __nccwpck_require__.e(203), __nccwpck_require__.e(932)]).then(__nccwpck_require__.bind(__nccwpck_require__, 16932));
9300
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(456), __nccwpck_require__.e(430), __nccwpck_require__.e(525), __nccwpck_require__.e(180), __nccwpck_require__.e(751), __nccwpck_require__.e(837), __nccwpck_require__.e(932)]).then(__nccwpck_require__.bind(__nccwpck_require__, 16932));
9301
9301
  await command({ cliCommandOptions });
9302
9302
  }
9303
9303
  });
@@ -9309,7 +9309,7 @@ program
9309
9309
  .task({
9310
9310
  skip,
9311
9311
  handler: async (cliCommandOptions) => {
9312
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(890), __nccwpck_require__.e(430), __nccwpck_require__.e(525), __nccwpck_require__.e(203), __nccwpck_require__.e(190), __nccwpck_require__.e(193)]).then(__nccwpck_require__.bind(__nccwpck_require__, 23193));
9312
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(456), __nccwpck_require__.e(430), __nccwpck_require__.e(525), __nccwpck_require__.e(751), __nccwpck_require__.e(837), __nccwpck_require__.e(193)]).then(__nccwpck_require__.bind(__nccwpck_require__, 23193));
9313
9313
  await command({ cliCommandOptions });
9314
9314
  }
9315
9315
  });
@@ -9321,7 +9321,7 @@ program
9321
9321
  .task({
9322
9322
  skip,
9323
9323
  handler: async (cliCommandOptions) => {
9324
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(890), __nccwpck_require__.e(818), __nccwpck_require__.e(538)]).then(__nccwpck_require__.bind(__nccwpck_require__, 1538));
9324
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(456), __nccwpck_require__.e(751), __nccwpck_require__.e(538)]).then(__nccwpck_require__.bind(__nccwpck_require__, 1538));
9325
9325
  await command({ cliCommandOptions });
9326
9326
  }
9327
9327
  });
@@ -1,4 +1,6 @@
1
1
  import type { CliCommandOptions } from "../main";
2
+ import type { KeycloakVersionRange } from "./KeycloakVersionRange";
3
+ import { type ThemeType } from "./constants";
2
4
  export type BuildContext = {
3
5
  bundler: "vite" | "webpack";
4
6
  themeVersion: string;
@@ -23,6 +25,12 @@ export type BuildContext = {
23
25
  name: string;
24
26
  default: string;
25
27
  }[];
28
+ themeSrcDirPath: string;
29
+ recordIsImplementedByThemeType: Readonly<Record<ThemeType | "email", boolean>>;
30
+ jarTargets: {
31
+ keycloakVersionRange: KeycloakVersionRange;
32
+ jarFileBasename: string;
33
+ }[];
26
34
  };
27
35
  export type BuildOptions = {
28
36
  themeName?: string | string[];
@@ -36,7 +44,15 @@ export type BuildOptions = {
36
44
  loginThemeResourcesFromKeycloakVersion?: string;
37
45
  keycloakifyBuildDirPath?: string;
38
46
  kcContextExclusionsFtl?: string;
47
+ keycloakVersionTargets?: BuildOptions.KeycloakVersionTargets;
39
48
  };
49
+ export declare namespace BuildOptions {
50
+ type KeycloakVersionTargets = ({
51
+ hasAccountTheme: true;
52
+ } & Record<KeycloakVersionRange.WithAccountTheme, string | boolean>) | ({
53
+ hasAccountTheme: false;
54
+ } & Record<KeycloakVersionRange.WithoutAccountTheme, string | boolean>);
55
+ }
40
56
  export type ResolvedViteConfig = {
41
57
  buildDir: string;
42
58
  publicDir: string;
@@ -10,7 +10,7 @@ export declare const vitePluginSubScriptEnvNames: {
10
10
  readonly runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT";
11
11
  readonly resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG";
12
12
  };
13
- export declare const onlyBuildJarFileBasenameEnvName = "KEYCLOAKIFY_ONLY_BUILD_JAR_FILE_BASENAME";
13
+ export declare const buildForKeycloakMajorVersionEnvName = "KEYCLOAKIFY_BUILD_FOR_KEYCLOAK_MAJOR_VERSION";
14
14
  export declare const loginThemePageIds: readonly ["login.ftl", "login-username.ftl", "login-password.ftl", "webauthn-authenticate.ftl", "webauthn-register.ftl", "register.ftl", "info.ftl", "error.ftl", "login-reset-password.ftl", "login-verify-email.ftl", "terms.ftl", "login-oauth2-device-verify-user-code.ftl", "login-oauth-grant.ftl", "login-otp.ftl", "login-update-profile.ftl", "login-update-password.ftl", "login-idp-link-confirm.ftl", "login-idp-link-email.ftl", "login-page-expired.ftl", "login-config-totp.ftl", "logout-confirm.ftl", "idp-review-user-profile.ftl", "update-email.ftl", "select-authenticator.ftl", "saml-post-form.ftl", "delete-credential.ftl", "code.ftl", "delete-account-confirm.ftl", "frontchannel-logout.ftl", "login-recovery-authn-code-config.ftl", "login-recovery-authn-code-input.ftl", "login-reset-otp.ftl", "login-x509-info.ftl", "webauthn-error.ftl"];
15
15
  export declare const accountThemePageIds: readonly ["password.ftl", "account.ftl", "sessions.ftl", "totp.ftl", "applications.ftl", "log.ftl", "federatedIdentity.ftl"];
16
16
  export type LoginThemePageId = (typeof loginThemePageIds)[number];
@@ -9,7 +9,7 @@ export const vitePluginSubScriptEnvNames = {
9
9
  runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
10
10
  resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
11
11
  };
12
- export const onlyBuildJarFileBasenameEnvName = "KEYCLOAKIFY_ONLY_BUILD_JAR_FILE_BASENAME";
12
+ export const buildForKeycloakMajorVersionEnvName = "KEYCLOAKIFY_BUILD_FOR_KEYCLOAK_MAJOR_VERSION";
13
13
  export const loginThemePageIds = [
14
14
  "login.ftl",
15
15
  "login-username.ftl",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/bin/shared/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sDAAsD,GAC/D,yCAAyC,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,gCAAgC,GAAG,QAAQ,CAA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version": "10.0.0-rc.65",
3
+ "version": "10.0.0-rc.66",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -491,9 +491,6 @@
491
491
  "src/bin/shared/downloadKeycloakDefaultTheme.ts",
492
492
  "src/bin/shared/downloadKeycloakStaticResources.ts",
493
493
  "src/bin/shared/generateKcGenTs.ts",
494
- "src/bin/shared/getImplementedThemeTypes.ts",
495
- "src/bin/shared/getJarFileBasename.ts",
496
- "src/bin/shared/getThemeSrcDirPath.ts",
497
494
  "src/bin/shared/metaInfKeycloakThemes.ts",
498
495
  "src/bin/shared/promptKeycloakVersion.ts",
499
496
  "src/bin/start-keycloak/appBuild.ts",
@@ -771,24 +768,22 @@
771
768
  "tools/useSetClassName.js.map",
772
769
  "bin/main.js",
773
770
  "bin/180.index.js",
774
- "bin/190.index.js",
775
771
  "bin/193.index.js",
776
- "bin/203.index.js",
777
772
  "bin/246.index.js",
778
773
  "bin/36.index.js",
779
774
  "bin/363.index.js",
780
775
  "bin/420.index.js",
781
776
  "bin/430.index.js",
782
777
  "bin/453.index.js",
783
- "bin/480.index.js",
778
+ "bin/456.index.js",
779
+ "bin/490.index.js",
784
780
  "bin/509.index.js",
785
781
  "bin/525.index.js",
786
782
  "bin/526.index.js",
787
783
  "bin/538.index.js",
784
+ "bin/751.index.js",
788
785
  "bin/772.index.js",
789
- "bin/818.index.js",
790
- "bin/827.index.js",
791
- "bin/890.index.js",
786
+ "bin/837.index.js",
792
787
  "bin/932.index.js",
793
788
  "bin/97.index.js",
794
789
  "bin/shared/constants.js",
@@ -13,7 +13,6 @@ import * as fs from "fs";
13
13
  import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
14
14
  import { kebabCaseToCamelCase } from "./tools/kebabCaseToSnakeCase";
15
15
  import { assert, Equals } from "tsafe/assert";
16
- import { getThemeSrcDirPath } from "./shared/getThemeSrcDirPath";
17
16
  import type { CliCommandOptions } from "./main";
18
17
  import { getBuildContext } from "./shared/buildContext";
19
18
  import chalk from "chalk";
@@ -53,17 +52,13 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
53
52
 
54
53
  console.log(`→ ${pageId}`);
55
54
 
56
- const { themeSrcDirPath } = getThemeSrcDirPath({
57
- projectDirPath: buildContext.projectDirPath
58
- });
59
-
60
55
  const componentBasename = capitalize(kebabCaseToCamelCase(pageId)).replace(
61
56
  /ftl$/,
62
57
  "stories.tsx"
63
58
  );
64
59
 
65
60
  const targetFilePath = pathJoin(
66
- themeSrcDirPath,
61
+ buildContext.themeSrcDirPath,
67
62
  themeType,
68
63
  "pages",
69
64
  componentBasename
@@ -15,7 +15,6 @@ import * as fs from "fs";
15
15
  import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
16
16
  import { kebabCaseToCamelCase } from "./tools/kebabCaseToSnakeCase";
17
17
  import { assert, Equals } from "tsafe/assert";
18
- import { getThemeSrcDirPath } from "./shared/getThemeSrcDirPath";
19
18
  import type { CliCommandOptions } from "./main";
20
19
  import { getBuildContext } from "./shared/buildContext";
21
20
  import chalk from "chalk";
@@ -68,10 +67,6 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
68
67
 
69
68
  console.log(`→ ${pageIdOrComponent}`);
70
69
 
71
- const { themeSrcDirPath } = getThemeSrcDirPath({
72
- projectDirPath: buildContext.projectDirPath
73
- });
74
-
75
70
  const componentBasename = (() => {
76
71
  if (pageIdOrComponent === templateValue) {
77
72
  return "Template.tsx";
@@ -96,7 +91,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
96
91
  })();
97
92
 
98
93
  const targetFilePath = pathJoin(
99
- themeSrcDirPath,
94
+ buildContext.themeSrcDirPath,
100
95
  themeType,
101
96
  pagesOrDot,
102
97
  componentBasename
@@ -149,7 +144,11 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
149
144
  break edit_KcApp;
150
145
  }
151
146
 
152
- const kcAppTsxPath = pathJoin(themeSrcDirPath, themeType, "KcPage.tsx");
147
+ const kcAppTsxPath = pathJoin(
148
+ buildContext.themeSrcDirPath,
149
+ themeType,
150
+ "KcPage.tsx"
151
+ );
153
152
 
154
153
  const kcAppTsxCode = fs.readFileSync(kcAppTsxPath).toString("utf8");
155
154
 
@@ -199,7 +198,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
199
198
  `${chalk.bold(
200
199
  pathJoin(
201
200
  ".",
202
- pathRelative(process.cwd(), themeSrcDirPath),
201
+ pathRelative(process.cwd(), buildContext.themeSrcDirPath),
203
202
  themeType,
204
203
  "KcPage.tsx"
205
204
  )
@@ -4,7 +4,6 @@ import { transformCodebase } from "./tools/transformCodebase";
4
4
  import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
5
5
  import { getBuildContext } from "./shared/buildContext";
6
6
  import * as fs from "fs";
7
- import { getThemeSrcDirPath } from "./shared/getThemeSrcDirPath";
8
7
  import type { CliCommandOptions } from "./main";
9
8
 
10
9
  export async function command(params: { cliCommandOptions: CliCommandOptions }) {
@@ -12,11 +11,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
12
11
 
13
12
  const buildContext = getBuildContext({ cliCommandOptions });
14
13
 
15
- const { themeSrcDirPath } = getThemeSrcDirPath({
16
- projectDirPath: buildContext.projectDirPath
17
- });
18
-
19
- const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
14
+ const emailThemeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "email");
20
15
 
21
16
  if (fs.existsSync(emailThemeSrcDirPath)) {
22
17
  console.warn(
@@ -1,5 +1,4 @@
1
1
  import { assert } from "tsafe/assert";
2
- import { exclude } from "tsafe/exclude";
3
2
  import {
4
3
  keycloakAccountV1Versions,
5
4
  keycloakThemeAdditionalInfoExtensionVersions
@@ -7,32 +6,29 @@ import {
7
6
  import { getKeycloakVersionRangeForJar } from "./getKeycloakVersionRangeForJar";
8
7
  import { buildJar, BuildContextLike as BuildContextLike_buildJar } from "./buildJar";
9
8
  import type { BuildContext } from "../../shared/buildContext";
10
- import { getJarFileBasename } from "../../shared/getJarFileBasename";
11
- import { getImplementedThemeTypes } from "../../shared/getImplementedThemeTypes";
12
9
 
13
10
  export type BuildContextLike = BuildContextLike_buildJar & {
14
11
  projectDirPath: string;
15
12
  keycloakifyBuildDirPath: string;
13
+ recordIsImplementedByThemeType: BuildContext["recordIsImplementedByThemeType"];
14
+ jarTargets: BuildContext["jarTargets"];
16
15
  };
17
16
 
18
17
  assert<BuildContext extends BuildContextLike ? true : false>();
19
18
 
20
19
  export async function buildJars(params: {
21
20
  resourcesDirPath: string;
22
- onlyBuildJarFileBasename: string | undefined;
23
21
  buildContext: BuildContextLike;
24
22
  }): Promise<void> {
25
- const { onlyBuildJarFileBasename, resourcesDirPath, buildContext } = params;
23
+ const { resourcesDirPath, buildContext } = params;
26
24
 
27
- const doesImplementAccountTheme = getImplementedThemeTypes({
28
- projectDirPath: buildContext.projectDirPath
29
- }).implementedThemeTypes.account;
25
+ const doesImplementAccountTheme = buildContext.recordIsImplementedByThemeType.account;
30
26
 
31
27
  await Promise.all(
32
28
  keycloakAccountV1Versions
33
29
  .map(keycloakAccountV1Version =>
34
- keycloakThemeAdditionalInfoExtensionVersions
35
- .map(keycloakThemeAdditionalInfoExtensionVersion => {
30
+ keycloakThemeAdditionalInfoExtensionVersions.map(
31
+ keycloakThemeAdditionalInfoExtensionVersion => {
36
32
  const keycloakVersionRange = getKeycloakVersionRangeForJar({
37
33
  doesImplementAccountTheme,
38
34
  keycloakAccountV1Version,
@@ -43,48 +39,26 @@ export async function buildJars(params: {
43
39
  return undefined;
44
40
  }
45
41
 
46
- return {
47
- keycloakThemeAdditionalInfoExtensionVersion,
48
- keycloakVersionRange
49
- };
50
- })
51
- .filter(exclude(undefined))
52
- .map(
53
- ({
54
- keycloakThemeAdditionalInfoExtensionVersion,
55
- keycloakVersionRange
56
- }) => {
57
- const { jarFileBasename } = getJarFileBasename({
58
- keycloakVersionRange
59
- });
42
+ const jarTarget = buildContext.jarTargets.find(
43
+ jarTarget =>
44
+ jarTarget.keycloakVersionRange === keycloakVersionRange
45
+ );
60
46
 
61
- if (
62
- onlyBuildJarFileBasename !== undefined &&
63
- onlyBuildJarFileBasename !== jarFileBasename
64
- ) {
65
- return undefined;
66
- }
67
-
68
- return {
69
- keycloakThemeAdditionalInfoExtensionVersion,
70
- jarFileBasename
71
- };
47
+ if (jarTarget === undefined) {
48
+ return undefined;
72
49
  }
73
- )
74
- .filter(exclude(undefined))
75
- .map(
76
- ({
50
+
51
+ const { jarFileBasename } = jarTarget;
52
+
53
+ return buildJar({
54
+ jarFileBasename,
55
+ keycloakAccountV1Version,
77
56
  keycloakThemeAdditionalInfoExtensionVersion,
78
- jarFileBasename
79
- }) =>
80
- buildJar({
81
- jarFileBasename,
82
- keycloakAccountV1Version,
83
- keycloakThemeAdditionalInfoExtensionVersion,
84
- resourcesDirPath,
85
- buildContext
86
- })
87
- )
57
+ resourcesDirPath,
58
+ buildContext
59
+ });
60
+ }
61
+ )
88
62
  )
89
63
  .flat()
90
64
  );
@@ -29,7 +29,6 @@ import {
29
29
  bringInAccountV1,
30
30
  type BuildContextLike as BuildContextLike_bringInAccountV1
31
31
  } from "./bringInAccountV1";
32
- import { getThemeSrcDirPath } from "../../shared/getThemeSrcDirPath";
33
32
  import { rmSync } from "../../tools/fs.rmSync";
34
33
  import { readThisNpmPackageVersion } from "../../tools/readThisNpmPackageVersion";
35
34
  import {
@@ -38,7 +37,6 @@ import {
38
37
  } from "../../shared/metaInfKeycloakThemes";
39
38
  import { objectEntries } from "tsafe/objectEntries";
40
39
  import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
41
- import { getImplementedThemeTypes } from "../../shared/getImplementedThemeTypes";
42
40
 
43
41
  export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
44
42
  BuildContextLike_downloadKeycloakStaticResources &
@@ -48,6 +46,8 @@ export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
48
46
  projectDirPath: string;
49
47
  projectBuildDirPath: string;
50
48
  environmentVariables: { name: string; default: string }[];
49
+ recordIsImplementedByThemeType: BuildContext["recordIsImplementedByThemeType"];
50
+ themeSrcDirPath: string;
51
51
  };
52
52
 
53
53
  assert<BuildContext extends BuildContextLike ? true : false>();
@@ -59,14 +59,6 @@ export async function generateResourcesForMainTheme(params: {
59
59
  }): Promise<void> {
60
60
  const { themeName, resourcesDirPath, buildContext } = params;
61
61
 
62
- const { themeSrcDirPath } = getThemeSrcDirPath({
63
- projectDirPath: buildContext.projectDirPath
64
- });
65
-
66
- const { implementedThemeTypes } = getImplementedThemeTypes({
67
- projectDirPath: buildContext.projectDirPath
68
- });
69
-
70
62
  const getThemeTypeDirPath = (params: { themeType: ThemeType | "email" }) => {
71
63
  const { themeType } = params;
72
64
  return pathJoin(resourcesDirPath, "theme", themeName, themeType);
@@ -75,7 +67,7 @@ export async function generateResourcesForMainTheme(params: {
75
67
  const cssGlobalsToDefine: Record<string, string> = {};
76
68
 
77
69
  for (const themeType of ["login", "account"] as const) {
78
- if (!implementedThemeTypes[themeType]) {
70
+ if (!buildContext.recordIsImplementedByThemeType[themeType]) {
79
71
  continue;
80
72
  }
81
73
 
@@ -91,7 +83,10 @@ export async function generateResourcesForMainTheme(params: {
91
83
  // NOTE: Prevent accumulation of files in the assets dir, as names are hashed they pile up.
92
84
  rmSync(destDirPath, { recursive: true, force: true });
93
85
 
94
- if (themeType === "account" && implementedThemeTypes.login) {
86
+ if (
87
+ themeType === "account" &&
88
+ buildContext.recordIsImplementedByThemeType.login
89
+ ) {
95
90
  // NOTE: We prevent doing it twice, it has been done for the login theme.
96
91
 
97
92
  transformCodebase({
@@ -178,7 +173,7 @@ export async function generateResourcesForMainTheme(params: {
178
173
  keycloakifyVersion: readThisNpmPackageVersion(),
179
174
  themeType,
180
175
  fieldNames: readFieldNameUsage({
181
- themeSrcDirPath,
176
+ themeSrcDirPath: buildContext.themeSrcDirPath,
182
177
  themeType
183
178
  })
184
179
  });
@@ -194,7 +189,7 @@ export async function generateResourcesForMainTheme(params: {
194
189
  })(),
195
190
  ...readExtraPagesNames({
196
191
  themeType,
197
- themeSrcDirPath
192
+ themeSrcDirPath: buildContext.themeSrcDirPath
198
193
  })
199
194
  ].forEach(pageId => {
200
195
  const { ftlCode } = generateFtlFilesCode({ pageId });
@@ -206,7 +201,7 @@ export async function generateResourcesForMainTheme(params: {
206
201
  });
207
202
 
208
203
  generateMessageProperties({
209
- themeSrcDirPath,
204
+ themeSrcDirPath: buildContext.themeSrcDirPath,
210
205
  themeType
211
206
  }).forEach(({ languageTag, propertiesFileSource }) => {
212
207
  const messagesDirPath = pathJoin(themeTypeDirPath, "messages");
@@ -265,11 +260,11 @@ export async function generateResourcesForMainTheme(params: {
265
260
  }
266
261
 
267
262
  email: {
268
- if (!implementedThemeTypes.email) {
263
+ if (!buildContext.recordIsImplementedByThemeType.email) {
269
264
  break email;
270
265
  }
271
266
 
272
- const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
267
+ const emailThemeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "email");
273
268
 
274
269
  transformCodebase({
275
270
  srcDirPath: emailThemeSrcDirPath,
@@ -277,7 +272,7 @@ export async function generateResourcesForMainTheme(params: {
277
272
  });
278
273
  }
279
274
 
280
- if (implementedThemeTypes.account) {
275
+ if (buildContext.recordIsImplementedByThemeType.account) {
281
276
  await bringInAccountV1({
282
277
  resourcesDirPath,
283
278
  buildContext
@@ -289,12 +284,12 @@ export async function generateResourcesForMainTheme(params: {
289
284
 
290
285
  metaInfKeycloakThemes.themes.push({
291
286
  name: themeName,
292
- types: objectEntries(implementedThemeTypes)
287
+ types: objectEntries(buildContext.recordIsImplementedByThemeType)
293
288
  .filter(([, isImplemented]) => isImplemented)
294
289
  .map(([themeType]) => themeType)
295
290
  });
296
291
 
297
- if (implementedThemeTypes.account) {
292
+ if (buildContext.recordIsImplementedByThemeType.account) {
298
293
  metaInfKeycloakThemes.themes.push({
299
294
  name: accountV1ThemeName,
300
295
  types: ["account"]
@@ -3,10 +3,7 @@ import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path
3
3
  import * as child_process from "child_process";
4
4
  import * as fs from "fs";
5
5
  import { getBuildContext } from "../shared/buildContext";
6
- import {
7
- vitePluginSubScriptEnvNames,
8
- onlyBuildJarFileBasenameEnvName
9
- } from "../shared/constants";
6
+ import { vitePluginSubScriptEnvNames } from "../shared/constants";
10
7
  import { buildJars } from "./buildJars";
11
8
  import type { CliCommandOptions } from "../main";
12
9
  import chalk from "chalk";
@@ -96,16 +93,17 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
96
93
  cwd: buildContext.projectDirPath,
97
94
  env: {
98
95
  ...process.env,
99
- [vitePluginSubScriptEnvNames.runPostBuildScript]:
100
- JSON.stringify(buildContext)
96
+ [vitePluginSubScriptEnvNames.runPostBuildScript]: JSON.stringify({
97
+ resourcesDirPath,
98
+ buildContext
99
+ })
101
100
  }
102
101
  });
103
102
  }
104
103
 
105
104
  await buildJars({
106
105
  resourcesDirPath,
107
- buildContext,
108
- onlyBuildJarFileBasename: process.env[onlyBuildJarFileBasenameEnvName]
106
+ buildContext
109
107
  });
110
108
 
111
109
  rmSync(resourcesDirPath, { recursive: true });