keycloakify 7.6.1 → 7.6.3

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 (52) hide show
  1. package/account/kcContext/getKcContext.js +3 -1
  2. package/account/kcContext/getKcContext.js.map +1 -1
  3. package/bin/download-builtin-keycloak-theme.js +6 -2
  4. package/bin/download-builtin-keycloak-theme.js.map +1 -1
  5. package/bin/eject-keycloak-page.js +6 -6
  6. package/bin/eject-keycloak-page.js.map +1 -1
  7. package/bin/getSrcDirPath.d.ts +12 -0
  8. package/bin/getSrcDirPath.js +60 -0
  9. package/bin/getSrcDirPath.js.map +1 -0
  10. package/bin/initialize-email-theme.js +4 -2
  11. package/bin/initialize-email-theme.js.map +1 -1
  12. package/bin/keycloakify/BuildOptions.d.ts +5 -3
  13. package/bin/keycloakify/BuildOptions.js +62 -5
  14. package/bin/keycloakify/BuildOptions.js.map +1 -1
  15. package/bin/keycloakify/generateFtl/generateFtl.d.ts +0 -4
  16. package/bin/keycloakify/generateFtl/generateFtl.js +1 -27
  17. package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
  18. package/bin/keycloakify/generateFtl/index.d.ts +1 -0
  19. package/bin/keycloakify/generateFtl/index.js +1 -0
  20. package/bin/keycloakify/generateFtl/index.js.map +1 -1
  21. package/bin/keycloakify/generateFtl/pageId.d.ts +4 -0
  22. package/bin/keycloakify/generateFtl/pageId.js +30 -0
  23. package/bin/keycloakify/generateFtl/pageId.js.map +1 -0
  24. package/bin/keycloakify/keycloakify.js +13 -19
  25. package/bin/keycloakify/keycloakify.js.map +1 -1
  26. package/bin/keycloakify/parsedPackageJson.d.ts +26 -3
  27. package/bin/keycloakify/parsedPackageJson.js +8 -7
  28. package/bin/keycloakify/parsedPackageJson.js.map +1 -1
  29. package/login/kcContext/getKcContext.js +2 -1
  30. package/login/kcContext/getKcContext.js.map +1 -1
  31. package/login/lib/useDownloadTerms.d.ts +1 -2
  32. package/login/pages/Terms.js +3 -2
  33. package/login/pages/Terms.js.map +1 -1
  34. package/package.json +9 -5
  35. package/src/account/kcContext/getKcContext.ts +3 -1
  36. package/src/bin/download-builtin-keycloak-theme.ts +12 -2
  37. package/src/bin/eject-keycloak-page.ts +5 -5
  38. package/src/bin/getSrcDirPath.ts +43 -0
  39. package/src/bin/initialize-email-theme.ts +4 -2
  40. package/src/bin/keycloakify/BuildOptions.ts +53 -10
  41. package/src/bin/keycloakify/generateFtl/generateFtl.ts +0 -31
  42. package/src/bin/keycloakify/generateFtl/index.ts +1 -0
  43. package/src/bin/keycloakify/generateFtl/pageId.ts +30 -0
  44. package/src/bin/keycloakify/keycloakify.ts +14 -21
  45. package/src/bin/keycloakify/parsedPackageJson.ts +12 -10
  46. package/src/login/kcContext/getKcContext.ts +2 -1
  47. package/src/login/lib/useDownloadTerms.ts +1 -1
  48. package/src/login/pages/Terms.tsx +6 -2
  49. package/bin/keycloakify/build-paths.d.ts +0 -12
  50. package/bin/keycloakify/build-paths.js +0 -93
  51. package/bin/keycloakify/build-paths.js.map +0 -1
  52. package/src/bin/keycloakify/build-paths.ts +0 -72
@@ -10,32 +10,25 @@ import { getCliOptions } from "../tools/cliOptions";
10
10
  import jar from "../tools/jar";
