keycloakify 11.4.5 → 11.5.1

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 (44) hide show
  1. package/bin/375.index.js +4089 -0
  2. package/bin/{20.index.js → 490.index.js} +378 -56
  3. package/bin/{36.index.js → 503.index.js} +53 -2
  4. package/bin/{450.index.js → 525.index.js} +2 -4085
  5. package/bin/653.index.js +108 -110
  6. package/bin/682.index.js +1987 -0
  7. package/bin/735.index.js +107 -109
  8. package/bin/921.index.js +1 -1
  9. package/bin/main.js +8 -2
  10. package/bin/shared/constants.d.ts +3 -0
  11. package/bin/shared/constants.js +3 -0
  12. package/bin/shared/constants.js.map +1 -1
  13. package/bin/start-keycloak/getSupportedDockerImageTags.d.ts +8 -0
  14. package/bin/start-keycloak/realmConfig/ParsedRealmJson.d.ts +45 -0
  15. package/bin/start-keycloak/realmConfig/defaultConfig/defaultConfig.d.ts +8 -0
  16. package/bin/start-keycloak/realmConfig/defaultConfig/index.d.ts +1 -0
  17. package/bin/start-keycloak/realmConfig/dumpContainerConfig.d.ts +9 -0
  18. package/bin/start-keycloak/realmConfig/index.d.ts +1 -0
  19. package/bin/start-keycloak/realmConfig/prepareRealmConfig.d.ts +15 -0
  20. package/bin/start-keycloak/realmConfig/realmConfig.d.ts +16 -0
  21. package/package.json +31 -14
  22. package/src/bin/shared/constants.ts +6 -0
  23. package/src/bin/start-keycloak/getSupportedDockerImageTags.ts +230 -0
  24. package/src/bin/start-keycloak/keycloakify-logging-1.0.3.jar +0 -0
  25. package/src/bin/start-keycloak/realmConfig/ParsedRealmJson.ts +136 -0
  26. package/src/bin/start-keycloak/realmConfig/defaultConfig/defaultConfig.ts +75 -0
  27. package/src/bin/start-keycloak/realmConfig/defaultConfig/index.ts +1 -0
  28. package/src/bin/start-keycloak/{myrealm-realm-18.json → realmConfig/defaultConfig/realm-kc-18.json} +123 -60
  29. package/src/bin/start-keycloak/{myrealm-realm-19.json → realmConfig/defaultConfig/realm-kc-19.json} +81 -41
  30. package/src/bin/start-keycloak/{myrealm-realm-20.json → realmConfig/defaultConfig/realm-kc-20.json} +83 -42
  31. package/src/bin/start-keycloak/{myrealm-realm-21.json → realmConfig/defaultConfig/realm-kc-21.json} +58 -17
  32. package/src/bin/start-keycloak/{myrealm-realm-23.json → realmConfig/defaultConfig/realm-kc-23.json} +64 -20
  33. package/src/bin/start-keycloak/{myrealm-realm-24.json → realmConfig/defaultConfig/realm-kc-24.json} +63 -19
  34. package/src/bin/start-keycloak/{myrealm-realm-25.json → realmConfig/defaultConfig/realm-kc-25.json} +75 -20
  35. package/src/bin/start-keycloak/{myrealm-realm-26.json → realmConfig/defaultConfig/realm-kc-26.json} +103 -19
  36. package/src/bin/start-keycloak/realmConfig/dumpContainerConfig.ts +194 -0
  37. package/src/bin/start-keycloak/realmConfig/index.ts +1 -0
  38. package/src/bin/start-keycloak/realmConfig/prepareRealmConfig.ts +365 -0
  39. package/src/bin/start-keycloak/realmConfig/realmConfig.ts +159 -0
  40. package/src/bin/start-keycloak/start-keycloak.ts +160 -184
  41. package/src/bin/start-keycloak/startViteDevServer.ts +1 -0
  42. package/vite-plugin/index.js +6 -0
  43. package/bin/392.index.js +0 -740
  44. package/bin/932.index.js +0 -327
