keycloakify 11.5.3 → 11.6.0
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/{682.index.js → 153.index.js} +300 -52
- package/bin/356.index.js +48 -25
- package/bin/{573.index.js → 880.index.js} +155 -9
- package/bin/main.js +6 -5
- package/bin/start-keycloak/realmConfig/{ParsedRealmJson.d.ts → ParsedRealmJson/ParsedRealmJson.d.ts} +2 -3
- package/bin/start-keycloak/realmConfig/ParsedRealmJson/index.d.ts +3 -0
- package/bin/start-keycloak/realmConfig/ParsedRealmJson/readRealmJsonFile.d.ts +4 -0
- package/bin/start-keycloak/realmConfig/ParsedRealmJson/writeRealmJsonFile.d.ts +6 -0
- package/bin/start-keycloak/realmConfig/defaultConfig/defaultConfig.d.ts +1 -4
- package/bin/tools/Stringifyable.d.ts +13 -0
- package/bin/tools/canonicalStringify.d.ts +5 -0
- package/bin/tools/createObjectThatThrowsIfAccessed.d.ts +21 -0
- package/package.json +18 -5
- package/src/bin/keycloakify/generateResources/generateResources.ts +162 -6
- package/src/bin/main.ts +4 -3
- package/src/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts +63 -24
- package/src/bin/start-keycloak/realmConfig/{ParsedRealmJson.ts → ParsedRealmJson/ParsedRealmJson.ts} +1 -19
- package/src/bin/start-keycloak/realmConfig/ParsedRealmJson/index.ts +3 -0
- package/src/bin/start-keycloak/realmConfig/ParsedRealmJson/readRealmJsonFile.ts +20 -0
- package/src/bin/start-keycloak/realmConfig/ParsedRealmJson/writeRealmJsonFile.ts +29 -0
- package/src/bin/start-keycloak/realmConfig/defaultConfig/defaultConfig.ts +3 -4
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-18.json +51 -33
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-19.json +48 -30
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-20.json +50 -32
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-21.json +29 -11
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-22.json +2201 -0
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-23.json +25 -7
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-24.json +26 -8
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-25.json +26 -8
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-26.json +11 -11
- package/src/bin/start-keycloak/realmConfig/prepareRealmConfig.ts +1 -1
- package/src/bin/start-keycloak/realmConfig/realmConfig.ts +15 -19
- package/src/bin/start-keycloak/start-keycloak.ts +131 -36
- package/src/bin/tools/Stringifyable.ts +99 -0
- package/src/bin/tools/canonicalStringify.ts +164 -0
- package/src/bin/tools/createObjectThatThrowsIfAccessed.ts +90 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
exports.id =
|
3
|
-
exports.ids = [
|
2
|
+
exports.id = 153;
|
3
|
+
exports.ids = [153];
|
4
4
|
exports.modules = {
|
5
5
|
|
6
|
-
/***/
|
6
|
+
/***/ 43153:
|
7
7
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8
8
|
|
9
9
|
// ESM COMPAT FLAG
|
@@ -271,9 +271,7 @@ function startViteDevServer(params) {
|
|
271
271
|
//# sourceMappingURL=startViteDevServer.js.map
|
272
272
|
// EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
|
273
273
|
var is = __webpack_require__(16453);
|
274
|
-
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/ParsedRealmJson.js
|
275
|
-
|
276
|
-
|
274
|
+
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/ParsedRealmJson/ParsedRealmJson.js
|
277
275
|
|
278
276
|
|
279
277
|
|
@@ -325,6 +323,12 @@ const zParsedRealmJson = (() => {
|
|
325
323
|
assert/* assert */.h;
|
326
324
|
return (0,id.id)(zTargetType);
|
327
325
|
})();
|
326
|
+
//# sourceMappingURL=ParsedRealmJson.js.map
|
327
|
+
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/ParsedRealmJson/readRealmJsonFile.js
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
328
332
|
function readRealmJsonFile(params) {
|
329
333
|
const { realmJsonFilePath } = params;
|
330
334
|
const parsedRealmJson = JSON.parse(external_fs_.readFileSync(realmJsonFilePath).toString("utf8"));
|
@@ -332,7 +336,7 @@ function readRealmJsonFile(params) {
|
|
332
336
|
(0,assert/* assert */.h)((0,is.is)(parsedRealmJson));
|
333
337
|
return parsedRealmJson;
|
334
338
|
}
|
335
|
-
//# sourceMappingURL=
|
339
|
+
//# sourceMappingURL=readRealmJsonFile.js.map
|
336
340
|
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/defaultConfig/defaultConfig.js
|
337
341
|
|
338
342
|
|
@@ -556,8 +560,6 @@ const { getCachedValue, setCachedValue } = (() => {
|
|
556
560
|
};
|
557
561
|
})();
|
558
562
|
//# sourceMappingURL=getSupportedDockerImageTags.js.map
|
559
|
-
// EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
|
560
|
-
var runPrettier = __webpack_require__(48433);
|
561
563
|
// EXTERNAL MODULE: ./node_modules/tsafe/esm/objectKeys.mjs
|
562
564
|
var objectKeys = __webpack_require__(23483);
|
563
565
|
// EXTERNAL MODULE: ./node_modules/evt/tools/inDepth/same.js
|
@@ -774,7 +776,7 @@ function editAccountConsoleAndSecurityAdminConsole(params) {
|
|
774
776
|
"claim.value": '["*"]',
|
775
777
|
"userinfo.token.claim": "true",
|
776
778
|
"id.token.claim": "false",
|
777
|
-
"lightweight.claim": "
|
779
|
+
"lightweight.claim": "true",
|
778
780
|
"access.token.claim": "true",
|
779
781
|
"claim.name": "allowed-origins",
|
780
782
|
"jsonType.label": "JSON",
|
@@ -802,6 +804,203 @@ function editAccountConsoleAndSecurityAdminConsole(params) {
|
|
802
804
|
}
|
803
805
|
}
|
804
806
|
//# sourceMappingURL=prepareRealmConfig.js.map
|
807
|
+
// EXTERNAL MODULE: ./dist/bin/tools/runPrettier.js
|
808
|
+
var runPrettier = __webpack_require__(48433);
|
809
|
+
;// CONCATENATED MODULE: ./dist/bin/tools/Stringifyable.js
|
810
|
+
|
811
|
+
|
812
|
+
|
813
|
+
|
814
|
+
const zStringifyableAtomic = (() => {
|
815
|
+
const zTargetType = lib.z.union([lib.z.string(), lib.z.number(), lib.z.boolean(), lib.z["null"]()]);
|
816
|
+
(0,assert/* assert */.h)();
|
817
|
+
return (0,id.id)(zTargetType);
|
818
|
+
})();
|
819
|
+
const zStringifyable = lib.z.any()
|
820
|
+
.superRefine((val, ctx) => {
|
821
|
+
const isStringifyable = (0,same.same)(JSON.parse(JSON.stringify(val)), val);
|
822
|
+
if (!isStringifyable) {
|
823
|
+
ctx.addIssue({
|
824
|
+
code: lib.z.ZodIssueCode.custom,
|
825
|
+
message: "Not stringifyable"
|
826
|
+
});
|
827
|
+
}
|
828
|
+
});
|
829
|
+
function getIsAtomic(stringifyable) {
|
830
|
+
return (["string", "number", "boolean"].includes(typeof stringifyable) ||
|
831
|
+
stringifyable === null);
|
832
|
+
}
|
833
|
+
const { getValueAtPath } = (() => {
|
834
|
+
function getValueAtPath_rec(stringifyable, path) {
|
835
|
+
if (path.length === 0) {
|
836
|
+
return stringifyable;
|
837
|
+
}
|
838
|
+
if (getIsAtomic(stringifyable)) {
|
839
|
+
return undefined;
|
840
|
+
}
|
841
|
+
const [first, ...rest] = path;
|
842
|
+
let dereferenced;
|
843
|
+
if (stringifyable instanceof Array) {
|
844
|
+
if (typeof first !== "number") {
|
845
|
+
return undefined;
|
846
|
+
}
|
847
|
+
dereferenced = stringifyable[first];
|
848
|
+
}
|
849
|
+
else {
|
850
|
+
if (typeof first !== "string") {
|
851
|
+
return undefined;
|
852
|
+
}
|
853
|
+
dereferenced = stringifyable[first];
|
854
|
+
}
|
855
|
+
if (dereferenced === undefined) {
|
856
|
+
return undefined;
|
857
|
+
}
|
858
|
+
return getValueAtPath_rec(dereferenced, rest);
|
859
|
+
}
|
860
|
+
function getValueAtPath(stringifyableObjectOrArray, path) {
|
861
|
+
return getValueAtPath_rec(stringifyableObjectOrArray, path);
|
862
|
+
}
|
863
|
+
return { getValueAtPath };
|
864
|
+
})();
|
865
|
+
//# sourceMappingURL=Stringifyable.js.map
|
866
|
+
;// CONCATENATED MODULE: ./dist/bin/tools/canonicalStringify.js
|
867
|
+
|
868
|
+
function canonicalStringify(params) {
|
869
|
+
const { data, referenceData } = params;
|
870
|
+
return JSON.stringify(makeDeterministicCopy({
|
871
|
+
path: [],
|
872
|
+
data,
|
873
|
+
getCanonicalKeys: path => {
|
874
|
+
const referenceValue = (() => {
|
875
|
+
const path_patched = [];
|
876
|
+
for (let i = 0; i < path.length; i++) {
|
877
|
+
let value_i = getValueAtPath(referenceData, [
|
878
|
+
...path_patched,
|
879
|
+
path[i]
|
880
|
+
]);
|
881
|
+
if (value_i !== undefined) {
|
882
|
+
path_patched.push(path[i]);
|
883
|
+
continue;
|
884
|
+
}
|
885
|
+
if (typeof path[i] !== "number") {
|
886
|
+
return undefined;
|
887
|
+
}
|
888
|
+
value_i = getValueAtPath(referenceData, [...path_patched, 0]);
|
889
|
+
if (value_i !== undefined) {
|
890
|
+
path_patched.push(0);
|
891
|
+
continue;
|
892
|
+
}
|
893
|
+
return undefined;
|
894
|
+
}
|
895
|
+
return getValueAtPath(referenceData, path_patched);
|
896
|
+
})();
|
897
|
+
if (referenceValue === undefined) {
|
898
|
+
return undefined;
|
899
|
+
}
|
900
|
+
if (getIsAtomic(referenceValue)) {
|
901
|
+
return undefined;
|
902
|
+
}
|
903
|
+
if (referenceValue instanceof Array) {
|
904
|
+
return undefined;
|
905
|
+
}
|
906
|
+
return Object.keys(referenceValue);
|
907
|
+
}
|
908
|
+
}), null, 2);
|
909
|
+
}
|
910
|
+
function makeDeterministicCopy(params) {
|
911
|
+
const { path, data, getCanonicalKeys } = params;
|
912
|
+
if (getIsAtomic(data)) {
|
913
|
+
return data;
|
914
|
+
}
|
915
|
+
if (data instanceof Array) {
|
916
|
+
return makeDeterministicCopy_array({
|
917
|
+
path,
|
918
|
+
data,
|
919
|
+
getCanonicalKeys
|
920
|
+
});
|
921
|
+
}
|
922
|
+
return makeDeterministicCopy_record({
|
923
|
+
path,
|
924
|
+
data,
|
925
|
+
getCanonicalKeys
|
926
|
+
});
|
927
|
+
}
|
928
|
+
function makeDeterministicCopy_record(params) {
|
929
|
+
const { path, data, getCanonicalKeys } = params;
|
930
|
+
const keysOfAtomicValues = [];
|
931
|
+
const keysOfNonAtomicValues = [];
|
932
|
+
for (const [key, value] of Object.entries(data)) {
|
933
|
+
if (getIsAtomic(value)) {
|
934
|
+
keysOfAtomicValues.push(key);
|
935
|
+
}
|
936
|
+
else {
|
937
|
+
keysOfNonAtomicValues.push(key);
|
938
|
+
}
|
939
|
+
}
|
940
|
+
keysOfAtomicValues.sort();
|
941
|
+
keysOfNonAtomicValues.sort();
|
942
|
+
const keys = [...keysOfAtomicValues, ...keysOfNonAtomicValues];
|
943
|
+
reorder_according_to_canonical: {
|
944
|
+
const canonicalKeys = getCanonicalKeys(path);
|
945
|
+
if (canonicalKeys === undefined) {
|
946
|
+
break reorder_according_to_canonical;
|
947
|
+
}
|
948
|
+
const keys_toPrepend = [];
|
949
|
+
for (const key of canonicalKeys) {
|
950
|
+
const indexOfKey = keys.indexOf(key);
|
951
|
+
if (indexOfKey === -1) {
|
952
|
+
continue;
|
953
|
+
}
|
954
|
+
keys.splice(indexOfKey, 1);
|
955
|
+
keys_toPrepend.push(key);
|
956
|
+
}
|
957
|
+
keys.unshift(...keys_toPrepend);
|
958
|
+
}
|
959
|
+
const result = {};
|
960
|
+
for (const key of keys) {
|
961
|
+
result[key] = makeDeterministicCopy({
|
962
|
+
path: [...path, key],
|
963
|
+
data: data[key],
|
964
|
+
getCanonicalKeys
|
965
|
+
});
|
966
|
+
}
|
967
|
+
return result;
|
968
|
+
}
|
969
|
+
function makeDeterministicCopy_array(params) {
|
970
|
+
const { path, data, getCanonicalKeys } = params;
|
971
|
+
return [...data].map((entry, i) => makeDeterministicCopy({
|
972
|
+
path: [...path, i],
|
973
|
+
data: entry,
|
974
|
+
getCanonicalKeys
|
975
|
+
}));
|
976
|
+
}
|
977
|
+
//# sourceMappingURL=canonicalStringify.js.map
|
978
|
+
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/ParsedRealmJson/writeRealmJsonFile.js
|
979
|
+
|
980
|
+
|
981
|
+
|
982
|
+
|
983
|
+
async function writeRealmJsonFile(params) {
|
984
|
+
const { realmJsonFilePath, parsedRealmJson, keycloakMajorVersionNumber } = params;
|
985
|
+
let sourceCode = canonicalStringify({
|
986
|
+
data: parsedRealmJson,
|
987
|
+
referenceData: getDefaultConfig({
|
988
|
+
keycloakMajorVersionNumber
|
989
|
+
})
|
990
|
+
});
|
991
|
+
if (await (0,runPrettier/* getIsPrettierAvailable */.MT)()) {
|
992
|
+
sourceCode = await (0,runPrettier/* runPrettier */.eY)({
|
993
|
+
sourceCode: sourceCode,
|
994
|
+
filePath: realmJsonFilePath
|
995
|
+
});
|
996
|
+
}
|
997
|
+
await promises_.writeFile(realmJsonFilePath, Buffer.from(sourceCode, "utf8"));
|
998
|
+
}
|
999
|
+
//# sourceMappingURL=writeRealmJsonFile.js.map
|
1000
|
+
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/ParsedRealmJson/index.js
|
1001
|
+
|
1002
|
+
|
1003
|
+
//# sourceMappingURL=index.js.map
|
805
1004
|
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/realmConfig/dumpContainerConfig.js
|
806
1005
|
|
807
1006
|
|
@@ -947,7 +1146,6 @@ async function dumpContainerConfig(params) {
|
|
947
1146
|
|
948
1147
|
|
949
1148
|
|
950
|
-
|
951
1149
|
assert/* assert */.h;
|
952
1150
|
async function getRealmConfig(params) {
|
953
1151
|
const { keycloakMajorVersionNumber, realmJsonFilePath_userProvided, buildContext } = params;
|
@@ -976,18 +1174,11 @@ async function getRealmConfig(params) {
|
|
976
1174
|
external_fs_.mkdirSync(dirPath, { recursive: true });
|
977
1175
|
}
|
978
1176
|
}
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
sourceCode,
|
985
|
-
filePath: realmJsonFilePath
|
986
|
-
});
|
987
|
-
}
|
988
|
-
external_fs_.writeFileSync(realmJsonFilePath, sourceCode);
|
989
|
-
};
|
990
|
-
await writeRealmJsonFile({ parsedRealmJson });
|
1177
|
+
await writeRealmJsonFile({
|
1178
|
+
realmJsonFilePath,
|
1179
|
+
parsedRealmJson,
|
1180
|
+
keycloakMajorVersionNumber
|
1181
|
+
});
|
991
1182
|
const { onRealmConfigChange } = (() => {
|
992
1183
|
const run = runExclusive.build(async () => {
|
993
1184
|
const start = Date.now();
|
@@ -1004,7 +1195,11 @@ async function getRealmConfig(params) {
|
|
1004
1195
|
console.log(source_default().red(`Failed to backup '${realmName}' config:`));
|
1005
1196
|
return;
|
1006
1197
|
}
|
1007
|
-
await writeRealmJsonFile({
|
1198
|
+
await writeRealmJsonFile({
|
1199
|
+
realmJsonFilePath,
|
1200
|
+
parsedRealmJson,
|
1201
|
+
keycloakMajorVersionNumber
|
1202
|
+
});
|
1008
1203
|
console.log([
|
1009
1204
|
source_default().grey(`Save changed to \`.${external_path_.sep}${(0,external_path_.relative)(buildContext.projectDirPath, realmJsonFilePath)}\``),
|
1010
1205
|
source_default().grey(`Next time you'll be running \`keycloakify start-keycloak\`, the realm '${realmName}' will be restored to this state.`),
|
@@ -1122,13 +1317,57 @@ async function command(params) {
|
|
1122
1317
|
source_default().cyan("On which version of Keycloak do you want to test your theme?"),
|
1123
1318
|
source_default().gray("You can also explicitly provide the version with `npx keycloakify start-keycloak --keycloak-version 26` (or any other version)")
|
1124
1319
|
].join("\n"));
|
1125
|
-
const
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1320
|
+
const tag_userSelected = await (async () => {
|
1321
|
+
let tag;
|
1322
|
+
let latestMajorTags_copy = [...latestMajorTags];
|
1323
|
+
while (true) {
|
1324
|
+
const { value } = await dist_default()({
|
1325
|
+
values: latestMajorTags_copy
|
1326
|
+
}).catch(() => {
|
1327
|
+
process.exit(-1);
|
1328
|
+
});
|
1329
|
+
tag = value;
|
1330
|
+
{
|
1331
|
+
const doImplementAccountMpa = buildContext.implementedThemeTypes.account.isImplemented &&
|
1332
|
+
buildContext.implementedThemeTypes.account.type === "Multi-Page";
|
1333
|
+
if (doImplementAccountMpa && tag.startsWith("22.")) {
|
1334
|
+
console.log(source_default().yellow(`You are implementing a Multi-Page Account theme. Keycloak 22 is not supported, select another version`));
|
1335
|
+
latestMajorTags_copy = latestMajorTags_copy.filter(tag => !tag.startsWith("22."));
|
1336
|
+
continue;
|
1337
|
+
}
|
1338
|
+
}
|
1339
|
+
const readMajor = (tag) => {
|
1340
|
+
const major = parseInt(tag.split(".")[0]);
|
1341
|
+
(0,assert/* assert */.h)(!isNaN(major));
|
1342
|
+
return major;
|
1343
|
+
};
|
1344
|
+
{
|
1345
|
+
const major = readMajor(tag);
|
1346
|
+
const doImplementAdminTheme = buildContext.implementedThemeTypes.admin.isImplemented;
|
1347
|
+
const getIsSupported = (major) => major >= 23;
|
1348
|
+
if (doImplementAdminTheme && !getIsSupported(major)) {
|
1349
|
+
console.log(source_default().yellow(`You are implementing an Admin theme. Only Keycloak 23 and later are supported, select another version`));
|
1350
|
+
latestMajorTags_copy = latestMajorTags_copy.filter(tag => getIsSupported(readMajor(tag)));
|
1351
|
+
continue;
|
1352
|
+
}
|
1353
|
+
}
|
1354
|
+
{
|
1355
|
+
const doImplementAccountSpa = buildContext.implementedThemeTypes.account.isImplemented &&
|
1356
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page";
|
1357
|
+
const major = readMajor(tag);
|
1358
|
+
const getIsSupported = (major) => major >= 19;
|
1359
|
+
if (doImplementAccountSpa && !getIsSupported(major)) {
|
1360
|
+
console.log(source_default().yellow(`You are implementing a Single-Page Account theme. Only Keycloak 19 and later are supported, select another version`));
|
1361
|
+
latestMajorTags_copy = latestMajorTags_copy.filter(tag => getIsSupported(readMajor(tag)));
|
1362
|
+
continue;
|
1363
|
+
}
|
1364
|
+
}
|
1365
|
+
break;
|
1366
|
+
}
|
1367
|
+
return tag;
|
1368
|
+
})();
|
1369
|
+
console.log(`→ ${tag_userSelected}`);
|
1370
|
+
return { dockerImageTag: tag_userSelected };
|
1132
1371
|
})();
|
1133
1372
|
const keycloakMajorVersionNumber = (() => {
|
1134
1373
|
const [wrap] = getSupportedKeycloakMajorVersions()
|
@@ -1439,31 +1678,40 @@ async function command(params) {
|
|
1439
1678
|
ignoreInitial: true
|
1440
1679
|
})
|
1441
1680
|
.on("all", async (...[, filePath]) => {
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
if (!doImplementAccountSpa) {
|
1446
|
-
break ignore_account_spa;
|
1681
|
+
ignore_path_covered_by_hmr: {
|
1682
|
+
if (filePath.endsWith(".properties")) {
|
1683
|
+
break ignore_path_covered_by_hmr;
|
1447
1684
|
}
|
1448
|
-
if (!
|
1449
|
-
|
1450
|
-
filePath
|
1451
|
-
})) {
|
1452
|
-
break ignore_account_spa;
|
1685
|
+
if (!doStartDevServer) {
|
1686
|
+
break ignore_path_covered_by_hmr;
|
1453
1687
|
}
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1688
|
+
ignore_account_spa: {
|
1689
|
+
const doImplementAccountSpa = buildContext.implementedThemeTypes.account.isImplemented &&
|
1690
|
+
buildContext.implementedThemeTypes.account.type ===
|
1691
|
+
"Single-Page";
|
1692
|
+
if (!doImplementAccountSpa) {
|
1693
|
+
break ignore_account_spa;
|
1694
|
+
}
|
1695
|
+
if (!(0,isInside/* isInside */.V)({
|
1696
|
+
dirPath: (0,external_path_.join)(buildContext.themeSrcDirPath, "account"),
|
1697
|
+
filePath
|
1698
|
+
})) {
|
1699
|
+
break ignore_account_spa;
|
1700
|
+
}
|
1701
|
+
return;
|
1459
1702
|
}
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1703
|
+
ignore_admin: {
|
1704
|
+
if (!buildContext.implementedThemeTypes.admin.isImplemented) {
|
1705
|
+
break ignore_admin;
|
1706
|
+
}
|
1707
|
+
if (!(0,isInside/* isInside */.V)({
|
1708
|
+
dirPath: (0,external_path_.join)(buildContext.themeSrcDirPath, "admin"),
|
1709
|
+
filePath
|
1710
|
+
})) {
|
1711
|
+
break ignore_admin;
|
1712
|
+
}
|
1713
|
+
return;
|
1465
1714
|
}
|
1466
|
-
return;
|
1467
1715
|
}
|
1468
1716
|
console.log(`Detected changes in ${filePath}`);
|
1469
1717
|
await waitForDebounce();
|
package/bin/356.index.js
CHANGED
@@ -25,31 +25,20 @@ exports.modules = {
|
|
25
25
|
async function getUiModuleFileSourceCodeReadyToBeCopied(params) {
|
26
26
|
const { buildContext, uiModuleDirPath, fileRelativePath, isForEjection, uiModuleName, uiModuleVersion } = params;
|
27
27
|
let sourceCode = (await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(uiModuleDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC, fileRelativePath))).toString("utf8");
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
: [
|
43
|
-
`WARNING: Before modifying this file run the following command:`,
|
44
|
-
``,
|
45
|
-
`$ npx keycloakify eject-file --file ${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/")}`,
|
46
|
-
``,
|
47
|
-
`This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
|
48
|
-
`This file has been copied over to your repo by your postinstall script: \`npx keycloakify postinstall\``
|
49
|
-
]);
|
50
|
-
if (comment !== undefined) {
|
51
|
-
sourceCode = [comment, ``, sourceCode].join("\n");
|
52
|
-
}
|
28
|
+
sourceCode = addCommentToSourceCode({
|
29
|
+
sourceCode,
|
30
|
+
fileRelativePath,
|
31
|
+
commentLines: isForEjection
|
32
|
+
? [`This file was ejected from ${uiModuleName} version ${uiModuleVersion}.`]
|
33
|
+
: [
|
34
|
+
`WARNING: Before modifying this file run the following command:`,
|
35
|
+
``,
|
36
|
+
`$ npx keycloakify eject-file --file '${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/")}'`,
|
37
|
+
``,
|
38
|
+
`This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
|
39
|
+
`This file has been copied over to your repo by your postinstall script: \`npx keycloakify postinstall\``
|
40
|
+
]
|
41
|
+
});
|
53
42
|
const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath);
|
54
43
|
format: {
|
55
44
|
if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .getIsPrettierAvailable */ .MT)())) {
|
@@ -62,6 +51,40 @@ async function getUiModuleFileSourceCodeReadyToBeCopied(params) {
|
|
62
51
|
}
|
63
52
|
return Buffer.from(sourceCode, "utf8");
|
64
53
|
}
|
54
|
+
function addCommentToSourceCode(params) {
|
55
|
+
const { sourceCode, fileRelativePath, commentLines } = params;
|
56
|
+
const toResult = (comment) => {
|
57
|
+
return [comment, ``, sourceCode].join("\n");
|
58
|
+
};
|
59
|
+
for (const ext of [".ts", ".tsx", ".css", ".less", ".sass", ".js", ".jsx"]) {
|
60
|
+
if (!fileRelativePath.endsWith(ext)) {
|
61
|
+
continue;
|
62
|
+
}
|
63
|
+
return toResult([`/**`, ...commentLines.map(line => ` * ${line}`), ` */`].join("\n"));
|
64
|
+
}
|
65
|
+
if (fileRelativePath.endsWith(".properties")) {
|
66
|
+
return toResult(commentLines.map(line => `# ${line}`).join("\n"));
|
67
|
+
}
|
68
|
+
if (fileRelativePath.endsWith(".html") || fileRelativePath.endsWith(".svg")) {
|
69
|
+
const comment = [
|
70
|
+
`<!--`,
|
71
|
+
...commentLines.map(line => ` ${line.replace("--file", "-f").replace("Before modifying", "Before modifying or replacing")}`),
|
72
|
+
`-->`
|
73
|
+
].join("\n");
|
74
|
+
if (fileRelativePath.endsWith(".html") && sourceCode.trim().startsWith("<!")) {
|
75
|
+
const [first, ...rest] = sourceCode.split(">");
|
76
|
+
const last = rest.join(">");
|
77
|
+
return [`${first}>`, comment, last].join("\n");
|
78
|
+
}
|
79
|
+
if (fileRelativePath.endsWith(".svg") && sourceCode.trim().startsWith("<?")) {
|
80
|
+
const [first, ...rest] = sourceCode.split("?>");
|
81
|
+
const last = rest.join("?>");
|
82
|
+
return [`${first}?>`, comment, last].join("\n");
|
83
|
+
}
|
84
|
+
return toResult(comment);
|
85
|
+
}
|
86
|
+
return sourceCode;
|
87
|
+
}
|
65
88
|
//# sourceMappingURL=getUiModuleFileSourceCodeReadyToBeCopied.js.map
|
66
89
|
|
67
90
|
/***/ }),
|