keycloakify 10.0.0-rc.141 → 10.0.0-rc.143

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.
package/bin/526.index.js CHANGED
@@ -735,12 +735,15 @@ async function command(params) {
735
735
  });
736
736
  }
737
737
  catch (_g) { }
738
+ const DEFAULT_PORT = 8080;
739
+ const port = (_b = (_a = cliCommandOptions.port) !== null && _a !== void 0 ? _a : buildContext.startKeycloakOptions.port) !== null && _b !== void 0 ? _b : DEFAULT_PORT;
738
740
  const SPACE_PLACEHOLDER = "SPACE_PLACEHOLDER_xKLmdPd";
739
741
  const dockerRunArgs = [
740
- `-p${SPACE_PLACEHOLDER}${(_b = (_a = cliCommandOptions.port) !== null && _a !== void 0 ? _a : buildContext.startKeycloakOptions.port) !== null && _b !== void 0 ? _b : 8080}:8080`,
742
+ `-p${SPACE_PLACEHOLDER}${port}:8080`,
741
743
  `--name${SPACE_PLACEHOLDER}${constants/* CONTAINER_NAME */.sv}`,
742
744
  `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN=admin`,
743
745
  `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN_PASSWORD=admin`,
746
+ buildContext.startKeycloakOptions.dockerExtraArgs.join(SPACE_PLACEHOLDER),
744
747
  ...(realmJsonFilePath === undefined
745
748
  ? []
746
749
  : [
@@ -767,7 +770,6 @@ async function command(params) {
767
770
  .map(({ name, envValue }) => envValue === undefined ? undefined : { name, envValue })
768
771
  .filter((0,exclude.exclude)(undefined))
769
772
  .map(({ name, envValue }) => `--env${SPACE_PLACEHOLDER}${name}='${envValue.replace(/'/g, "'\\''")}'`),
770
- buildContext.startKeycloakOptions.dockerExtraArgs.join(SPACE_PLACEHOLDER),
771
773
  `${(_d = (_c = buildContext.startKeycloakOptions.dockerImage) === null || _c === void 0 ? void 0 : _c.reference) !== null && _d !== void 0 ? _d : "quay.io/keycloak/keycloak"}:${dockerImageTag}`,
772
774
  "start-dev",
773
775
  ...(21 <= keycloakMajorVersionNumber && keycloakMajorVersionNumber < 24
@@ -788,6 +790,15 @@ async function command(params) {
788
790
  child.on("exit", process.exit);
789
791
  const srcDirPath = (0,external_path_.join)(buildContext.projectDirPath, "src");
790
792
  {
793
+ const kcHttpRelativePath = (() => {
794
+ const match = buildContext.startKeycloakOptions.dockerExtraArgs
795
+ .join(" ")
796
+ .match(/KC_HTTP_RELATIVE_PATH=([^ ]+)/);
797
+ if (match === null) {
798
+ return undefined;
799
+ }
800
+ return match[1];
801
+ })();
791
802
  const handler = async (data) => {
792
803
  if (!data.toString("utf8").includes("Listening on: http://0.0.0.0:8080")) {
793
804
  return;
@@ -798,13 +809,22 @@ async function command(params) {
798
809
  "",
799
810
  `The ftl files from ${source_default().bold(`.${external_path_.sep}${(0,external_path_.relative)(process.cwd(), (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme"))}`)} are mounted in the Keycloak container.`,
800
811
  "",
801
- `Keycloak Admin console: ${source_default().cyan.bold(`http://localhost:${cliCommandOptions.port}`)}`,
812
+ `Keycloak Admin console: ${source_default().cyan.bold(`http://localhost:${port}${kcHttpRelativePath !== null && kcHttpRelativePath !== void 0 ? kcHttpRelativePath : ""}`)}`,
802
813
  `- user: ${source_default().cyan.bold("admin")}`,
803
814
  `- password: ${source_default().cyan.bold("admin")}`,
804
815
  "",
805
816
  "",
806
817
  `${source_default().green("Your theme is accessible at:")}`,
807
- `${source_default().green("➜")} ${source_default().cyan.bold(`https://my-theme.keycloakify.dev${cliCommandOptions.port === 8080 ? "" : `?port=${cliCommandOptions.port}`}`)}`,
818
+ `${source_default().green("➜")} ${source_default().cyan.bold((() => {
819
+ const url = new URL("https://my-theme.keycloakify.dev");
820
+ if (port !== DEFAULT_PORT) {
821
+ url.searchParams.set("port", `${port}`);
822
+ }
823
+ if (kcHttpRelativePath !== undefined) {
824
+ url.searchParams.set("kcHttpRelativePath", kcHttpRelativePath);
825
+ }
826
+ return url.href;
827
+ })())}`,
808
828
  "",
809
829
  "You can login with the following credentials:",
810
830
  `- username: ${source_default().cyan.bold("testuser")}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "10.0.0-rc.141",
3
+ "version": "10.0.0-rc.143",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -314,7 +314,8 @@ export async function generateResourcesForMainTheme(params: {
314
314
  }
315
315
 
316
316
  const { extractedDirPath } = await downloadAndExtractArchive({
317
- urlOrPath: "https://repo1.maven.org/maven2/org/keycloak/keycloak-account-ui/25.0.1/keycloak-account-ui-25.0.1.jar",
317
+ urlOrPath:
318
+ "https://repo1.maven.org/maven2/org/keycloak/keycloak-account-ui/25.0.1/keycloak-account-ui-25.0.1.jar",
318
319
  cacheDirPath: buildContext.cacheDirPath,
319
320
  fetchOptions: buildContext.fetchOptions,
320
321
  uniqueIdOfOnArchiveFile: "bring_in_account_v3_i18n_messages",
@@ -334,13 +334,18 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
334
334
  });
335
335
  } catch {}
336
336
 
337
+ const DEFAULT_PORT = 8080;
338
+ const port =
339
+ cliCommandOptions.port ?? buildContext.startKeycloakOptions.port ?? DEFAULT_PORT;
340
+
337
341
  const SPACE_PLACEHOLDER = "SPACE_PLACEHOLDER_xKLmdPd";
338
342
 
339
343
  const dockerRunArgs: string[] = [
340
- `-p${SPACE_PLACEHOLDER}${cliCommandOptions.port ?? buildContext.startKeycloakOptions.port ?? 8080}:8080`,
344
+ `-p${SPACE_PLACEHOLDER}${port}:8080`,
341
345
  `--name${SPACE_PLACEHOLDER}${CONTAINER_NAME}`,
342
346
  `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN=admin`,
343
347
  `-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN_PASSWORD=admin`,
348
+ buildContext.startKeycloakOptions.dockerExtraArgs.join(SPACE_PLACEHOLDER),
344
349
  ...(realmJsonFilePath === undefined
345
350
  ? []
346
351
  : [
@@ -388,7 +393,6 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
388
393
  ({ name, envValue }) =>
389
394
  `--env${SPACE_PLACEHOLDER}${name}='${envValue.replace(/'/g, "'\\''")}'`
390
395
  ),
391
- buildContext.startKeycloakOptions.dockerExtraArgs.join(SPACE_PLACEHOLDER),
392
396
  `${buildContext.startKeycloakOptions.dockerImage?.reference ?? "quay.io/keycloak/keycloak"}:${dockerImageTag}`,
393
397
  "start-dev",
394
398
  ...(21 <= keycloakMajorVersionNumber && keycloakMajorVersionNumber < 24
@@ -427,6 +431,18 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
427
431
  const srcDirPath = pathJoin(buildContext.projectDirPath, "src");
428
432
 
429
433
  {
434
+ const kcHttpRelativePath = (() => {
435
+ const match = buildContext.startKeycloakOptions.dockerExtraArgs
436
+ .join(" ")
437
+ .match(/KC_HTTP_RELATIVE_PATH=([^ ]+)/);
438
+
439
+ if (match === null) {
440
+ return undefined;
441
+ }
442
+
443
+ return match[1];
444
+ })();
445
+
430
446
  const handler = async (data: Buffer) => {
431
447
  if (!data.toString("utf8").includes("Listening on: http://0.0.0.0:8080")) {
432
448
  return;
@@ -444,7 +460,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
444
460
  )} are mounted in the Keycloak container.`,
445
461
  "",
446
462
  `Keycloak Admin console: ${chalk.cyan.bold(
447
- `http://localhost:${cliCommandOptions.port}`
463
+ `http://localhost:${port}${kcHttpRelativePath ?? ""}`
448
464
  )}`,
449
465
  `- user: ${chalk.cyan.bold("admin")}`,
450
466
  `- password: ${chalk.cyan.bold("admin")}`,
@@ -452,7 +468,21 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
452
468
  "",
453
469
  `${chalk.green("Your theme is accessible at:")}`,
454
470
  `${chalk.green("➜")} ${chalk.cyan.bold(
455
- `https://my-theme.keycloakify.dev${cliCommandOptions.port === 8080 ? "" : `?port=${cliCommandOptions.port}`}`
471
+ (() => {
472
+ const url = new URL("https://my-theme.keycloakify.dev");
473
+
474
+ if (port !== DEFAULT_PORT) {
475
+ url.searchParams.set("port", `${port}`);
476
+ }
477
+ if (kcHttpRelativePath !== undefined) {
478
+ url.searchParams.set(
479
+ "kcHttpRelativePath",
480
+ kcHttpRelativePath
481
+ );
482
+ }
483
+
484
+ return url.href;
485
+ })()
456
486
  )}`,
457
487
  "",
458
488
  "You can login with the following credentials:",
@@ -21,7 +21,7 @@ export async function downloadAndExtractArchive(params: {
21
21
  }) => Promise<void>;
22
22
  cacheDirPath: string;
23
23
  fetchOptions: FetchOptions | undefined;
24
- }): Promise<{ extractedDirPath: string; archiveFilePath: string; }> {
24
+ }): Promise<{ extractedDirPath: string; archiveFilePath: string }> {
25
25
  const {
26
26
  urlOrPath,
27
27
  uniqueIdOfOnArchiveFile,