@@ -0,0 +1,159 @@
1
+ import type { BuildContext } from "../../shared/buildContext";
2
+ import { assert } from "tsafe/assert";
3
+ import { runPrettier, getIsPrettierAvailable } from "../../tools/runPrettier";
4
+ import { getDefaultConfig } from "./defaultConfig";
5
+ import {
6
+ prepareRealmConfig,
7
+ type BuildContextLike as BuildContextLike_prepareRealmConfig
8
+ } from "./prepareRealmConfig";
9
+ import * as fs from "fs";
10
+ import {
11
+ join as pathJoin,
12
+ dirname as pathDirname,
13
+ relative as pathRelative,
14
+ sep as pathSep
15
+ } from "path";
16
+ import { existsAsync } from "../../tools/fs.existsAsync";
17
+ import { readRealmJsonFile, type ParsedRealmJson } from "./ParsedRealmJson";
18
+ import {
19
+ dumpContainerConfig,
20
+ type BuildContextLike as BuildContextLike_dumpContainerConfig
21
+ } from "./dumpContainerConfig";
22
+ import * as runExclusive from "run-exclusive";
23
+ import { waitForDebounceFactory } from "powerhooks/tools/waitForDebounce";
24
+ import chalk from "chalk";
25
+
26
+ export type BuildContextLike = BuildContextLike_dumpContainerConfig &
27
+ BuildContextLike_prepareRealmConfig & {
28
+ projectDirPath: string;
29
+ };
30
+
31
+ assert<BuildContext extends BuildContextLike ? true : false>;
32
+
33
+ export async function getRealmConfig(params: {
34
+ keycloakMajorVersionNumber: number;
35
+ realmJsonFilePath_userProvided: string | undefined;
36
+ buildContext: BuildContextLike;
37
+ }): Promise<{
38
+ realmJsonFilePath: string;
39
+ clientName: string;
40
+ realmName: string;
41
+ username: string;
42
+ onRealmConfigChange: () => Promise<void>;
43
+ }> {
44
+ const { keycloakMajorVersionNumber, realmJsonFilePath_userProvided, buildContext } =
45
+ params;
46
+
47
+ const realmJsonFilePath = pathJoin(
48
+ buildContext.projectDirPath,
49
+ ".keycloakify",
50
+ `realm-kc-${keycloakMajorVersionNumber}.json`
51
+ );
52
+
53
+ const parsedRealmJson = await (async () => {
54
+ if (realmJsonFilePath_userProvided !== undefined) {
55
+ return readRealmJsonFile({
56
+ realmJsonFilePath: realmJsonFilePath_userProvided
57
+ });
58
+ }
59
+
60
+ if (await existsAsync(realmJsonFilePath)) {
61
+ return readRealmJsonFile({
62
+ realmJsonFilePath
63
+ });
64
+ }
65
+
66
+ return getDefaultConfig({ keycloakMajorVersionNumber });
67
+ })();
68
+
69
+ const { clientName, realmName, username } = prepareRealmConfig({
70
+ parsedRealmJson,
71
+ buildContext,
72
+ keycloakMajorVersionNumber
73
+ });
74
+
75
+ {
76
+ const dirPath = pathDirname(realmJsonFilePath);
77
+
78
+ if (!(await existsAsync(dirPath))) {
79
+ fs.mkdirSync(dirPath, { recursive: true });
80
+ }
81
+ }
82
+
83
+ const writeRealmJsonFile = async (params: { parsedRealmJson: ParsedRealmJson }) => {
84
+ const { parsedRealmJson } = params;
85
+
86
+ let sourceCode = JSON.stringify(parsedRealmJson, null, 2);
87
+
88
+ if (await getIsPrettierAvailable()) {
89
+ sourceCode = await runPrettier({
90
+ sourceCode,
91
+ filePath: realmJsonFilePath
92
+ });
93
+ }
94
+
95
+ fs.writeFileSync(realmJsonFilePath, sourceCode);
96
+ };
97
+
98
+ await writeRealmJsonFile({ parsedRealmJson });
99
+
100
+ const { onRealmConfigChange } = (() => {
101
+ const run = runExclusive.build(async () => {
102
+ const start = Date.now();
103
+
104
+ console.log(
105
+ chalk.grey(`Changes detected to the '${realmName}' config, backing up...`)
106
+ );
107
+
108
+ let parsedRealmJson: ParsedRealmJson;
109
+
110
+ try {
111
+ parsedRealmJson = await dumpContainerConfig({
112
+ buildContext,
113
+ realmName,
114
+ keycloakMajorVersionNumber
115
+ });
116
+ } catch (error) {
117
+ console.log(chalk.red(`Failed to backup '${realmName}' config:`));
118
+
119
+ return;
120
+ }
121
+
122
+ await writeRealmJsonFile({ parsedRealmJson });
123
+
124
+ console.log(
125
+ [
126
+ chalk.grey(
127
+ `Save changed to \`.${pathSep}${pathRelative(buildContext.projectDirPath, realmJsonFilePath)}\``
128
+ ),
129
+ chalk.grey(
130
+ `Next time you'll be running \`keycloakify start-keycloak\`, the realm '${realmName}' will be restored to this state.`
131
+ ),
132
+ chalk.green(
133
+ `✓ '${realmName}' config backed up completed in ${Date.now() - start}ms`
134
+ )
135
+ ].join("\n")
136
+ );
137
+ });
138
+
139
+ const { waitForDebounce } = waitForDebounceFactory({
140
+ delay: 1_000
141
+ });
142
+
143
+ async function onRealmConfigChange() {
144
+ await waitForDebounce();
145
+
146
+ run();
147
+ }
148
+
149
+ return { onRealmConfigChange };
150
+ })();
151
+
152
+ return {
153
+ realmJsonFilePath,
154
+ clientName,
155
+ realmName,
156
+ username,
157
+ onRealmConfigChange
158
+ };
159
+ }
@@ -1,7 +1,11 @@
1
1
  import type { BuildContext } from "../shared/buildContext";