11
11
  import { assert } from "tsafe/assert";
12
12
  import { Equals } from "tsafe";
13
- import { getEmailThemeSrcDirPath } from "./build-paths";
14
- import { getCnamePath, getAppInputPath, getKeycloakBuildPath, getReactProjectDirPath } from "./build-paths";
13
+ import { getEmailThemeSrcDirPath } from "../getSrcDirPath";
15
14
 
16
15
  export async function main() {
17
16
  const { isSilent, hasExternalAssets } = getCliOptions(process.argv.slice(2));
18
17
  const logger = getLogger({ isSilent });
19
18
  logger.log("🔏 Building the keycloak theme...⌚");
20
19
 
21
- const buildOptions = readBuildOptions({
22
- "CNAME": (() => {
23
- const cnameFilePath = getCnamePath();
24
-
25
- if (!fs.existsSync(cnameFilePath)) {
26
- return undefined;
27
- }
20
+ const projectDirPath = process.cwd();
28
21
 
29
- return fs.readFileSync(cnameFilePath).toString("utf8");
30
- })(),
22
+ const buildOptions = readBuildOptions({
23
+ projectDirPath,
31
24
  "isExternalAssetsCliParamProvided": hasExternalAssets,
32
25
  "isSilent": isSilent
33
26
  });
34
27
 
35
28
  const { doBundlesEmailTemplate } = await generateKeycloakThemeResources({
36
- keycloakThemeBuildingDirPath: buildOptions.keycloakBuildPath,
29
+ keycloakThemeBuildingDirPath: buildOptions.keycloakifyBuildDirPath,
37
30
  "emailThemeSrcDirPath": (() => {
38
- const { emailThemeSrcDirPath } = getEmailThemeSrcDirPath();
31
+ const { emailThemeSrcDirPath } = getEmailThemeSrcDirPath({ projectDirPath });
39
32
 
40
33
  if (emailThemeSrcDirPath === undefined || !fs.existsSync(emailThemeSrcDirPath)) {
41
34
  return;
@@ -43,13 +36,13 @@ export async function main() {
43
36
 
44
37
  return emailThemeSrcDirPath;
45
38
  })(),
46
- "reactAppBuildDirPath": getAppInputPath(),
39
+ "reactAppBuildDirPath": buildOptions.reactAppBuildDirPath,
47
40
  buildOptions,
48
41
  "keycloakVersion": buildOptions.keycloakVersionDefaultAssets
49
42
  });
50
43
 
51
44
  const { jarFilePath } = generateJavaStackFiles({
52
- keycloakThemeBuildingDirPath: buildOptions.keycloakBuildPath,
45
+ keycloakThemeBuildingDirPath: buildOptions.keycloakifyBuildDirPath,
53
46
  doBundlesEmailTemplate,
54
47
  buildOptions
55
48
  });
@@ -61,7 +54,7 @@ export async function main() {
61
54
  case "keycloakify":
62
55
  logger.log("🫶 Let keycloakify do its thang");
63
56
  await jar({
64
- "rootPath": pathJoin(buildOptions.keycloakBuildPath, "src", "main", "resources"),
57
+ "rootPath": pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources"),
65
58
  "version": buildOptions.version,
66
59
  "groupId": buildOptions.groupId,
67
60
  "artifactId": buildOptions.artifactId,
@@ -70,7 +63,7 @@ export async function main() {
70
63
  break;
71
64
  case "mvn":
72
65
  logger.log("🫙 Run maven to deliver a jar");
73
- child_process.execSync("mvn package", { "cwd": buildOptions.keycloakBuildPath });
66
+ child_process.execSync("mvn package", { "cwd": buildOptions.keycloakifyBuildDirPath });
74
67
  break;
75
68
  default:
76
69
  assert<Equals<typeof buildOptions.bundler, never>>(false);
@@ -80,7 +73,7 @@ export async function main() {
80
73
  const containerKeycloakVersion = "20.0.1";
81
74
 
82
75
  generateStartKeycloakTestingContainer({
83
- keycloakThemeBuildingDirPath: buildOptions.keycloakBuildPath,
76
+ keycloakThemeBuildingDirPath: buildOptions.keycloakifyBuildDirPath,
84
77
  "keycloakVersion": containerKeycloakVersion,
85
78
  buildOptions
86
79
  });
@@ -88,7 +81,7 @@ export async function main() {
88
81
  logger.log(
89
82
  [
90
83
  "",
91
- `✅ Your keycloak theme has been generated and bundled into ./${pathRelative(getReactProjectDirPath(), jarFilePath)} 🚀`,
84
+ `✅ Your keycloak theme has been generated and bundled into .${pathSep}${pathRelative(projectDirPath, jarFilePath)} 🚀`,
92
85
  `It is to be placed in "/opt/keycloak/providers" in the container running a quay.io/keycloak/keycloak Docker image.`,
93
86
  "",
94
87
  //TODO: Restore when we find a good Helm chart for Keycloak.
@@ -123,8 +116,8 @@ export async function main() {
123
116
  `To test your theme locally you can spin up a Keycloak ${containerKeycloakVersion} container image with the theme pre loaded by running:`,
124
117
  "",
125
118
  `👉 $ .${pathSep}${pathRelative(
126
- getReactProjectDirPath(),
127
- pathJoin(getKeycloakBuildPath(), generateStartKeycloakTestingContainer.basename)
119
+ projectDirPath,
120
+ pathJoin(buildOptions.keycloakifyBuildDirPath, generateStartKeycloakTestingContainer.basename)
128
121
  )} 👈`,
129
122
  "",
130
123
  `Test with different Keycloak versions by editing the .sh file. see available versions here: https://quay.io/repository/keycloak/keycloak?tab=tags`,
@@ -4,10 +4,9 @@ import type { Equals } from "tsafe";
4
4
  import { z } from "zod";
5
5
  import { pathJoin } from "../tools/pathJoin";
6
6
 
7
- const reactProjectDirPath = process.cwd();
8
7
  export const bundlers = ["mvn", "keycloakify", "none"] as const;
9
8
  export type Bundler = (typeof bundlers)[number];
10
- type ParsedPackageJson = {
9
+ export type ParsedPackageJson = {
11
10
  name: string;
12
11
  version: string;
13
12
  homepage?: string;
@@ -22,8 +21,8 @@ type ParsedPackageJson = {
22
21
  groupId?: string;
23
22
  bundler?: Bundler;
24
23
  keycloakVersionDefaultAssets?: string;
25
- appInputPath?: string;
26
- keycloakBuildPath?: string;
24
+ reactAppBuildDirPath?: string;
25
+ keycloakifyBuildDirPath?: string;
27
26
  customUserAttributes?: string[];
28
27
  themeName?: string;
29
28
  };
@@ -44,8 +43,8 @@ const zParsedPackageJson = z.object({
44
43
  "groupId": z.string().optional(),
45
44
  "bundler": z.enum(bundlers).optional(),
46
45
  "keycloakVersionDefaultAssets": z.string().optional(),
47
- "appInputPath": z.string().optional(),
48
- "keycloakBuildPath": z.string().optional(),
46
+ "reactAppBuildDirPath": z.string().optional(),
47
+ "keycloakifyBuildDirPath": z.string().optional(),
49
48
  "customUserAttributes": z.array(z.string()).optional(),
50
49
  "themeName": z.string().optional()
51
50
  })
@@ -55,8 +54,11 @@ const zParsedPackageJson = z.object({
55
54
  assert<Equals<ReturnType<(typeof zParsedPackageJson)["parse"]>, ParsedPackageJson>>();
56
55
 
57
56
  let parsedPackageJson: undefined | ReturnType<(typeof zParsedPackageJson)["parse"]>;
58
- export const getParsedPackageJson = () => {
59
- if (parsedPackageJson) return parsedPackageJson;
60
- parsedPackageJson = zParsedPackageJson.parse(JSON.parse(fs.readFileSync(pathJoin(reactProjectDirPath, "package.json")).toString("utf8")));
57
+ export function getParsedPackageJson(params: { projectDirPath: string }) {
58
+ const { projectDirPath } = params;
59
+ if (parsedPackageJson) {
60
+ return parsedPackageJson;
61
+ }
62
+ parsedPackageJson = zParsedPackageJson.parse(JSON.parse(fs.readFileSync(pathJoin(projectDirPath, "package.json")).toString("utf8")));
61
63
  return parsedPackageJson;
62
- };
64
+ }
@@ -11,6 +11,7 @@ import { pathJoin } from "keycloakify/bin/tools/pathJoin";
11
11
  import { pathBasename } from "keycloakify/tools/pathBasename";
12
12
  import { mockTestingResourcesCommonPath } from "keycloakify/bin/mockTestingResourcesPath";
13
13
  import { symToStr } from "tsafe/symToStr";
14
+ import { loginThemePageIds } from "keycloakify/bin/keycloakify/generateFtl/pageId";
14
15
 
15
16
  export function getKcContext<KcContextExtension extends { pageId: string } = never>(params?: {
16
17
  mockPageId?: ExtendKcContext<KcContextExtension>["pageId"];
@@ -121,7 +122,7 @@ export function getKcContext<KcContextExtension extends { pageId: string } = nev
121
122
  return { "kcContext": undefined };
122
123
  }
123
124
 
124
- if (!("login" in realKcContext)) {
125
+ if (id<readonly string[]>(loginThemePageIds).indexOf(realKcContext.pageId) < 0 && !("login" in realKcContext)) {
125
126
  return { "kcContext": undefined };
126
127
  }
127
128
 
@@ -10,7 +10,7 @@ import { KcContext } from "../kcContext";
10
10
  export const evtTermMarkdown = Evt.create<string | undefined>(undefined);
11
11
 
12
12
  export type KcContextLike = {
13
- pageId: KcContext["pageId"];
13
+ pageId: string;
14
14
  locale?: {
15
15
  currentLanguageTag: string;
16
16
  };
@@ -21,13 +21,17 @@ export default function Terms(props: PageProps<Extract<KcContext, { pageId: "ter
21
21
 
22
22
  const { url } = kcContext;
23
23
 
24
- if (evtTermMarkdown.state === undefined) {
24
+ const termMarkdown = evtTermMarkdown.state;
25
+
26
+ if (termMarkdown === undefined) {
25
27
  return null;
26
28
  }
27
29
 
28
30
  return (
29
31
  <Template {...{ kcContext, i18n, doUseDefaultCss, classes }} displayMessage={false} headerNode={msg("termsTitle")}>
30
- <div id="kc-terms-text">{evtTermMarkdown.state && <Markdown>{evtTermMarkdown.state}</Markdown>}</div>
32
+ <div id="kc-terms-text">
33
+ <Markdown>{termMarkdown}</Markdown>
34
+ </div>
31
35
  <form className="form-actions" action={url.loginAction} method="POST">
32
36
  <input
33
37
  className={clsx(
@@ -1,12 +0,0 @@
1
- export declare const getReactProjectDirPath: () => string;
2
- export declare const getCnamePath: () => string;
3
- export declare const getAppInputPath: () => string;
4
- export declare const getKeycloakBuildPath: () => string;
5
- export declare const getThemeSrcDirPath: () => {
6
- themeSrcDirPath: string;
7
- } | {
8
- themeSrcDirPath: undefined;
9
- };
10
- export declare const getEmailThemeSrcDirPath: () => {
11
- emailThemeSrcDirPath: string | undefined;
12
- };
@@ -1,93 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getEmailThemeSrcDirPath = exports.getThemeSrcDirPath = exports.getKeycloakBuildPath = exports.getAppInputPath = exports.getCnamePath = exports.getReactProjectDirPath = void 0;
27
- var fs = __importStar(require("fs"));
28
- var tsafe_1 = require("tsafe");
29
- var crawl_1 = require("../tools/crawl");
30
- var pathJoin_1 = require("../tools/pathJoin");
31
- var parsedPackageJson_1 = require("./parsedPackageJson");
32
- var DEFAULT_APP_INPUT_PATH = "build";
33
- var DEFAULT_KEYCLOAK_BUILD_PATH = "build_keycloak";
34
- var THEME_SRC_DIR_BASENAME = "keycloak-theme";
35
- var getReactProjectDirPath = function () { return process.cwd(); };
36
- exports.getReactProjectDirPath = getReactProjectDirPath;
37
- var getCnamePath = function () { return (0, pathJoin_1.pathJoin)((0, exports.getReactProjectDirPath)(), "public", "CNAME"); };
38
- exports.getCnamePath = getCnamePath;
39
- var parseAppInputPath = function (path) {
40
- if (!path) {
41
- return (0, pathJoin_1.pathJoin)(process.cwd(), DEFAULT_APP_INPUT_PATH);
42
- }
43
- else if (path.startsWith("./")) {
44
- return (0, pathJoin_1.pathJoin)(process.cwd(), path.replace("./", ""));
45
- }
46
- return path;
47
- };
48
- var parseKeycloakBuildPath = function (path) {
49
- if (!path) {
50
- return (0, pathJoin_1.pathJoin)(process.cwd(), DEFAULT_KEYCLOAK_BUILD_PATH);
51
- }
52
- else if (path.startsWith("./")) {
53
- return (0, pathJoin_1.pathJoin)(process.cwd(), path.replace("./", ""));
54
- }
55
- return path;
56
- };
57
- var getAppInputPath = function () {
58
- var _a;
59
- return parseAppInputPath((_a = (0, parsedPackageJson_1.getParsedPackageJson)().keycloakify) === null || _a === void 0 ? void 0 : _a.appInputPath);
60
- };
61
- exports.getAppInputPath = getAppInputPath;
62
- var getKeycloakBuildPath = function () {
63
- var _a;
64
- return parseKeycloakBuildPath((_a = (0, parsedPackageJson_1.getParsedPackageJson)().keycloakify) === null || _a === void 0 ? void 0 : _a.keycloakBuildPath);
65
- };
66
- exports.getKeycloakBuildPath = getKeycloakBuildPath;
67
- var getThemeSrcDirPath = function () {
68
- var srcDirPath = (0, pathJoin_1.pathJoin)((0, exports.getReactProjectDirPath)(), "src");
69
- var themeSrcDirPath = (0, crawl_1.crawl)(srcDirPath)
70
- .map(function (fileRelativePath) {
71
- var split = fileRelativePath.split(THEME_SRC_DIR_BASENAME);
72
- if (split.length !== 2) {
73
- return undefined;
74
- }
75
- return (0, pathJoin_1.pathJoin)(srcDirPath, split[0] + THEME_SRC_DIR_BASENAME);
76
- })
77
- .filter((0, tsafe_1.exclude)(undefined))[0];
78
- if (themeSrcDirPath === undefined) {
79
- if (fs.existsSync((0, pathJoin_1.pathJoin)(srcDirPath, "login")) || fs.existsSync((0, pathJoin_1.pathJoin)(srcDirPath, "account"))) {
80
- return { "themeSrcDirPath": srcDirPath };
81
- }
82
- return { "themeSrcDirPath": undefined };
83
- }
84
- return { themeSrcDirPath: themeSrcDirPath };
85
- };
86
- exports.getThemeSrcDirPath = getThemeSrcDirPath;
87
- var getEmailThemeSrcDirPath = function () {
88
- var themeSrcDirPath = (0, exports.getThemeSrcDirPath)().themeSrcDirPath;
89
- var emailThemeSrcDirPath = themeSrcDirPath === undefined ? undefined : (0, pathJoin_1.pathJoin)(themeSrcDirPath, "email");
90
- return { emailThemeSrcDirPath: emailThemeSrcDirPath };
91
- };
92
- exports.getEmailThemeSrcDirPath = getEmailThemeSrcDirPath;
93
- //# sourceMappingURL=build-paths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-paths.js","sourceRoot":"","sources":["../../src/bin/keycloakify/build-paths.ts"],"names":[],"mappings":"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"}
@@ -1,72 +0,0 @@
1
- import * as fs from "fs";
2
- import { exclude } from "tsafe";
3
- import { crawl } from "../tools/crawl";
4
- import { pathJoin } from "../tools/pathJoin";
5
- import { getParsedPackageJson } from "./parsedPackageJson";
6
-
7
- const DEFAULT_APP_INPUT_PATH = "build";
8
-
9
- const DEFAULT_KEYCLOAK_BUILD_PATH = "build_keycloak";
10
-
11
- const THEME_SRC_DIR_BASENAME = "keycloak-theme";
12
-
13
- export const getReactProjectDirPath = () => process.cwd();
14
-
15
- export const getCnamePath = () => pathJoin(getReactProjectDirPath(), "public", "CNAME");
16
-
17
- const parseAppInputPath = (path?: string) => {
18
- if (!path) {
19
- return pathJoin(process.cwd(), DEFAULT_APP_INPUT_PATH);
20
- } else if (path.startsWith("./")) {
21
- return pathJoin(process.cwd(), path.replace("./", ""));
22
- }
23
- return path;
24
- };
25
-
26
- const parseKeycloakBuildPath = (path?: string) => {
27
- if (!path) {
28
- return pathJoin(process.cwd(), DEFAULT_KEYCLOAK_BUILD_PATH);
29
- } else if (path.startsWith("./")) {
30
- return pathJoin(process.cwd(), path.replace("./", ""));
31
- }
32
- return path;
33
- };
34
-
35
- export const getAppInputPath = () => {
36
- return parseAppInputPath(getParsedPackageJson().keycloakify?.appInputPath);
37
- };
38
-
39
- export const getKeycloakBuildPath = () => {
40
- return parseKeycloakBuildPath(getParsedPackageJson().keycloakify?.keycloakBuildPath);
41
- };
42
- export const getThemeSrcDirPath = () => {
43
- const srcDirPath = pathJoin(getReactProjectDirPath(), "src");
44
-
45
- const themeSrcDirPath: string | undefined = crawl(srcDirPath)
46
- .map(fileRelativePath => {
47
- const split = fileRelativePath.split(THEME_SRC_DIR_BASENAME);
48
-
49
- if (split.length !== 2) {
50
- return undefined;
51
- }
52
-
53
- return pathJoin(srcDirPath, split[0] + THEME_SRC_DIR_BASENAME);
54
- })
55
- .filter(exclude(undefined))[0];
56
- if (themeSrcDirPath === undefined) {
57
- if (fs.existsSync(pathJoin(srcDirPath, "login")) || fs.existsSync(pathJoin(srcDirPath, "account"))) {
58
- return { "themeSrcDirPath": srcDirPath };
59
- }
60
- return { "themeSrcDirPath": undefined };
61
- }
62
-
63
- return { themeSrcDirPath };
64
- };
65
-
66
- export const getEmailThemeSrcDirPath = () => {
67
- const { themeSrcDirPath } = getThemeSrcDirPath();
68
-
69
- const emailThemeSrcDirPath = themeSrcDirPath === undefined ? undefined : pathJoin(themeSrcDirPath, "email");
70
-
71
- return { emailThemeSrcDirPath };
72
- };