keycloakify 10.0.0-rc.65 → 10.0.0-rc.67

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 (53) 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/KeycloakVersionRange.d.ts +5 -0
  16. package/bin/shared/KeycloakVersionRange.js.map +1 -0
  17. package/bin/shared/buildContext.d.ts +16 -0
  18. package/bin/shared/buildContext.js.map +1 -0
  19. package/bin/shared/constants.d.ts +1 -1
  20. package/bin/shared/constants.js.map +1 -1
  21. package/bin/shared/copyKeycloakResourcesToPublic.d.ts +8 -0
  22. package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -0
  23. package/bin/shared/downloadKeycloakDefaultTheme.d.ts +10 -0
  24. package/bin/shared/downloadKeycloakDefaultTheme.js.map +1 -0
  25. package/bin/shared/downloadKeycloakStaticResources.d.ts +9 -0
  26. package/bin/shared/downloadKeycloakStaticResources.js.map +1 -0
  27. package/bin/shared/generateKcGenTs.d.ts +12 -0
  28. package/bin/shared/generateKcGenTs.js.map +1 -0
  29. package/bin/shared/metaInfKeycloakThemes.d.ts +13 -0
  30. package/bin/shared/metaInfKeycloakThemes.js.map +1 -0
  31. package/bin/shared/promptKeycloakVersion.d.ts +7 -0
  32. package/bin/shared/promptKeycloakVersion.js.map +1 -0
  33. package/package.json +21 -12
  34. package/src/bin/add-story.ts +1 -6
  35. package/src/bin/eject-page.ts +7 -8
  36. package/src/bin/initialize-email-theme.ts +1 -6
  37. package/src/bin/keycloakify/buildJars/buildJars.ts +23 -49
  38. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +15 -20
  39. package/src/bin/keycloakify/keycloakify.ts +6 -8
  40. package/src/bin/shared/buildContext.ts +434 -42
  41. package/src/bin/shared/constants.ts +2 -1
  42. package/src/bin/shared/generateKcGenTs.ts +2 -6
  43. package/src/bin/start-keycloak/keycloakifyBuild.ts +4 -4
  44. package/src/bin/start-keycloak/start-keycloak.ts +40 -83
  45. package/src/vite-plugin/vite-plugin.ts +5 -4
  46. package/vite-plugin/index.js +341 -117
  47. package/bin/480.index.js +0 -466
  48. package/bin/818.index.js +0 -1802
  49. package/bin/827.index.js +0 -1094
  50. package/bin/shared/constants.js +0 -59
  51. package/src/bin/shared/getImplementedThemeTypes.ts +0 -38
  52. package/src/bin/shared/getJarFileBasename.ts +0 -11
  53. package/src/bin/shared/getThemeSrcDirPath.ts +0 -62
@@ -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 });