2
2
  import { exclude } from "tsafe/exclude";
3
- import { promptKeycloakVersion } from "../shared/promptKeycloakVersion";
4
- import { CONTAINER_NAME, KEYCLOAKIFY_SPA_DEV_SERVER_PORT } from "../shared/constants";
3
+ import {
4
+ CONTAINER_NAME,
5
+ KEYCLOAKIFY_SPA_DEV_SERVER_PORT,
6
+ KEYCLOAKIFY_LOGIN_JAR_BASENAME,
7
+ TEST_APP_URL
8
+ } from "../shared/constants";
5
9
  import { SemVer } from "../tools/SemVer";
6
10
  import { assert, type Equals } from "tsafe/assert";
7
11
  import * as fs from "fs";
@@ -9,8 +13,7 @@ import {
9
13
  join as pathJoin,
10
14
  relative as pathRelative,
11
15
  sep as pathSep,
12
- basename as pathBasename,
13
- dirname as pathDirname
16
+ basename as pathBasename
14
17
  } from "path";
15
18
  import * as child_process from "child_process";
16
19
  import chalk from "chalk";
@@ -28,6 +31,9 @@ import { existsAsync } from "../tools/fs.existsAsync";
28
31
  import { rm } from "../tools/fs.rm";
29
32
  import { downloadAndExtractArchive } from "../tools/downloadAndExtractArchive";
30
33
  import { startViteDevServer } from "./startViteDevServer";
34
+ import { getSupportedKeycloakMajorVersions } from "./realmConfig/defaultConfig";
35
+ import { getSupportedDockerImageTags } from "./getSupportedDockerImageTags";
36
+ import { getRealmConfig } from "./realmConfig";
31
37
 
