keycloakify 11.8.0 → 11.8.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/bin/{33.index.js → 226.index.js} +2 -19
- package/bin/355.index.js +1 -1
- package/bin/363.index.js +112 -93
- package/bin/{664.index.js → 502.index.js} +112 -110
- package/bin/656.index.js +1 -1
- package/bin/{880.index.js → 712.index.js} +28 -72
- package/bin/780.index.js +1 -1
- package/bin/932.index.js +1 -1
- package/bin/97.index.js +42 -34
- package/bin/main.js +17 -28
- package/bin/start-keycloak/realmConfig/prepareRealmConfig.d.ts +5 -6
- package/bin/start-keycloak/realmConfig/realmConfig.d.ts +6 -2
- package/package.json +4 -6
- package/src/bin/keycloakify/buildJars/buildJar.ts +45 -20
- package/src/bin/keycloakify/generateResources/generateResources.ts +8 -37
- package/src/bin/start-keycloak/realmConfig/prepareRealmConfig.ts +12 -23
- package/src/bin/start-keycloak/realmConfig/realmConfig.ts +14 -12
- package/src/bin/start-keycloak/start-keycloak.ts +55 -28
- package/bin/shared/metaInfKeycloakThemes.d.ts +0 -13
- package/src/bin/shared/metaInfKeycloakThemes.ts +0 -40
package/bin/97.index.js
CHANGED
@@ -855,8 +855,6 @@ const { getCachedValue, setCachedValue } = (() => {
|
|
855
855
|
};
|
856
856
|
})();
|
857
857
|
//# sourceMappingURL=getSupportedDockerImageTags.js.map
|
858
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/objectKeys.mjs
|
859
|
-
var objectKeys = __webpack_require__(23483);
|
860
858
|
// EXTERNAL MODULE: ./node_modules/evt/tools/inDepth/same.js
|
861
859
|
var same = __webpack_require__(33805);
|
862
860
|
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/prepareRealmConfig.js
|
@@ -864,10 +862,8 @@ var same = __webpack_require__(33805);
|
|
864
862
|
|
865
863
|
|
866
864
|
|
867
|
-
|
868
|
-
assert/* assert */.h;
|
869
865
|
function prepareRealmConfig(params) {
|
870
|
-
const { parsedRealmJson, keycloakMajorVersionNumber,
|
866
|
+
const { parsedRealmJson, keycloakMajorVersionNumber, parsedKeycloakThemesJsonEntry } = params;
|
871
867
|
const { username } = addOrEditTestUser({
|
872
868
|
parsedRealmJson,
|
873
869
|
keycloakMajorVersionNumber
|
@@ -879,8 +875,7 @@ function prepareRealmConfig(params) {
|
|
879
875
|
editAccountConsoleAndSecurityAdminConsole({ parsedRealmJson });
|
880
876
|
enableCustomThemes({
|
881
877
|
parsedRealmJson,
|
882
|
-
|
883
|
-
implementedThemeTypes: buildContext.implementedThemeTypes
|
878
|
+
parsedKeycloakThemesJsonEntry
|
884
879
|
});
|
885
880
|
enable_custom_events_listeners: {
|
886
881
|
const name = "keycloakify-logging";
|
@@ -897,12 +892,12 @@ function prepareRealmConfig(params) {
|
|
897
892
|
};
|
898
893
|
}
|
899
894
|
function enableCustomThemes(params) {
|
900
|
-
const { parsedRealmJson,
|
901
|
-
for (const themeType of
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
895
|
+
const { parsedRealmJson, parsedKeycloakThemesJsonEntry } = params;
|
896
|
+
for (const themeType of [...constants/* THEME_TYPES */.Jh, "email"]) {
|
897
|
+
parsedRealmJson[`${themeType}Theme`] =
|
898
|
+
!parsedKeycloakThemesJsonEntry.types.includes(themeType)
|
899
|
+
? ""
|
900
|
+
: parsedKeycloakThemesJsonEntry.name;
|
906
901
|
}
|
907
902
|
}
|
908
903
|
function addOrEditTestUser(params) {
|
@@ -1443,7 +1438,7 @@ async function dumpContainerConfig(params) {
|
|
1443
1438
|
|
1444
1439
|
assert/* assert */.h;
|
1445
1440
|
async function getRealmConfig(params) {
|
1446
|
-
const { keycloakMajorVersionNumber, realmJsonFilePath_userProvided, buildContext } = params;
|
1441
|
+
const { keycloakMajorVersionNumber, realmJsonFilePath_userProvided, parsedKeycloakThemesJsonEntry, buildContext } = params;
|
1447
1442
|
const realmJsonFilePath = (0,external_path_.join)(buildContext.projectDirPath, ".keycloakify", `realm-kc-${keycloakMajorVersionNumber}.json`);
|
1448
1443
|
const parsedRealmJson = await (async () => {
|
1449
1444
|
if (realmJsonFilePath_userProvided !== undefined) {
|
@@ -1460,8 +1455,8 @@ async function getRealmConfig(params) {
|
|
1460
1455
|
})();
|
1461
1456
|
const { clientName, realmName, username } = prepareRealmConfig({
|
1462
1457
|
parsedRealmJson,
|
1463
|
-
|
1464
|
-
|
1458
|
+
keycloakMajorVersionNumber,
|
1459
|
+
parsedKeycloakThemesJsonEntry
|
1465
1460
|
});
|
1466
1461
|
{
|
1467
1462
|
const dirPath = (0,external_path_.dirname)(realmJsonFilePath);
|
@@ -1546,6 +1541,7 @@ async function getRealmConfig(params) {
|
|
1546
1541
|
|
1547
1542
|
|
1548
1543
|
|
1544
|
+
|
1549
1545
|
|
1550
1546
|
|
1551
1547
|
async function command(params) {
|
@@ -1687,23 +1683,6 @@ async function command(params) {
|
|
1687
1683
|
}
|
1688
1684
|
return wrap.majorVersionNumber;
|
1689
1685
|
})();
|
1690
|
-
const { clientName, onRealmConfigChange, realmJsonFilePath, realmName, username } = await getRealmConfig({
|
1691
|
-
keycloakMajorVersionNumber,
|
1692
|
-
realmJsonFilePath_userProvided: await (async () => {
|
1693
|
-
if (cliCommandOptions.realmJsonFilePath !== undefined) {
|
1694
|
-
return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
1695
|
-
pathIsh: cliCommandOptions.realmJsonFilePath,
|
1696
|
-
cwd: process.cwd()
|
1697
|
-
});
|
1698
|
-
}
|
1699
|
-
if (buildContext.startKeycloakOptions.realmJsonFilePath !== undefined) {
|
1700
|
-
(0,assert/* assert */.h)(await (0,fs_existsAsync/* existsAsync */.o)(buildContext.startKeycloakOptions.realmJsonFilePath), `${(0,external_path_.relative)(process.cwd(), buildContext.startKeycloakOptions.realmJsonFilePath)} does not exist`);
|
1701
|
-
return buildContext.startKeycloakOptions.realmJsonFilePath;
|
1702
|
-
}
|
1703
|
-
return undefined;
|
1704
|
-
})(),
|
1705
|
-
buildContext
|
1706
|
-
});
|
1707
1686
|
{
|
1708
1687
|
const { isAppBuildSuccess } = await appBuild({
|
1709
1688
|
buildContext
|
@@ -1753,10 +1732,16 @@ async function command(params) {
|
|
1753
1732
|
(0,assert/* assert */.h)(false);
|
1754
1733
|
})))
|
1755
1734
|
];
|
1735
|
+
let parsedKeycloakThemesJson = (0,id.id)(undefined);
|
1756
1736
|
async function extractThemeResourcesFromJar() {
|
1757
1737
|
await extractArchive({
|
1758
1738
|
archiveFilePath: jarFilePath,
|
1759
|
-
onArchiveFile: async ({ relativeFilePathInArchive, writeFile }) => {
|
1739
|
+
onArchiveFile: async ({ relativeFilePathInArchive, writeFile, readFile }) => {
|
1740
|
+
if (relativeFilePathInArchive ===
|
1741
|
+
(0,external_path_.join)("META-INF", "keycloak-themes.json") &&
|
1742
|
+
parsedKeycloakThemesJson === undefined) {
|
1743
|
+
parsedKeycloakThemesJson = JSON.parse((await readFile()).toString("utf8"));
|
1744
|
+
}
|
1760
1745
|
if ((0,isInside/* isInside */.V)({ dirPath: "theme", filePath: relativeFilePathInArchive })) {
|
1761
1746
|
await writeFile({
|
1762
1747
|
filePath: (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, relativeFilePathInArchive)
|
@@ -1772,6 +1757,29 @@ async function command(params) {
|
|
1772
1757
|
}
|
1773
1758
|
}
|
1774
1759
|
await extractThemeResourcesFromJar();
|
1760
|
+
(0,assert/* assert */.h)(parsedKeycloakThemesJson !== undefined);
|
1761
|
+
const { clientName, onRealmConfigChange, realmJsonFilePath, realmName, username } = await getRealmConfig({
|
1762
|
+
keycloakMajorVersionNumber,
|
1763
|
+
parsedKeycloakThemesJsonEntry: (() => {
|
1764
|
+
const entry = parsedKeycloakThemesJson.themes.find(({ name }) => name === buildContext.themeNames[0]);
|
1765
|
+
(0,assert/* assert */.h)(entry !== undefined);
|
1766
|
+
return entry;
|
1767
|
+
})(),
|
1768
|
+
realmJsonFilePath_userProvided: await (async () => {
|
1769
|
+
if (cliCommandOptions.realmJsonFilePath !== undefined) {
|
1770
|
+
return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
1771
|
+
pathIsh: cliCommandOptions.realmJsonFilePath,
|
1772
|
+
cwd: process.cwd()
|
1773
|
+
});
|
1774
|
+
}
|
1775
|
+
if (buildContext.startKeycloakOptions.realmJsonFilePath !== undefined) {
|
1776
|
+
(0,assert/* assert */.h)(await (0,fs_existsAsync/* existsAsync */.o)(buildContext.startKeycloakOptions.realmJsonFilePath), `${(0,external_path_.relative)(process.cwd(), buildContext.startKeycloakOptions.realmJsonFilePath)} does not exist`);
|
1777
|
+
return buildContext.startKeycloakOptions.realmJsonFilePath;
|
1778
|
+
}
|
1779
|
+
return undefined;
|
1780
|
+
})(),
|
1781
|
+
buildContext
|
1782
|
+
});
|
1775
1783
|
const jarFilePath_cacheDir = (0,external_path_.join)(buildContext.cacheDirPath, (0,external_path_.basename)(jarFilePath));
|
1776
1784
|
external_fs_.copyFileSync(jarFilePath, jarFilePath_cacheDir);
|
1777
1785
|
try {
|
package/bin/main.js
CHANGED
@@ -8693,24 +8693,6 @@ const id = (x) => x;
|
|
8693
8693
|
//# sourceMappingURL=id.mjs.map
|
8694
8694
|
|
8695
8695
|
|
8696
|
-
/***/ }),
|
8697
|
-
|
8698
|
-
/***/ 91040:
|
8699
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
8700
|
-
|
8701
|
-
"use strict";
|
8702
|
-
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
8703
|
-
/* harmony export */ "q": () => (/* binding */ objectEntries)
|
8704
|
-
/* harmony export */ });
|
8705
|
-
/** https://docs.tsafe.dev/objectentries */
|
8706
|
-
function objectEntries(o) {
|
8707
|
-
return Object.entries(o);
|
8708
|
-
}
|
8709
|
-
|
8710
|
-
|
8711
|
-
//# sourceMappingURL=objectEntries.mjs.map
|
8712
|
-
|
8713
|
-
|
8714
8696
|
/***/ }),
|
8715
8697
|
|
8716
8698
|
/***/ 52300:
|
@@ -15400,8 +15382,15 @@ var exclude = __nccwpck_require__(83101);
|
|
15400
15382
|
|
15401
15383
|
// EXTERNAL MODULE: ./dist/bin/tools/crawl.js
|
15402
15384
|
var crawl = __nccwpck_require__(73036);
|
15403
|
-
|
15404
|
-
|
15385
|
+
;// CONCATENATED MODULE: ./node_modules/tsafe/esm/objectEntries.mjs
|
15386
|
+
/** https://docs.tsafe.dev/objectentries */
|
15387
|
+
function objectEntries(o) {
|
15388
|
+
return Object.entries(o);
|
15389
|
+
}
|
15390
|
+
|
15391
|
+
|
15392
|
+
//# sourceMappingURL=objectEntries.mjs.map
|
15393
|
+
|
15405
15394
|
// EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
|
15406
15395
|
var id = __nccwpck_require__(38469);
|
15407
15396
|
;// CONCATENATED MODULE: ./dist/bin/tools/fetchProxyOptions.js
|
@@ -16003,7 +15992,7 @@ function getBuildContext(params) {
|
|
16003
15992
|
if (keycloakVersionTargets === undefined) {
|
16004
15993
|
break use_custom_jar_basename;
|
16005
15994
|
}
|
16006
|
-
const entry =
|
15995
|
+
const entry = objectEntries(keycloakVersionTargets).find(([keycloakVersionRange_entry]) => keycloakVersionRange_entry === keycloakVersionRange);
|
16007
15996
|
if (entry === undefined) {
|
16008
15997
|
break use_custom_jar_basename;
|
16009
15998
|
}
|
@@ -16058,7 +16047,7 @@ function getBuildContext(params) {
|
|
16058
16047
|
return jarTargets_default;
|
16059
16048
|
}
|
16060
16049
|
const jarTargets = [];
|
16061
|
-
for (const [keycloakVersionRange, jarNameOrBoolean] of
|
16050
|
+
for (const [keycloakVersionRange, jarNameOrBoolean] of objectEntries((() => {
|
16062
16051
|
const { keycloakVersionTargets } = buildOptions;
|
16063
16052
|
(0,assert/* assert */.h)((0,assert.is)(keycloakVersionTargets));
|
16064
16053
|
return keycloakVersionTargets;
|
@@ -16181,7 +16170,7 @@ program
|
|
16181
16170
|
.task({
|
16182
16171
|
skip,
|
16183
16172
|
handler: async ({ projectDirPath }) => {
|
16184
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(783), __nccwpck_require__.e(
|
16173
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(783), __nccwpck_require__.e(712)]).then(__nccwpck_require__.bind(__nccwpck_require__, 35712));
|
16185
16174
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16186
16175
|
}
|
16187
16176
|
});
|
@@ -16229,7 +16218,7 @@ program
|
|
16229
16218
|
.task({
|
16230
16219
|
skip,
|
16231
16220
|
handler: async ({ projectDirPath, keycloakVersion, port, realmJsonFilePath }) => {
|
16232
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16221
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(226), __nccwpck_require__.e(297), __nccwpck_require__.e(97)]).then(__nccwpck_require__.bind(__nccwpck_require__, 64097));
|
16233
16222
|
await command({
|
16234
16223
|
buildContext: getBuildContext({ projectDirPath }),
|
16235
16224
|
cliCommandOptions: {
|
@@ -16272,7 +16261,7 @@ program
|
|
16272
16261
|
.task({
|
16273
16262
|
skip,
|
16274
16263
|
handler: async ({ projectDirPath }) => {
|
16275
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16264
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(502), __nccwpck_require__.e(932)]).then(__nccwpck_require__.bind(__nccwpck_require__, 16932));
|
16276
16265
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16277
16266
|
}
|
16278
16267
|
});
|
@@ -16296,7 +16285,7 @@ program
|
|
16296
16285
|
.task({
|
16297
16286
|
skip,
|
16298
16287
|
handler: async ({ projectDirPath }) => {
|
16299
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16288
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(502), __nccwpck_require__.e(355)]).then(__nccwpck_require__.bind(__nccwpck_require__, 60355));
|
16300
16289
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16301
16290
|
}
|
16302
16291
|
});
|
@@ -16349,7 +16338,7 @@ program
|
|
16349
16338
|
.task({
|
16350
16339
|
skip,
|
16351
16340
|
handler: async ({ projectDirPath }) => {
|
16352
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16341
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(226), __nccwpck_require__.e(363), __nccwpck_require__.e(946)]).then(__nccwpck_require__.bind(__nccwpck_require__, 74946));
|
16353
16342
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16354
16343
|
}
|
16355
16344
|
});
|
@@ -16403,7 +16392,7 @@ program
|
|
16403
16392
|
.task({
|
16404
16393
|
skip,
|
16405
16394
|
handler: async ({ projectDirPath, path, revert }) => {
|
16406
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16395
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(226), __nccwpck_require__.e(363), __nccwpck_require__.e(930)]).then(__nccwpck_require__.bind(__nccwpck_require__, 71930));
|
16407
16396
|
await command({
|
16408
16397
|
buildContext: getBuildContext({ projectDirPath }),
|
16409
16398
|
cliCommandOptions: { path, isRevert: revert }
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import type { ParsedRealmJson } from "./ParsedRealmJson";
|
2
|
-
import type
|
3
|
-
export type BuildContextLike = {
|
4
|
-
themeNames: BuildContext["themeNames"];
|
5
|
-
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
6
|
-
};
|
2
|
+
import { type ThemeType } from "../../shared/constants";
|
7
3
|
export declare function prepareRealmConfig(params: {
|
8
4
|
parsedRealmJson: ParsedRealmJson;
|
9
5
|
keycloakMajorVersionNumber: number;
|
10
|
-
|
6
|
+
parsedKeycloakThemesJsonEntry: {
|
7
|
+
name: string;
|
8
|
+
types: (ThemeType | "email")[];
|
9
|
+
};
|
11
10
|
}): {
|
12
11
|
realmName: string;
|
13
12
|
clientName: string;
|
@@ -1,11 +1,15 @@
|
|
1
|
-
import { type BuildContextLike as BuildContextLike_prepareRealmConfig } from "./prepareRealmConfig";
|
2
1
|
import { type BuildContextLike as BuildContextLike_dumpContainerConfig } from "./dumpContainerConfig";
|
3
|
-
|
2
|
+
import type { ThemeType } from "../../shared/constants";
|
3
|
+
export type BuildContextLike = BuildContextLike_dumpContainerConfig & {
|
4
4
|
projectDirPath: string;
|
5
5
|
};
|
6
6
|
export declare function getRealmConfig(params: {
|
7
7
|
keycloakMajorVersionNumber: number;
|
8
8
|
realmJsonFilePath_userProvided: string | undefined;
|
9
|
+
parsedKeycloakThemesJsonEntry: {
|
10
|
+
name: string;
|
11
|
+
types: (ThemeType | "email")[];
|
12
|
+
};
|
9
13
|
buildContext: BuildContextLike;
|
10
14
|
}): Promise<{
|
11
15
|
realmJsonFilePath: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "keycloakify",
|
3
|
-
"version": "11.8.
|
3
|
+
"version": "11.8.2",
|
4
4
|
"description": "Framework to create custom Keycloak UIs",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -688,7 +688,6 @@
|
|
688
688
|
"src/bin/shared/customHandler_delegate.ts",
|
689
689
|
"src/bin/shared/exitIfUncommittedChanges.ts",
|
690
690
|
"src/bin/shared/initializeSpa.ts",
|
691
|
-
"src/bin/shared/metaInfKeycloakThemes.ts",
|
692
691
|
"src/bin/start-keycloak/appBuild.ts",
|
693
692
|
"src/bin/start-keycloak/getSupportedDockerImageTags.ts",
|
694
693
|
"src/bin/start-keycloak/index.ts",
|
@@ -1060,7 +1059,6 @@
|
|
1060
1059
|
"bin/shared/exitIfUncommittedChanges.d.ts",
|
1061
1060
|
"bin/shared/initializeSpa.d.ts",
|
1062
1061
|
"bin/shared/KeycloakVersionRange.d.ts",
|
1063
|
-
"bin/shared/metaInfKeycloakThemes.d.ts",
|
1064
1062
|
"bin/start-keycloak/appBuild.d.ts",
|
1065
1063
|
"bin/start-keycloak/getSupportedDockerImageTags.d.ts",
|
1066
1064
|
"bin/start-keycloak/index.d.ts",
|
@@ -1115,24 +1113,24 @@
|
|
1115
1113
|
"bin/tools/untrackFromGit.d.ts",
|
1116
1114
|
"bin/update-kc-gen.d.ts",
|
1117
1115
|
"bin/main.js",
|
1116
|
+
"bin/226.index.js",
|
1118
1117
|
"bin/266.index.js",
|
1119
1118
|
"bin/297.index.js",
|
1120
1119
|
"bin/304.index.js",
|
1121
|
-
"bin/33.index.js",
|
1122
1120
|
"bin/355.index.js",
|
1123
1121
|
"bin/363.index.js",
|
1124
1122
|
"bin/369.index.js",
|
1125
1123
|
"bin/40.index.js",
|
1126
1124
|
"bin/453.index.js",
|
1125
|
+
"bin/502.index.js",
|
1127
1126
|
"bin/656.index.js",
|
1128
1127
|
"bin/658.index.js",
|
1129
|
-
"bin/
|
1128
|
+
"bin/712.index.js",
|
1130
1129
|
"bin/720.index.js",
|
1131
1130
|
"bin/780.index.js",
|
1132
1131
|
"bin/783.index.js",
|
1133
1132
|
"bin/786.index.js",
|
1134
1133
|
"bin/877.index.js",
|
1135
|
-
"bin/880.index.js",
|
1136
1134
|
"bin/930.index.js",
|
1137
1135
|
"bin/932.index.js",
|
1138
1136
|
"bin/946.index.js",
|
@@ -15,7 +15,6 @@ import { readFileSync } from "fs";
|
|
15
15
|
import { isInside } from "../../tools/isInside";
|
16
16
|
import child_process from "child_process";
|
17
17
|
import { rmSync } from "../../tools/fs.rmSync";
|
18
|
-
import { writeMetaInfKeycloakThemes } from "../../shared/metaInfKeycloakThemes";
|
19
18
|
import { existsAsync } from "../../tools/fs.existsAsync";
|
20
19
|
|
21
20
|
export type BuildContextLike = BuildContextLike_generatePom & {
|
@@ -106,29 +105,55 @@ export async function buildJar(params: {
|
|
106
105
|
}
|
107
106
|
});
|
108
107
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
{
|
109
|
+
const filePath = pathJoin(
|
110
|
+
tmpResourcesDirPath,
|
111
|
+
"META-INF",
|
112
|
+
"keycloak-themes.json"
|
113
|
+
);
|
114
114
|
|
115
|
-
|
116
|
-
// NOTE: No, we need to keep account-v1 in meta-inf
|
117
|
-
break remove_account_v1_in_meta_inf;
|
118
|
-
}
|
115
|
+
await fs.mkdir(pathDirname(filePath));
|
119
116
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
117
|
+
await fs.writeFile(
|
118
|
+
filePath,
|
119
|
+
Buffer.from(
|
120
|
+
JSON.stringify(
|
121
|
+
{
|
122
|
+
themes: await (async () => {
|
123
|
+
const dirPath = pathJoin(tmpResourcesDirPath, "theme");
|
124
124
|
|
125
|
-
|
126
|
-
|
127
|
-
|
125
|
+
const themeNames = (await fs.readdir(dirPath)).sort(
|
126
|
+
(a, b) => {
|
127
|
+
const indexA = buildContext.themeNames.indexOf(a);
|
128
|
+
const indexB = buildContext.themeNames.indexOf(b);
|
128
129
|
|
129
|
-
|
130
|
-
|
131
|
-
|
130
|
+
const orderA = indexA === -1 ? Infinity : indexA;
|
131
|
+
const orderB = indexB === -1 ? Infinity : indexB;
|
132
|
+
|
133
|
+
return orderA - orderB;
|
134
|
+
}
|
135
|
+
);
|
136
|
+
|
137
|
+
return Promise.all(
|
138
|
+
themeNames.map(async themeName => {
|
139
|
+
const types = await fs.readdir(
|
140
|
+
pathJoin(dirPath, themeName)
|
141
|
+
);
|
142
|
+
|
143
|
+
return {
|
144
|
+
name: themeName,
|
145
|
+
types
|
146
|
+
};
|
147
|
+
})
|
148
|
+
);
|
149
|
+
})()
|
150
|
+
},
|
151
|
+
null,
|
152
|
+
2
|
153
|
+
),
|
154
|
+
"utf8"
|
155
|
+
)
|
156
|
+
);
|
132
157
|
}
|
133
158
|
|
134
159
|
route_legacy_pages: {
|
@@ -31,11 +31,6 @@ import {
|
|
31
31
|
type BuildContextLike as BuildContextLike_generateMessageProperties
|
32
32
|
} from "./generateMessageProperties";
|
33
33
|
import { readThisNpmPackageVersion } from "../../tools/readThisNpmPackageVersion";
|
34
|
-
import {
|
35
|
-
writeMetaInfKeycloakThemes,
|
36
|
-
type MetaInfKeycloakTheme
|
37
|
-
} from "../../shared/metaInfKeycloakThemes";
|
38
|
-
import { objectEntries } from "tsafe/objectEntries";
|
39
34
|
import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
|
40
35
|
import { getThisCodebaseRootDirPath } from "../../tools/getThisCodebaseRootDirPath";
|
41
36
|
import propertiesParser from "properties-parser";
|
@@ -686,14 +681,19 @@ export async function generateResources(params: {
|
|
686
681
|
}
|
687
682
|
|
688
683
|
transformCodebase({
|
689
|
-
srcDirPath: pathJoin(resourcesDirPath, "theme", themeName),
|
690
|
-
destDirPath: pathJoin(
|
684
|
+
srcDirPath: pathJoin(resourcesDirPath, "theme", themeName, themeType),
|
685
|
+
destDirPath: pathJoin(
|
686
|
+
resourcesDirPath,
|
687
|
+
"theme",
|
688
|
+
themeVariantName,
|
689
|
+
themeType
|
690
|
+
),
|
691
691
|
transformSourceCode: isNative
|
692
692
|
? undefined
|
693
693
|
: ({ fileRelativePath, sourceCode }) => {
|
694
694
|
if (
|
695
695
|
pathExtname(fileRelativePath) === ".ftl" &&
|
696
|
-
fileRelativePath.split(pathSep).length ===
|
696
|
+
fileRelativePath.split(pathSep).length === 1
|
697
697
|
) {
|
698
698
|
const modifiedSourceCode = Buffer.from(
|
699
699
|
Buffer.from(sourceCode)
|
@@ -770,33 +770,4 @@ export async function generateResources(params: {
|
|
770
770
|
}
|
771
771
|
}
|
772
772
|
}
|
773
|
-
|
774
|
-
// Generate meta-inf/keycloak-themes.json
|
775
|
-
{
|
776
|
-
const metaInfKeycloakThemes: MetaInfKeycloakTheme = { themes: [] };
|
777
|
-
|
778
|
-
for (const themeName of buildContext.themeNames) {
|
779
|
-
metaInfKeycloakThemes.themes.push({
|
780
|
-
name: themeName,
|
781
|
-
types: objectEntries(buildContext.implementedThemeTypes)
|
782
|
-
.filter(([, v]) => v.isImplemented || v.isImplemented_native)
|
783
|
-
.map(([themeType]) => themeType)
|
784
|
-
});
|
785
|
-
}
|
786
|
-
|
787
|
-
if (
|
788
|
-
buildContext.implementedThemeTypes.account.isImplemented &&
|
789
|
-
buildContext.implementedThemeTypes.account.type === "Multi-Page"
|
790
|
-
) {
|
791
|
-
metaInfKeycloakThemes.themes.push({
|
792
|
-
name: "account-v1",
|
793
|
-
types: ["account"]
|
794
|
-
});
|
795
|
-
}
|
796
|
-
|
797
|
-
writeMetaInfKeycloakThemes({
|
798
|
-
resourcesDirPath,
|
799
|
-
getNewMetaInfKeycloakTheme: () => metaInfKeycloakThemes
|
800
|
-
});
|
801
|
-
}
|
802
773
|
}
|
@@ -1,28 +1,20 @@
|
|
1
1
|
import { assert } from "tsafe/assert";
|
2
2
|
import type { ParsedRealmJson } from "./ParsedRealmJson";
|
3
3
|
import { getDefaultConfig } from "./defaultConfig";
|
4
|
-
import type
|
5
|
-
import { objectKeys } from "tsafe/objectKeys";
|
6
|
-
import { TEST_APP_URL } from "../../shared/constants";
|
4
|
+
import { TEST_APP_URL, type ThemeType, THEME_TYPES } from "../../shared/constants";
|
7
5
|
import { sameFactory } from "evt/tools/inDepth/same";
|
8
6
|
|
9
|
-
export type BuildContextLike = {
|
10
|
-
themeNames: BuildContext["themeNames"];
|
11
|
-
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
12
|
-
};
|
13
|
-
|
14
|
-
assert<BuildContext extends BuildContextLike ? true : false>;
|
15
|
-
|
16
7
|
export function prepareRealmConfig(params: {
|
17
8
|
parsedRealmJson: ParsedRealmJson;
|
18
9
|
keycloakMajorVersionNumber: number;
|
19
|
-
|
10
|
+
parsedKeycloakThemesJsonEntry: { name: string; types: (ThemeType | "email")[] };
|
20
11
|
}): {
|
21
12
|
realmName: string;
|
22
13
|
clientName: string;
|
23
14
|
username: string;
|
24
15
|
} {
|
25
|
-
const { parsedRealmJson, keycloakMajorVersionNumber,
|
16
|
+
const { parsedRealmJson, keycloakMajorVersionNumber, parsedKeycloakThemesJsonEntry } =
|
17
|
+
params;
|
26
18
|
|
27
19
|
const { username } = addOrEditTestUser({
|
28
20
|
parsedRealmJson,
|
@@ -38,8 +30,7 @@ export function prepareRealmConfig(params: {
|
|
38
30
|
|
39
31
|
enableCustomThemes({
|
40
32
|
parsedRealmJson,
|
41
|
-
|
42
|
-
implementedThemeTypes: buildContext.implementedThemeTypes
|
33
|
+
parsedKeycloakThemesJsonEntry
|
43
34
|
});
|
44
35
|
|
45
36
|
enable_custom_events_listeners: {
|
@@ -63,17 +54,15 @@ export function prepareRealmConfig(params: {
|
|
63
54
|
|
64
55
|
function enableCustomThemes(params: {
|
65
56
|
parsedRealmJson: ParsedRealmJson;
|
66
|
-
|
67
|
-
implementedThemeTypes: BuildContextLike["implementedThemeTypes"];
|
57
|
+
parsedKeycloakThemesJsonEntry: { name: string; types: (ThemeType | "email")[] };
|
68
58
|
}) {
|
69
|
-
const { parsedRealmJson,
|
70
|
-
|
71
|
-
for (const themeType of objectKeys(implementedThemeTypes)) {
|
72
|
-
if (!implementedThemeTypes[themeType].isImplemented) {
|
73
|
-
continue;
|
74
|
-
}
|
59
|
+
const { parsedRealmJson, parsedKeycloakThemesJsonEntry } = params;
|
75
60
|
|
76
|
-
|
61
|
+
for (const themeType of [...THEME_TYPES, "email"] as const) {
|
62
|
+
parsedRealmJson[`${themeType}Theme` as const] =
|
63
|
+
!parsedKeycloakThemesJsonEntry.types.includes(themeType)
|
64
|
+
? ""
|
65
|
+
: parsedKeycloakThemesJsonEntry.name;
|
77
66
|
}
|
78
67
|
}
|
79
68
|
|
@@ -1,10 +1,7 @@
|
|
1
1
|
import type { BuildContext } from "../../shared/buildContext";
|
2
2
|
import { assert } from "tsafe/assert";
|
3
3
|
import { getDefaultConfig } from "./defaultConfig";
|
4
|
-
import {
|
5
|
-
prepareRealmConfig,
|
6
|
-
type BuildContextLike as BuildContextLike_prepareRealmConfig
|
7
|
-
} from "./prepareRealmConfig";
|
4
|
+
import { prepareRealmConfig } from "./prepareRealmConfig";
|
8
5
|
import * as fs from "fs";
|
9
6
|
import {
|
10
7
|
join as pathJoin,
|
@@ -24,18 +21,19 @@ import {
|
|
24
21
|
} from "./dumpContainerConfig";
|
25
22
|
import * as runExclusive from "run-exclusive";
|
26
23
|
import { waitForDebounceFactory } from "powerhooks/tools/waitForDebounce";
|
24
|
+
import type { ThemeType } from "../../shared/constants";
|
27
25
|
import chalk from "chalk";
|
28
26
|
|
29
|
-
export type BuildContextLike = BuildContextLike_dumpContainerConfig &
|
30
|
-
|
31
|
-
|
32
|
-
};
|
27
|
+
export type BuildContextLike = BuildContextLike_dumpContainerConfig & {
|
28
|
+
projectDirPath: string;
|
29
|
+
};
|
33
30
|
|
34
31
|
assert<BuildContext extends BuildContextLike ? true : false>;
|
35
32
|
|
36
33
|
export async function getRealmConfig(params: {
|
37
34
|
keycloakMajorVersionNumber: number;
|
38
35
|
realmJsonFilePath_userProvided: string | undefined;
|
36
|
+
parsedKeycloakThemesJsonEntry: { name: string; types: (ThemeType | "email")[] };
|
39
37
|
buildContext: BuildContextLike;
|
40
38
|
}): Promise<{
|
41
39
|
realmJsonFilePath: string;
|
@@ -44,8 +42,12 @@ export async function getRealmConfig(params: {
|
|
44
42
|
username: string;
|
45
43
|
onRealmConfigChange: () => Promise<void>;
|
46
44
|
}> {
|
47
|
-
const {
|
48
|
-
|
45
|
+
const {
|
46
|
+
keycloakMajorVersionNumber,
|
47
|
+
realmJsonFilePath_userProvided,
|
48
|
+
parsedKeycloakThemesJsonEntry,
|
49
|
+
buildContext
|
50
|
+
} = params;
|
49
51
|
|
50
52
|
const realmJsonFilePath = pathJoin(
|
51
53
|
buildContext.projectDirPath,
|
@@ -71,8 +73,8 @@ export async function getRealmConfig(params: {
|
|
71
73
|
|
72
74
|
const { clientName, realmName, username } = prepareRealmConfig({
|
73
75
|
parsedRealmJson,
|
74
|
-
|
75
|
-
|
76
|
+
keycloakMajorVersionNumber,
|
77
|
+
parsedKeycloakThemesJsonEntry
|
76
78
|
});
|
77
79
|
|
78
80
|
{
|