keycloakify 7.14.0 → 7.14.2
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/README.md +6 -1
- package/bin/eject-keycloak-page.js +0 -3
- package/bin/eject-keycloak-page.js.map +1 -1
- package/bin/getSrcDirPath.d.ts +1 -2
- package/bin/getSrcDirPath.js +61 -4
- package/bin/getSrcDirPath.js.map +1 -1
- package/bin/initialize-email-theme.js +0 -4
- package/bin/initialize-email-theme.js.map +1 -1
- package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +213 -210
- package/bin/keycloakify/generateTheme/generateTheme.d.ts +1 -1
- package/bin/keycloakify/generateTheme/generateTheme.js +10 -16
- package/bin/keycloakify/generateTheme/generateTheme.js.map +1 -1
- package/bin/keycloakify/generateTheme/readFieldNameUsage.d.ts +3 -2
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js +2 -51
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +1 -1
- package/bin/keycloakify/keycloakify.js +0 -5
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/eject-keycloak-page.ts +0 -4
- package/src/bin/getSrcDirPath.ts +19 -5
- package/src/bin/initialize-email-theme.ts +0 -6
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +213 -210
- package/src/bin/keycloakify/generateTheme/generateTheme.ts +24 -31
- package/src/bin/keycloakify/generateTheme/readFieldNameUsage.ts +5 -64
- package/src/bin/keycloakify/keycloakify.ts +0 -6
@@ -52,7 +52,7 @@ assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
|
52
52
|
export async function generateTheme(params: {
|
53
53
|
reactAppBuildDirPath: string;
|
54
54
|
keycloakThemeBuildingDirPath: string;
|
55
|
-
themeSrcDirPath: string
|
55
|
+
themeSrcDirPath: string;
|
56
56
|
keycloakifySrcDirPath: string;
|
57
57
|
buildOptions: BuildOptionsLike;
|
58
58
|
keycloakifyVersion: string;
|
@@ -67,6 +67,10 @@ export async function generateTheme(params: {
|
|
67
67
|
let generateFtlFilesCode_glob: ReturnType<typeof generateFtlFilesCodeFactory>["generateFtlFilesCode"] | undefined = undefined;
|
68
68
|
|
69
69
|
for (const themeType of themeTypes) {
|
70
|
+
if (!fs.existsSync(pathJoin(themeSrcDirPath, themeType))) {
|
71
|
+
continue;
|
72
|
+
}
|
73
|
+
|
70
74
|
const themeDirPath = getThemeDirPath(themeType);
|
71
75
|
|
72
76
|
copy_app_resources_to_theme_path: {
|
@@ -132,26 +136,21 @@ export async function generateTheme(params: {
|
|
132
136
|
});
|
133
137
|
}
|
134
138
|
|
135
|
-
const generateFtlFilesCode =
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
})
|
151
|
-
});
|
152
|
-
|
153
|
-
return generateFtlFilesCode;
|
154
|
-
})();
|
139
|
+
const generateFtlFilesCode =
|
140
|
+
generateFtlFilesCode_glob !== undefined
|
141
|
+
? generateFtlFilesCode_glob
|
142
|
+
: generateFtlFilesCodeFactory({
|
143
|
+
"indexHtmlCode": fs.readFileSync(pathJoin(reactAppBuildDirPath, "index.html")).toString("utf8"),
|
144
|
+
"cssGlobalsToDefine": allCssGlobalsToDefine,
|
145
|
+
buildOptions,
|
146
|
+
keycloakifyVersion,
|
147
|
+
themeType,
|
148
|
+
"fieldNames": readFieldNameUsage({
|
149
|
+
keycloakifySrcDirPath,
|
150
|
+
themeSrcDirPath,
|
151
|
+
themeType
|
152
|
+
})
|
153
|
+
}).generateFtlFilesCode;
|
155
154
|
|
156
155
|
[
|
157
156
|
...(() => {
|
@@ -162,12 +161,10 @@ export async function generateTheme(params: {
|
|
162
161
|
return accountThemePageIds;
|
163
162
|
}
|
164
163
|
})(),
|
165
|
-
...(
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
themeSrcDirPath
|
170
|
-
}))
|
164
|
+
...readExtraPagesNames({
|
165
|
+
themeType,
|
166
|
+
themeSrcDirPath
|
167
|
+
})
|
171
168
|
].forEach(pageId => {
|
172
169
|
const { ftlCode } = generateFtlFilesCode({ pageId });
|
173
170
|
|
@@ -224,10 +221,6 @@ export async function generateTheme(params: {
|
|
224
221
|
}
|
225
222
|
|
226
223
|
email: {
|
227
|
-
if (themeSrcDirPath === undefined) {
|
228
|
-
break email;
|
229
|
-
}
|
230
|
-
|
231
224
|
const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
|
232
225
|
|
233
226
|
if (!fs.existsSync(emailThemeSrcDirPath)) {
|
@@ -5,74 +5,15 @@ import * as fs from "fs";
|
|
5
5
|
import type { ThemeType } from "../generateFtl";
|
6
6
|
import { exclude } from "tsafe/exclude";
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
themeSrcDirPath: string | undefined;
|
11
|
-
themeType: ThemeType | "email";
|
12
|
-
}): string[] {
|
8
|
+
/** Assumes the theme type exists */
|
9
|
+
export function readFieldNameUsage(params: { keycloakifySrcDirPath: string; themeSrcDirPath: string; themeType: ThemeType }): string[] {
|
13
10
|
const { keycloakifySrcDirPath, themeSrcDirPath, themeType } = params;
|
14
11
|
|
15
12
|
const fieldNames: string[] = [];
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
...[
|
21
|
-
"global",
|
22
|
-
"userLabel",
|
23
|
-
"username",
|
24
|
-
"email",
|
25
|
-
"firstName",
|
26
|
-
"lastName",
|
27
|
-
"password",
|
28
|
-
"password-confirm",
|
29
|
-
"totp",
|
30
|
-
"totpSecret",
|
31
|
-
"SAMLRequest",
|
32
|
-
"SAMLResponse",
|
33
|
-
"relayState",
|
34
|
-
"device_user_code",
|
35
|
-
"code",
|
36
|
-
"password-new",
|
37
|
-
"rememberMe",
|
38
|
-
"login",
|
39
|
-
"authenticationExecution",
|
40
|
-
"cancel-aia",
|
41
|
-
"clientDataJSON",
|
42
|
-
"authenticatorData",
|
43
|
-
"signature",
|
44
|
-
"credentialId",
|
45
|
-
"userHandle",
|
46
|
-
"error",
|
47
|
-
"authn_use_chk",
|
48
|
-
"authenticationExecution",
|
49
|
-
"isSetRetry",
|
50
|
-
"try-again",
|
51
|
-
"attestationObject",
|
52
|
-
"publicKeyCredentialId",
|
53
|
-
"authenticatorLabel"
|
54
|
-
]
|
55
|
-
);
|
56
|
-
}
|
57
|
-
|
58
|
-
for (const srcDirPath of (
|
59
|
-
[
|
60
|
-
pathJoin(keycloakifySrcDirPath, themeType),
|
61
|
-
(() => {
|
62
|
-
if (themeSrcDirPath === undefined) {
|
63
|
-
return undefined;
|
64
|
-
}
|
65
|
-
|
66
|
-
const srcDirPath = pathJoin(themeSrcDirPath, themeType);
|
67
|
-
|
68
|
-
if (!fs.existsSync(srcDirPath)) {
|
69
|
-
return undefined;
|
70
|
-
}
|
71
|
-
|
72
|
-
return srcDirPath;
|
73
|
-
})()
|
74
|
-
] as const
|
75
|
-
).filter(exclude(undefined))) {
|
14
|
+
for (const srcDirPath of ([pathJoin(keycloakifySrcDirPath, themeType), pathJoin(themeSrcDirPath, themeType)] as const).filter(
|
15
|
+
exclude(undefined)
|
16
|
+
)) {
|
76
17
|
const filePaths = crawl({ "dirPath": srcDirPath, "returnedPathsType": "absolute" }).filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath));
|
77
18
|
|
78
19
|
for (const filePath of filePaths) {
|
@@ -57,12 +57,6 @@ export async function main() {
|
|
57
57
|
"email": false
|
58
58
|
};
|
59
59
|
|
60
|
-
if (themeSrcDirPath === undefined) {
|
61
|
-
implementedThemeTypes["login"] = true;
|
62
|
-
implementedThemeTypes["account"] = true;
|
63
|
-
return implementedThemeTypes;
|
64
|
-
}
|
65
|
-
|
66
60
|
for (const themeType of objectKeys(implementedThemeTypes)) {
|
67
61
|
if (!fs.existsSync(pathJoin(themeSrcDirPath, themeType))) {
|
68
62
|
continue;
|