32
38
  export async function command(params: {
33
39
  buildContext: BuildContext;
@@ -91,9 +97,32 @@ export async function command(params: {
91
97
 
92
98
  const { cliCommandOptions, buildContext } = params;
93
99
 
100
+ const availableTags = await getSupportedDockerImageTags({
101
+ buildContext
102
+ });
103
+
94
104
  const { dockerImageTag } = await (async () => {
95
105
  if (cliCommandOptions.keycloakVersion !== undefined) {
96
- return { dockerImageTag: cliCommandOptions.keycloakVersion };
106
+ const cliCommandOptions_keycloakVersion = cliCommandOptions.keycloakVersion;
107
+
108
+ const tag = availableTags.find(tag =>
109
+ tag.startsWith(cliCommandOptions_keycloakVersion)
110
+ );
111
+
112
+ if (tag === undefined) {
113
+ console.log(
114
+ chalk.red(
115
+ [
116
+ `We could not find a Keycloak Docker image for ${cliCommandOptions_keycloakVersion}`,
117
+ `Example of valid values: --keycloak-version 26, --keycloak-version 26.0.7`
118
+ ].join("\n")
119
+ )
120
+ );
121
+
122
+ process.exit(1);
123
+ }
124
+
125
+ return { dockerImageTag: tag };
97
126
  }
98
127
 
99
128
  if (buildContext.startKeycloakOptions.dockerImage !== undefined) {
@@ -108,50 +137,84 @@ export async function command(params: {
108
137
  "On which version of Keycloak do you want to test your theme?"
109
138
  ),
110
139
  chalk.gray(
111
- "You can also explicitly provide the version with `npx keycloakify start-keycloak --keycloak-version 25.0.2` (or any other version)"
140
+ "You can also explicitly provide the version with `npx keycloakify start-keycloak --keycloak-version 26` (or any other version)"
112
141
  )
113
142
  ].join("\n")
114
143
  );
115
144
 
116
- const { keycloakVersion } = await promptKeycloakVersion({
117
- startingFromMajor: 18,
118
- excludeMajorVersions: [22],
119
- doOmitPatch: true,
120
- buildContext
145
+ const { value: tag } = await cliSelect<string>({
146
+ values: availableTags
147
+ }).catch(() => {
148
+ process.exit(-1);
121
149
  });
122
150
 
123
- console.log(`→ ${keycloakVersion}`);
151
+ console.log(`→ ${tag}`);
124
152
 
125
- return { dockerImageTag: keycloakVersion };
153
+ return { dockerImageTag: tag };
126
154
  })();
127
155
 
128
156
  const keycloakMajorVersionNumber = (() => {
129
- if (buildContext.startKeycloakOptions.dockerImage === undefined) {
130
- return SemVer.parse(dockerImageTag).major;
131
- }
132
-
133
- const { tag } = buildContext.startKeycloakOptions.dockerImage;
134
-
135
- const [wrap] = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
157
+ const [wrap] = getSupportedKeycloakMajorVersions()
136
158
  .map(majorVersionNumber => ({
137
159
  majorVersionNumber,
138
- index: tag.indexOf(`${majorVersionNumber}`)
160
+ index: dockerImageTag.indexOf(`${majorVersionNumber}`)
139
161
  }))
140
162
  .filter(({ index }) => index !== -1)
141
163
  .sort((a, b) => a.index - b.index);
142
164
 
143
165
  if (wrap === undefined) {
144
- console.warn(
145
- chalk.yellow(
146
- `Could not determine the major Keycloak version number from the docker image tag ${tag}. Assuming 25`
147
- )
148
- );
149
- return 25;
166
+ try {
167
+ const version = SemVer.parse(dockerImageTag);
168
+
169
+ console.error(
170
+ chalk.yellow(
171
+ `Keycloak version ${version.major} is not supported, supported versions are ${getSupportedKeycloakMajorVersions().join(", ")}`
172
+ )
173
+ );
174
+
175
+ process.exit(1);
176
+ } catch {
177
+ // NOTE: Latest version
178
+ const [n] = getSupportedKeycloakMajorVersions();
179
+
180
+ console.warn(
181
+ chalk.yellow(
182
+ `Could not determine the major Keycloak version number from the docker image tag ${dockerImageTag}. Assuming ${n}`
183
+ )
184
+ );
185
+ return n;
186
+ }
150
187
  }
151
188
 
152
189
  return wrap.majorVersionNumber;
153
190
  })();
154
191
 
192
+ const { clientName, onRealmConfigChange, realmJsonFilePath, realmName, username } =
193
+ await getRealmConfig({
194
+ keycloakMajorVersionNumber,
195
+ realmJsonFilePath_userProvided: await (async () => {
196
+ if (cliCommandOptions.realmJsonFilePath !== undefined) {
197
+ return getAbsoluteAndInOsFormatPath({
198
+ pathIsh: cliCommandOptions.realmJsonFilePath,
199
+ cwd: process.cwd()
200
+ });
201
+ }
202
+
203
+ if (buildContext.startKeycloakOptions.realmJsonFilePath !== undefined) {
204
+ assert(
205
+ await existsAsync(
206
+ buildContext.startKeycloakOptions.realmJsonFilePath
207
+ ),
208
+ `${pathRelative(process.cwd(), buildContext.startKeycloakOptions.realmJsonFilePath)} does not exist`
209
+ );
210
+ return buildContext.startKeycloakOptions.realmJsonFilePath;
211
+ }
212
+
213
+ return undefined;
214
+ })(),
215
+ buildContext
216
+ });
217
+
155
218
  {
156
219
  const { isAppBuildSuccess } = await appBuild({
157
220
  buildContext
@@ -189,154 +252,48 @@ export async function command(params: {
189
252
 
190
253
  assert(jarFilePath !== undefined);
191
254
 
192
- const extensionJarFilePaths = await Promise.all(
193
- buildContext.startKeycloakOptions.extensionJars.map(async extensionJar => {
194
- switch (extensionJar.type) {
195
- case "path": {
196
- assert(
197
- await existsAsync(extensionJar.path),
198
- `${extensionJar.path} does not exist`
199
- );
200
- return extensionJar.path;
201
- }
202
- case "url": {
203
- const { archiveFilePath } = await downloadAndExtractArchive({
204
- cacheDirPath: buildContext.cacheDirPath,
205
- fetchOptions: buildContext.fetchOptions,
206
- url: extensionJar.url,
207
- uniqueIdOfOnArchiveFile: "no extraction",
208
- onArchiveFile: async () => {}
209
- });
210
- return archiveFilePath;
255
+ const extensionJarFilePaths = [
256
+ ...(keycloakMajorVersionNumber <= 20
257
+ ? (console.log(
258
+ chalk.yellow(
259
+ "WARNING: With older version of keycloak your changes to the realm configuration are not persisted"
260
+ )
261
+ ),
262
+ [])
263
+ : [
264
+ pathJoin(
265
+ getThisCodebaseRootDirPath(),
266
+ "src",
267
+ "bin",
268
+ "start-keycloak",
269
+ KEYCLOAKIFY_LOGIN_JAR_BASENAME
270
+ )
271
+ ]),
272
+ ...(await Promise.all(
273
+ buildContext.startKeycloakOptions.extensionJars.map(async extensionJar => {
274
+ switch (extensionJar.type) {
275
+ case "path": {
276
+ assert(
277
+ await existsAsync(extensionJar.path),
278
+ `${extensionJar.path} does not exist`
279
+ );
280
+ return extensionJar.path;
281
+ }
282
+ case "url": {
283
+ const { archiveFilePath } = await downloadAndExtractArchive({
284
+ cacheDirPath: buildContext.cacheDirPath,
285
+ fetchOptions: buildContext.fetchOptions,
286
+ url: extensionJar.url,
287
+ uniqueIdOfOnArchiveFile: "no extraction",
288
+ onArchiveFile: async () => {}
289
+ });
290
+ return archiveFilePath;
291
+ }
211
292
  }
212
- }
213
- assert<Equals<typeof extensionJar, never>>(false);
214
- })
215
- );
216
-
217
- const getRealmJsonFilePath_defaultForKeycloakMajor = (
218
- keycloakMajorVersionNumber: number
219
- ) =>
220
- pathJoin(
221
- getThisCodebaseRootDirPath(),
222
- "src",
223
- "bin",
224
- "start-keycloak",
225
- `myrealm-realm-${keycloakMajorVersionNumber}.json`
226
- );
227
-
228
- const realmJsonFilePath = await (async () => {
229
- if (cliCommandOptions.realmJsonFilePath !== undefined) {
230
- if (cliCommandOptions.realmJsonFilePath === "none") {
231
- return undefined;
232
- }
233
- return getAbsoluteAndInOsFormatPath({
234
- pathIsh: cliCommandOptions.realmJsonFilePath,
235
- cwd: process.cwd()
236
- });
237
- }
238
-
239
- if (buildContext.startKeycloakOptions.realmJsonFilePath !== undefined) {
240
- assert(
241
- await existsAsync(buildContext.startKeycloakOptions.realmJsonFilePath),
242
- `${pathRelative(process.cwd(), buildContext.startKeycloakOptions.realmJsonFilePath)} does not exist`
243
- );
244
- return buildContext.startKeycloakOptions.realmJsonFilePath;
245
- }
246
-
247
- const internalFilePath = await (async () => {
248
- const defaultFilePath = getRealmJsonFilePath_defaultForKeycloakMajor(
249
- keycloakMajorVersionNumber
250
- );
251
-
252
- if (fs.existsSync(defaultFilePath)) {
253
- return defaultFilePath;
254
- }
255
-
256
- console.log(
257
- `${chalk.yellow(
258
- `Keycloakify do not have a realm configuration for Keycloak ${keycloakMajorVersionNumber} yet.`
259
- )}`
260
- );
261
-
262
- console.log(chalk.cyan("Select what configuration to use:"));
263
-
264
- const dirPath = pathDirname(defaultFilePath);
265
-
266
- const { value } = await cliSelect<string>({
267
- values: [
268
- ...fs
269
- .readdirSync(dirPath)
270
- .filter(fileBasename => fileBasename.endsWith(".json")),
271
- "none"
272
- ]
273
- }).catch(() => {
274
- process.exit(-1);
275
- });
276
-
277
- if (value === "none") {
278
- return undefined;
279
- }
280
-
281
- return pathJoin(dirPath, value);
282
- })();
283
-
284
- if (internalFilePath === undefined) {
285
- return undefined;
286
- }
287
-
288
- const filePath = pathJoin(
289
- buildContext.cacheDirPath,
290
- pathBasename(internalFilePath)
291
- );
292
-
293
- fs.writeFileSync(
294
- filePath,
295
- Buffer.from(
296
- fs
297
- .readFileSync(internalFilePath)
298
- .toString("utf8")
299
- .replace(/keycloakify\-starter/g, buildContext.themeNames[0])
300
- ),
301
- "utf8"
302
- );
303
-
304
- return filePath;
305
- })();
306
-
307
- add_test_user_if_missing: {
308
- if (realmJsonFilePath === undefined) {
309
- break add_test_user_if_missing;
310
- }
311
-
312
- const realm: Record<string, unknown> = JSON.parse(
313
- fs.readFileSync(realmJsonFilePath).toString("utf8")
314
- );
315
-
316
- if (realm.users !== undefined) {
317
- break add_test_user_if_missing;
318
- }
319
-
320
- const realmJsonFilePath_internal = (() => {
321
- const filePath = getRealmJsonFilePath_defaultForKeycloakMajor(
322
- keycloakMajorVersionNumber
323
- );
324
-
325
- if (!fs.existsSync(filePath)) {
326
- return getRealmJsonFilePath_defaultForKeycloakMajor(25);
327
- }
328
-
329
- return filePath;
330
- })();
331
-
332
- const users = JSON.parse(
333
- fs.readFileSync(realmJsonFilePath_internal).toString("utf8")
334
- ).users;
335
-
336
- realm.users = users;
337
-
338
- fs.writeFileSync(realmJsonFilePath, JSON.stringify(realm, null, 2), "utf8");
339
- }
293
+ assert<Equals<typeof extensionJar, never>>(false);
294
+ })
295
+ ))
296
+ ];
340
297
 
341
298
  async function extractThemeResourcesFromJar() {
342
299
  await extractArchive({
@@ -376,9 +333,7 @@ export async function command(params: {
376
333
  });
377
334
  } catch {}
378
335
 
379
- const DEFAULT_PORT = 8080;
380
- const port =
381
- cliCommandOptions.port ?? buildContext.startKeycloakOptions.port ?? DEFAULT_PORT;
336
+ const port = cliCommandOptions.port ?? buildContext.startKeycloakOptions.port ?? 8080;
382
337
 
383
338
  const doStartDevServer = (() => {
384
339
  const hasSpaUi =
@@ -434,8 +389,15 @@ export async function command(params: {
434
389
  const dockerRunArgs: string[] = [
435
390
  `-p${SPACE_PLACEHOLDER}${port}:8080`,
436
391
  `--name${SPACE_PLACEHOLDER}${CONTAINER_NAME}`,
437
- `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN=admin`,
438
- `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN_PASSWORD=admin`,
392
+ ...(keycloakMajorVersionNumber >= 26
393
+ ? [
394
+ `-e${SPACE_PLACEHOLDER}KC_BOOTSTRAP_ADMIN_USERNAME=admin`,
395
+ `-e${SPACE_PLACEHOLDER}KC_BOOTSTRAP_ADMIN_PASSWORD=admin`
396
+ ]
397
+ : [
398
+ `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN=admin`,
399
+ `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN_PASSWORD=admin`
400
+ ]),
439
401
  ...(devServerPort === undefined
440
402
  ? []
441
403
  : [
@@ -451,7 +413,7 @@ export async function command(params: {
451
413
  ...(realmJsonFilePath === undefined
452
414
  ? []
453
415
  : [
454
- `-v${SPACE_PLACEHOLDER}"${realmJsonFilePath}":/opt/keycloak/data/import/myrealm-realm.json`
416
+ `-v${SPACE_PLACEHOLDER}"${realmJsonFilePath}":/opt/keycloak/data/import/${realmName}-realm.json`
455
417
  ]),
456
418
  `-v${SPACE_PLACEHOLDER}"${jarFilePath_cacheDir}":/opt/keycloak/providers/keycloak-theme.jar`,
457
419
  ...extensionJarFilePaths.map(
@@ -526,7 +488,14 @@ export async function command(params: {
526
488
  { shell: true }
527
489
  );
528
490
 
529
- child.stdout.on("data", data => process.stdout.write(data));
491
+ child.stdout.on("data", async data => {
492
+ if (data.toString("utf8").includes("keycloakify-logging: REALM_CONFIG_CHANGED")) {
493
+ await onRealmConfigChange();
494
+ return;
495
+ }
496
+
497
+ process.stdout.write(data);
498
+ });
530
499
 
531
500
  child.stderr.on("data", data => process.stderr.write(data));
532
501
 
@@ -573,9 +542,9 @@ export async function command(params: {
573
542
  `${chalk.green("Your theme is accessible at:")}`,
574
543
  `${chalk.green("➜")} ${chalk.cyan.bold(
575
544
  (() => {
576
- const url = new URL("https://my-theme.keycloakify.dev");
545
+ const url = new URL(TEST_APP_URL);
577
546
 
578
- if (port !== DEFAULT_PORT) {
547
+ if (port !== 8080) {
579
548
  url.searchParams.set("port", `${port}`);
580
549
  }
581
550
  if (kcHttpRelativePath !== undefined) {
@@ -584,13 +553,20 @@ export async function command(params: {
584
553
  kcHttpRelativePath
585
554
  );
586
555
  }
556
+ if (realmName !== "myrealm") {
557
+ url.searchParams.set("realm", realmName);
558
+ }
559
+
560
+ if (clientName !== "myclient") {
561
+ url.searchParams.set("client", clientName);
562
+ }
587
563
 
588
564
  return url.href;
589
565
  })()
590
566
  )}`,
591
567
  "",
592
568
  "You can login with the following credentials:",
593
- `- username: ${chalk.cyan.bold("testuser")}`,
569
+ `- username: ${chalk.cyan.bold(username)}`,
594
570
  `- password: ${chalk.cyan.bold("password123")}`,
595
571
  "",
596
572
  `Watching for changes in ${chalk.bold(
@@ -44,6 +44,7 @@ export function startViteDevServer(params: {
44
44
  //Local: http://localhost:8083/
45
45
  const match = data
46
46
  .toString("utf8")
47
+ .replace(/\x1b[[0-9;]*m/g, "")
47
48
  .match(/Local:\s*http:\/\/(?:localhost|127\.0\.0\.1):(\d+)\//);
48
49
 
49
50
  if (match === null) {
@@ -4944,9 +4944,12 @@ __nccwpck_require__.r(__webpack_exports__);
4944
4944
  /* harmony export */ "CONTAINER_NAME": () => (/* binding */ CONTAINER_NAME),
4945
4945
  /* harmony export */ "CUSTOM_HANDLER_ENV_NAMES": () => (/* binding */ CUSTOM_HANDLER_ENV_NAMES),
4946
4946
  /* harmony export */ "FALLBACK_LANGUAGE_TAG": () => (/* binding */ FALLBACK_LANGUAGE_TAG),
4947
+ /* harmony export */ "KEYCLOAKIFY_LOGGING_VERSION": () => (/* binding */ KEYCLOAKIFY_LOGGING_VERSION),
4948
+ /* harmony export */ "KEYCLOAKIFY_LOGIN_JAR_BASENAME": () => (/* binding */ KEYCLOAKIFY_LOGIN_JAR_BASENAME),
4947
4949
  /* harmony export */ "KEYCLOAKIFY_SPA_DEV_SERVER_PORT": () => (/* binding */ KEYCLOAKIFY_SPA_DEV_SERVER_PORT),
4948
4950
  /* harmony export */ "KEYCLOAK_THEME": () => (/* binding */ KEYCLOAK_THEME),
4949
4951
  /* harmony export */ "LOGIN_THEME_PAGE_IDS": () => (/* binding */ LOGIN_THEME_PAGE_IDS),
4952
+ /* harmony export */ "TEST_APP_URL": () => (/* binding */ TEST_APP_URL),
4950
4953
  /* harmony export */ "THEME_TYPES": () => (/* binding */ THEME_TYPES),
4951
4954
  /* harmony export */ "VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES": () => (/* binding */ VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES),
4952
4955
  /* harmony export */ "WELL_KNOWN_DIRECTORY_BASE_NAME": () => (/* binding */ WELL_KNOWN_DIRECTORY_BASE_NAME)
@@ -5018,6 +5021,9 @@ const CUSTOM_HANDLER_ENV_NAMES = {
5018
5021
  };
5019
5022
  const KEYCLOAK_THEME = "keycloak-theme";
5020
5023
  const KEYCLOAKIFY_SPA_DEV_SERVER_PORT = "KEYCLOAKIFY_SPA_DEV_SERVER_PORT";
5024
+ const KEYCLOAKIFY_LOGGING_VERSION = "1.0.3";
5025
+ const KEYCLOAKIFY_LOGIN_JAR_BASENAME = `keycloakify-logging-${KEYCLOAKIFY_LOGGING_VERSION}.jar`;
5026
+ const TEST_APP_URL = "https://my-theme.keycloakify.dev";
5021
5027
  //# sourceMappingURL=constants.js.map
5022
5028
 
5023
5029
  /***/ }),