keycloakify 11.8.37 → 11.8.38
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/375.index.js +4 -2
- package/bin/712.index.js +26 -3
- package/bin/786.index.js +4 -2
- package/bin/84.index.js +4 -2
- package/bin/930.index.js +45 -29
- package/bin/949.index.js +4 -2
- package/bin/97.index.js +206 -134
- package/bin/keycloakify/generateResources/generateResources.d.ts +1 -0
- package/bin/main.js +16 -2
- package/bin/own.d.ts +1 -0
- package/bin/sync-extensions/extensionModuleMeta.d.ts +1 -0
- package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +2 -0
- package/bin/sync-extensions/managedGitignoreFiles.d.ts +29 -0
- package/bin/tools/runPrettier.d.ts +5 -0
- package/package.json +3 -3
- package/src/bin/keycloakify/generateResources/generateResources.ts +43 -3
- package/src/bin/main.ts +19 -2
- package/src/bin/own.ts +60 -27
- package/src/bin/sync-extensions/extensionModuleMeta.ts +52 -39
- package/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts +95 -39
- package/src/bin/sync-extensions/managedGitignoreFiles.ts +189 -0
- package/src/bin/sync-extensions/sync-extension.ts +21 -8
- package/src/bin/tools/runPrettier.ts +20 -7
- package/src/vite-plugin/vite-plugin.ts +8 -1
- package/vite-plugin/index.js +9 -2
- package/bin/sync-extensions/managedGitignoreFile.d.ts +0 -14
- package/src/bin/sync-extensions/managedGitignoreFile.ts +0 -136
package/bin/97.index.js
CHANGED
@@ -185,6 +185,7 @@ const zExtensionModuleMeta = (() => {
|
|
185
185
|
moduleName: lib.z.string(),
|
186
186
|
version: lib.z.string(),
|
187
187
|
files: lib.z.array(lib.z.object({
|
188
|
+
isPublic: lib.z.boolean(),
|
188
189
|
fileRelativePath: lib.z.string(),
|
189
190
|
hash: lib.z.string(),
|
190
191
|
copyableFilePath: lib.z.string()
|
@@ -289,37 +290,40 @@ async function getExtensionModuleMetas(params) {
|
|
289
290
|
return extensionModuleMeta_cache;
|
290
291
|
}
|
291
292
|
const files = [];
|
292
|
-
{
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
293
|
+
await crawlAsync({
|
294
|
+
dirPath: (0,external_path_.join)(dirPath, constants/* KEYCLOAK_THEME */.PC),
|
295
|
+
returnedPathsType: "relative to dirPath",
|
296
|
+
onFileFound: async (fileRelativePath_fromReservedDir) => {
|
297
|
+
const isPublic = fileRelativePath_fromReservedDir.startsWith(`public${external_path_.sep}`);
|
298
|
+
const fileRelativePath = isPublic
|
299
|
+
? (0,external_path_.relative)("public", fileRelativePath_fromReservedDir)
|
300
|
+
: fileRelativePath_fromReservedDir;
|
301
|
+
const sourceCode = await (0,getExtensionModuleFileSourceCodeReadyToBeCopied/* getExtensionModuleFileSourceCodeReadyToBeCopied */.p)({
|
302
|
+
buildContext,
|
303
|
+
isPublic,
|
304
|
+
fileRelativePath,
|
305
|
+
isOwnershipAction: false,
|
306
|
+
extensionModuleDirPath: dirPath,
|
307
|
+
extensionModuleName: moduleName,
|
308
|
+
extensionModuleVersion: version
|
309
|
+
});
|
310
|
+
const hash = computeHash(sourceCode);
|
311
|
+
const copyableFilePath = (0,external_path_.join)((0,external_path_.dirname)(cacheFilePath), constants/* KEYCLOAK_THEME */.PC, fileRelativePath_fromReservedDir);
|
312
|
+
{
|
313
|
+
const dirPath = (0,external_path_.dirname)(copyableFilePath);
|
314
|
+
if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirPath))) {
|
315
|
+
await promises_.mkdir(dirPath, { recursive: true });
|
313
316
|
}
|
314
|
-
promises_.writeFile(copyableFilePath, sourceCode);
|
315
|
-
files.push({
|
316
|
-
fileRelativePath,
|
317
|
-
hash,
|
318
|
-
copyableFilePath
|
319
|
-
});
|
320
317
|
}
|
321
|
-
|
322
|
-
|
318
|
+
promises_.writeFile(copyableFilePath, sourceCode);
|
319
|
+
files.push({
|
320
|
+
isPublic,
|
321
|
+
fileRelativePath,
|
322
|
+
hash,
|
323
|
+
copyableFilePath
|
324
|
+
});
|
325
|
+
}
|
326
|
+
});
|
323
327
|
return (0,id.id)({
|
324
328
|
moduleName,
|
325
329
|
version,
|
@@ -376,8 +380,31 @@ function computeHash(data) {
|
|
376
380
|
|
377
381
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)();
|
378
382
|
async function getExtensionModuleFileSourceCodeReadyToBeCopied(params) {
|
379
|
-
const { buildContext, extensionModuleDirPath, fileRelativePath, isOwnershipAction, extensionModuleName, extensionModuleVersion } = params;
|
380
|
-
|
383
|
+
const { buildContext, extensionModuleDirPath, isPublic, fileRelativePath, isOwnershipAction, extensionModuleName, extensionModuleVersion } = params;
|
384
|
+
const { refSourceCode } = await (async () => {
|
385
|
+
let sourceCode = undefined;
|
386
|
+
const sourceCode_originalBuffer = await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(extensionModuleDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC, isPublic ? "public" : ".", fileRelativePath));
|
387
|
+
let hasBeenUpdated = false;
|
388
|
+
const refSourceCode = {
|
389
|
+
get current() {
|
390
|
+
if (sourceCode === undefined) {
|
391
|
+
sourceCode = sourceCode_originalBuffer.toString("utf8");
|
392
|
+
}
|
393
|
+
return sourceCode;
|
394
|
+
},
|
395
|
+
set current(value) {
|
396
|
+
hasBeenUpdated = true;
|
397
|
+
sourceCode = value;
|
398
|
+
},
|
399
|
+
getAsBuffer: () => {
|
400
|
+
if (!hasBeenUpdated) {
|
401
|
+
return sourceCode_originalBuffer;
|
402
|
+
}
|
403
|
+
return Buffer.from(refSourceCode.current, "utf8");
|
404
|
+
}
|
405
|
+
};
|
406
|
+
return { refSourceCode };
|
407
|
+
})();
|
381
408
|
add_eslint_disable: {
|
382
409
|
if (isOwnershipAction) {
|
383
410
|
break add_eslint_disable;
|
@@ -385,13 +412,13 @@ async function getExtensionModuleFileSourceCodeReadyToBeCopied(params) {
|
|
385
412
|
if (!fileRelativePath.endsWith(".ts") && !fileRelativePath.endsWith(".tsx")) {
|
386
413
|
break add_eslint_disable;
|
387
414
|
}
|
388
|
-
if (
|
415
|
+
if (refSourceCode.current.includes("/* eslint-disable */")) {
|
389
416
|
break add_eslint_disable;
|
390
417
|
}
|
391
|
-
|
418
|
+
refSourceCode.current = ["/* eslint-disable */", "", refSourceCode.current].join("\n");
|
392
419
|
}
|
393
|
-
|
394
|
-
|
420
|
+
addCommentToSourceCode({
|
421
|
+
refSourceCode,
|
395
422
|
fileRelativePath,
|
396
423
|
commentLines: (() => {
|
397
424
|
const path = fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/");
|
@@ -400,52 +427,62 @@ async function getExtensionModuleFileSourceCodeReadyToBeCopied(params) {
|
|
400
427
|
`This file has been claimed for ownership from ${extensionModuleName} version ${extensionModuleVersion}.`,
|
401
428
|
`To relinquish ownership and restore this file to its original content, run the following command:`,
|
402
429
|
``,
|
403
|
-
`$ npx keycloakify own --path "${path}" --revert`
|
430
|
+
`$ npx keycloakify own --path "${path}" ${isPublic ? "--public " : ""}--revert`
|
404
431
|
]
|
405
432
|
: [
|
406
433
|
`WARNING: Before modifying this file, run the following command:`,
|
407
434
|
``,
|
408
|
-
`$ npx keycloakify own --path "${path}"`,
|
435
|
+
`$ npx keycloakify own --path "${path}"${isPublic ? " --public" : ""}`,
|
409
436
|
``,
|
410
437
|
`This file is provided by ${extensionModuleName} version ${extensionModuleVersion}.`,
|
411
438
|
`It was copied into your repository by the postinstall script: \`keycloakify sync-extensions\`.`
|
412
439
|
];
|
413
440
|
})()
|
414
441
|
});
|
415
|
-
const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath);
|
416
442
|
format: {
|
417
443
|
if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .getIsPrettierAvailable */ .MT)())) {
|
418
444
|
break format;
|
419
445
|
}
|
420
|
-
|
421
|
-
|
422
|
-
|
446
|
+
const sourceCode_buffer_before = refSourceCode.getAsBuffer();
|
447
|
+
const sourceCode_buffer_after = await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .runPrettier */ .eY)({
|
448
|
+
filePath: (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(isPublic
|
449
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC)
|
450
|
+
: buildContext.themeSrcDirPath, fileRelativePath),
|
451
|
+
sourceCode: sourceCode_buffer_before
|
423
452
|
});
|
453
|
+
if (sourceCode_buffer_before.compare(sourceCode_buffer_after) === 0) {
|
454
|
+
break format;
|
455
|
+
}
|
456
|
+
refSourceCode.current = sourceCode_buffer_after.toString("utf8");
|
424
457
|
}
|
425
|
-
return
|
458
|
+
return refSourceCode.getAsBuffer();
|
426
459
|
}
|
427
460
|
function addCommentToSourceCode(params) {
|
428
|
-
const {
|
429
|
-
const
|
430
|
-
|
461
|
+
const { refSourceCode, fileRelativePath, commentLines } = params;
|
462
|
+
const updateRef = (comment) => {
|
463
|
+
refSourceCode.current = [comment, ``, refSourceCode.current].join("\n");
|
431
464
|
};
|
432
465
|
for (const ext of [".ts", ".tsx", ".css", ".less", ".sass", ".js", ".jsx"]) {
|
433
466
|
if (!fileRelativePath.endsWith(ext)) {
|
434
467
|
continue;
|
435
468
|
}
|
436
|
-
|
469
|
+
updateRef([`/**`, ...commentLines.map(line => ` * ${line}`), ` */`].join("\n"));
|
470
|
+
return;
|
437
471
|
}
|
438
472
|
if (fileRelativePath.endsWith(".properties")) {
|
439
|
-
|
473
|
+
updateRef(commentLines.map(line => `# ${line}`).join("\n"));
|
474
|
+
return;
|
440
475
|
}
|
441
476
|
if (fileRelativePath.endsWith(".ftl")) {
|
442
477
|
const comment = [`<#--`, ...commentLines.map(line => ` ${line}`), `-->`].join("\n");
|
443
|
-
if (
|
444
|
-
const [first, ...rest] =
|
478
|
+
if (refSourceCode.current.trim().startsWith("<#ftl")) {
|
479
|
+
const [first, ...rest] = refSourceCode.current.split(">");
|
445
480
|
const last = rest.join(">");
|
446
|
-
|
481
|
+
refSourceCode.current = [`${first}>`, comment, last].join("\n");
|
482
|
+
return;
|
447
483
|
}
|
448
|
-
|
484
|
+
updateRef(comment);
|
485
|
+
return;
|
449
486
|
}
|
450
487
|
if (fileRelativePath.endsWith(".html") || fileRelativePath.endsWith(".svg")) {
|
451
488
|
const comment = [
|
@@ -456,30 +493,34 @@ function addCommentToSourceCode(params) {
|
|
456
493
|
.replace("Before modifying", "Before modifying or replacing")}`),
|
457
494
|
`-->`
|
458
495
|
].join("\n");
|
459
|
-
if (fileRelativePath.endsWith(".html") &&
|
460
|
-
|
496
|
+
if (fileRelativePath.endsWith(".html") &&
|
497
|
+
refSourceCode.current.trim().startsWith("<!")) {
|
498
|
+
const [first, ...rest] = refSourceCode.current.split(">");
|
461
499
|
const last = rest.join(">");
|
462
|
-
|
500
|
+
refSourceCode.current = [`${first}>`, comment, last].join("\n");
|
501
|
+
return;
|
463
502
|
}
|
464
|
-
if (fileRelativePath.endsWith(".svg") &&
|
465
|
-
|
503
|
+
if (fileRelativePath.endsWith(".svg") &&
|
504
|
+
refSourceCode.current.trim().startsWith("<?")) {
|
505
|
+
const [first, ...rest] = refSourceCode.current.split("?>");
|
466
506
|
const last = rest.join("?>");
|
467
|
-
|
507
|
+
refSourceCode.current = [`${first}?>`, comment, last].join("\n");
|
508
|
+
return;
|
468
509
|
}
|
469
|
-
|
510
|
+
updateRef(comment);
|
511
|
+
return;
|
470
512
|
}
|
471
|
-
return sourceCode;
|
472
513
|
}
|
473
514
|
//# sourceMappingURL=getExtensionModuleFileSourceCodeReadyToBeCopied.js.map
|
474
515
|
|
475
516
|
/***/ }),
|
476
517
|
|
477
|
-
/***/
|
518
|
+
/***/ 86087:
|
478
519
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
479
520
|
|
480
521
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
481
|
-
/* harmony export */ "
|
482
|
-
/* harmony export */ "
|
522
|
+
/* harmony export */ "F": () => (/* binding */ writeManagedGitignoreFiles),
|
523
|
+
/* harmony export */ "P": () => (/* binding */ readManagedGitignoresFile)
|
483
524
|
/* harmony export */ });
|
484
525
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
|
485
526
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
|
@@ -488,89 +529,114 @@ function addCommentToSourceCode(params) {
|
|
488
529
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29041);
|
489
530
|
/* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43765);
|
490
531
|
/* harmony import */ var _tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84794);
|
532
|
+
/* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(173);
|
491
533
|
|
492
534
|
|
493
535
|
|
494
536
|
|
495
537
|
|
538
|
+
|
539
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
|
496
540
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
|
497
541
|
const DELIMITER_START = `# === Owned files start ===`;
|
498
542
|
const DELIMITER_END = `# === Owned files end =====`;
|
499
|
-
async function
|
500
|
-
const { buildContext
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
.
|
511
|
-
.
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
...extensionModuleMeta.files
|
543
|
+
async function writeManagedGitignoreFiles(params) {
|
544
|
+
const { buildContext } = params;
|
545
|
+
for (const isPublicIteration of [false, true]) {
|
546
|
+
const extensionModuleMetas_ctx = params.extensionModuleMetas
|
547
|
+
.map(extensionModuleMeta => (Object.assign(Object.assign({}, extensionModuleMeta), { files: extensionModuleMeta.files.filter(({ isPublic }) => isPublic === isPublicIteration) })))
|
548
|
+
.filter(extensionModuleMeta => extensionModuleMeta.files.length !== 0);
|
549
|
+
if (extensionModuleMetas_ctx.length === 0) {
|
550
|
+
continue;
|
551
|
+
}
|
552
|
+
const ownedFilesRelativePaths_ctx = params.ownedFilesRelativePaths.filter(({ isPublic }) => isPublic === isPublicIteration);
|
553
|
+
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(isPublicIteration
|
554
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_5__/* .KEYCLOAK_THEME */ .PC)
|
555
|
+
: buildContext.themeSrcDirPath, ".gitignore");
|
556
|
+
const content_new = Buffer.from([
|
557
|
+
`# This file is managed by Keycloakify, do not edit it manually.`,
|
558
|
+
``,
|
559
|
+
DELIMITER_START,
|
560
|
+
...ownedFilesRelativePaths_ctx
|
518
561
|
.map(({ fileRelativePath }) => fileRelativePath)
|
519
|
-
.
|
520
|
-
.map(
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
562
|
+
.map(fileRelativePath => fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/"))
|
563
|
+
.map(line => `# ${line}`),
|
564
|
+
DELIMITER_END,
|
565
|
+
``,
|
566
|
+
...extensionModuleMetas_ctx
|
567
|
+
.map(extensionModuleMeta => [
|
568
|
+
`# === ${extensionModuleMeta.moduleName} v${extensionModuleMeta.version} ===`,
|
569
|
+
...extensionModuleMeta.files
|
570
|
+
.map(({ fileRelativePath }) => fileRelativePath)
|
571
|
+
.filter(fileRelativePath => !ownedFilesRelativePaths_ctx
|
572
|
+
.map(({ fileRelativePath }) => fileRelativePath)
|
573
|
+
.includes(fileRelativePath))
|
574
|
+
.map(fileRelativePath => `/${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/").replace(/^\.\//, "")}`),
|
575
|
+
``
|
576
|
+
])
|
577
|
+
.flat()
|
578
|
+
].join("\n"), "utf8");
|
579
|
+
const content_current = await (async () => {
|
580
|
+
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
|
581
|
+
return undefined;
|
582
|
+
}
|
583
|
+
return await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath);
|
584
|
+
})();
|
585
|
+
if (content_current !== undefined && content_current.equals(content_new)) {
|
586
|
+
continue;
|
528
587
|
}
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(filePath);
|
536
|
-
if (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(dirPath)) {
|
537
|
-
break create_dir;
|
588
|
+
create_dir: {
|
589
|
+
const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(filePath);
|
590
|
+
if (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(dirPath)) {
|
591
|
+
break create_dir;
|
592
|
+
}
|
593
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.mkdir(dirPath, { recursive: true });
|
538
594
|
}
|
539
|
-
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.
|
595
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, content_new);
|
540
596
|
}
|
541
|
-
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, content_new);
|
542
597
|
}
|
543
|
-
async function
|
598
|
+
async function readManagedGitignoresFile(params) {
|
544
599
|
const { buildContext } = params;
|
545
|
-
const
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
const index_end = contentStr.indexOf(DELIMITER_END);
|
553
|
-
if (index_start === -1 || index_end === -1) {
|
554
|
-
return undefined;
|
600
|
+
const ownedFilesRelativePaths = [];
|
601
|
+
for (const isPublicIteration of [false, true]) {
|
602
|
+
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(isPublicIteration
|
603
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_5__/* .KEYCLOAK_THEME */ .PC)
|
604
|
+
: buildContext.themeSrcDirPath, ".gitignore");
|
605
|
+
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
|
606
|
+
continue;
|
555
607
|
}
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
608
|
+
const contentStr = (await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)).toString("utf8");
|
609
|
+
const payload = (() => {
|
610
|
+
const index_start = contentStr.indexOf(DELIMITER_START);
|
611
|
+
const index_end = contentStr.indexOf(DELIMITER_END);
|
612
|
+
if (index_start === -1 || index_end === -1) {
|
613
|
+
return undefined;
|
614
|
+
}
|
615
|
+
return contentStr
|
616
|
+
.slice(index_start + DELIMITER_START.length, index_end)
|
617
|
+
.trim();
|
618
|
+
})();
|
619
|
+
if (payload === undefined) {
|
620
|
+
continue;
|
621
|
+
}
|
622
|
+
payload
|
623
|
+
.split("\n")
|
624
|
+
.map(line => line.trim())
|
625
|
+
.map(line => line.replace(/^# /, ""))
|
626
|
+
.filter(line => line !== "")
|
627
|
+
.map(line => (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
|
628
|
+
cwd: buildContext.themeSrcDirPath,
|
629
|
+
pathIsh: line
|
630
|
+
}))
|
631
|
+
.map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(buildContext.themeSrcDirPath, filePath))
|
632
|
+
.forEach(fileRelativePath => ownedFilesRelativePaths.push({
|
633
|
+
isPublic: isPublicIteration,
|
634
|
+
fileRelativePath
|
635
|
+
}));
|
560
636
|
}
|
561
|
-
const ownedFilesRelativePaths = payload
|
562
|
-
.split("\n")
|
563
|
-
.map(line => line.trim())
|
564
|
-
.map(line => line.replace(/^# /, ""))
|
565
|
-
.filter(line => line !== "")
|
566
|
-
.map(line => (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
|
567
|
-
cwd: buildContext.themeSrcDirPath,
|
568
|
-
pathIsh: line
|
569
|
-
}))
|
570
|
-
.map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(buildContext.themeSrcDirPath, filePath));
|
571
637
|
return { ownedFilesRelativePaths };
|
572
638
|
}
|
573
|
-
//# sourceMappingURL=
|
639
|
+
//# sourceMappingURL=managedGitignoreFiles.js.map
|
574
640
|
|
575
641
|
/***/ }),
|
576
642
|
|
@@ -700,8 +766,8 @@ async function installExtensionModulesPeerDependencies(params) {
|
|
700
766
|
process.exit(0);
|
701
767
|
}
|
702
768
|
//# sourceMappingURL=installExtensionModulesPeerDependencies.js.map
|
703
|
-
// EXTERNAL MODULE: ./dist/bin/sync-extensions/
|
704
|
-
var
|
769
|
+
// EXTERNAL MODULE: ./dist/bin/sync-extensions/managedGitignoreFiles.js
|
770
|
+
var managedGitignoreFiles = __webpack_require__(86087);
|
705
771
|
// EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
|
706
772
|
var fs_existsAsync = __webpack_require__(43765);
|
707
773
|
// EXTERNAL MODULE: external "child_process"
|
@@ -765,6 +831,8 @@ const untrackFromGit = runExclusive.build(groupRef, async (params) => {
|
|
765
831
|
var update_kc_gen = __webpack_require__(10786);
|
766
832
|
// EXTERNAL MODULE: ./dist/bin/shared/buildContext.js + 3 modules
|
767
833
|
var shared_buildContext = __webpack_require__(85400);
|
834
|
+
// EXTERNAL MODULE: ./dist/bin/shared/constants.js
|
835
|
+
var constants = __webpack_require__(173);
|
768
836
|
;// CONCATENATED MODULE: ./dist/bin/sync-extensions/sync-extension.js
|
769
837
|
|
770
838
|
|
@@ -776,6 +844,8 @@ var shared_buildContext = __webpack_require__(85400);
|
|
776
844
|
|
777
845
|
|
778
846
|
|
847
|
+
|
848
|
+
|
779
849
|
async function command(params) {
|
780
850
|
const { buildContext } = params;
|
781
851
|
const extensionModuleMetas = await (0,sync_extensions_extensionModuleMeta/* getExtensionModuleMetas */.f)({ buildContext });
|
@@ -783,20 +853,22 @@ async function command(params) {
|
|
783
853
|
buildContext,
|
784
854
|
extensionModuleMetas
|
785
855
|
});
|
786
|
-
const { ownedFilesRelativePaths } = await (0,
|
856
|
+
const { ownedFilesRelativePaths } = await (0,managedGitignoreFiles/* readManagedGitignoresFile */.P)({
|
787
857
|
buildContext
|
788
858
|
});
|
789
|
-
await (0,
|
859
|
+
await (0,managedGitignoreFiles/* writeManagedGitignoreFiles */.F)({
|
790
860
|
buildContext,
|
791
861
|
ownedFilesRelativePaths,
|
792
862
|
extensionModuleMetas
|
793
863
|
});
|
794
864
|
await Promise.all(extensionModuleMetas
|
795
|
-
.map(extensionModuleMeta => Promise.all(extensionModuleMeta.files.map(async ({ fileRelativePath, copyableFilePath, hash }) => {
|
796
|
-
if (ownedFilesRelativePaths.
|
865
|
+
.map(extensionModuleMeta => Promise.all(extensionModuleMeta.files.map(async ({ isPublic, fileRelativePath, copyableFilePath, hash }) => {
|
866
|
+
if (ownedFilesRelativePaths.some(entry => (0,same.same)(entry, { isPublic, fileRelativePath }))) {
|
797
867
|
return;
|
798
868
|
}
|
799
|
-
const destFilePath = (0,external_path_.join)(
|
869
|
+
const destFilePath = (0,external_path_.join)(isPublic
|
870
|
+
? (0,external_path_.join)(buildContext.publicDirPath, constants/* KEYCLOAK_THEME */.PC)
|
871
|
+
: buildContext.themeSrcDirPath, fileRelativePath);
|
800
872
|
const doesFileExist = await (0,fs_existsAsync/* existsAsync */.o)(destFilePath);
|
801
873
|
skip_condition: {
|
802
874
|
if (!doesFileExist) {
|
@@ -6,6 +6,7 @@ export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode & Bui
|
|
6
6
|
extraThemeProperties: string[] | undefined;
|
7
7
|
projectDirPath: string;
|
8
8
|
projectBuildDirPath: string;
|
9
|
+
publicDirPath: string;
|
9
10
|
environmentVariables: {
|
10
11
|
name: string;
|
11
12
|
default: string;
|
package/bin/main.js
CHANGED
@@ -16435,14 +16435,28 @@ program
|
|
16435
16435
|
"removing your ownership claim and reverting any modifications."
|
16436
16436
|
].join(" "),
|
16437
16437
|
defaultValue: false
|
16438
|
+
})
|
16439
|
+
.option({
|
16440
|
+
key: "public",
|
16441
|
+
name: (() => {
|
16442
|
+
const long = "public";
|
16443
|
+
const short = "p";
|
16444
|
+
optionsKeys.push(long, short);
|
16445
|
+
return { long, short };
|
16446
|
+
})(),
|
16447
|
+
description: [
|
16448
|
+
"Flag to use when targeting a file or directory in the public directory",
|
16449
|
+
"instead of the src"
|
16450
|
+
].join(" "),
|
16451
|
+
defaultValue: false
|
16438
16452
|
})
|
16439
16453
|
.task({
|
16440
16454
|
skip,
|
16441
|
-
handler: async ({ projectDirPath, path, revert }) => {
|
16455
|
+
handler: async ({ projectDirPath, path, revert, public: public_params }) => {
|
16442
16456
|
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(69), __nccwpck_require__.e(84), __nccwpck_require__.e(97), __nccwpck_require__.e(930)]).then(__nccwpck_require__.bind(__nccwpck_require__, 71930));
|
16443
16457
|
await command({
|
16444
16458
|
buildContext: (0,buildContext/* getBuildContext */.s)({ projectDirPath }),
|
16445
|
-
cliCommandOptions: { path, isRevert: revert }
|
16459
|
+
cliCommandOptions: { path, isRevert: revert, isPublic: public_params }
|
16446
16460
|
});
|
16447
16461
|
}
|
16448
16462
|
});
|
package/bin/own.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
export type BuildContextLike = {
|
3
3
|
themeSrcDirPath: string;
|
4
|
+
publicDirPath: string;
|
4
5
|
};
|
5
6
|
export declare function getExtensionModuleFileSourceCodeReadyToBeCopied(params: {
|
6
7
|
buildContext: BuildContextLike;
|
8
|
+
isPublic: boolean;
|
7
9
|
fileRelativePath: string;
|
8
10
|
isOwnershipAction: boolean;
|
9
11
|
extensionModuleDirPath: string;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
export type BuildContextLike = {
|
2
|
+
themeSrcDirPath: string;
|
3
|
+
publicDirPath: string;
|
4
|
+
};
|
5
|
+
type ExtensionModuleMetaLike = {
|
6
|
+
moduleName: string;
|
7
|
+
version: string;
|
8
|
+
files: {
|
9
|
+
isPublic: boolean;
|
10
|
+
fileRelativePath: string;
|
11
|
+
}[];
|
12
|
+
};
|
13
|
+
export declare function writeManagedGitignoreFiles(params: {
|
14
|
+
buildContext: BuildContextLike;
|
15
|
+
extensionModuleMetas: ExtensionModuleMetaLike[];
|
16
|
+
ownedFilesRelativePaths: {
|
17
|
+
isPublic: boolean;
|
18
|
+
fileRelativePath: string;
|
19
|
+
}[];
|
20
|
+
}): Promise<void>;
|
21
|
+
export declare function readManagedGitignoresFile(params: {
|
22
|
+
buildContext: BuildContextLike;
|
23
|
+
}): Promise<{
|
24
|
+
ownedFilesRelativePaths: {
|
25
|
+
isPublic: boolean;
|
26
|
+
fileRelativePath: string;
|
27
|
+
}[];
|
28
|
+
}>;
|
29
|
+
export {};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
export declare function getIsPrettierAvailable(): Promise<boolean>;
|
2
3
|
export declare namespace getIsPrettierAvailable {
|
3
4
|
var cache: boolean | undefined;
|
@@ -14,4 +15,8 @@ export declare function runPrettier(params: {
|
|
14
15
|
sourceCode: string;
|
15
16
|
filePath: string;
|
16
17
|
}): Promise<string>;
|
18
|
+
export declare function runPrettier(params: {
|
19
|
+
sourceCode: Buffer;
|
20
|
+
filePath: string;
|
21
|
+
}): Promise<Buffer>;
|
17
22
|
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "keycloakify",
|
3
|
-
"version": "11.8.
|
3
|
+
"version": "11.8.38",
|
4
4
|
"description": "Framework to create custom Keycloak UIs",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -717,7 +717,7 @@
|
|
717
717
|
"src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts",
|
718
718
|
"src/bin/sync-extensions/index.ts",
|
719
719
|
"src/bin/sync-extensions/installExtensionModulesPeerDependencies.ts",
|
720
|
-
"src/bin/sync-extensions/
|
720
|
+
"src/bin/sync-extensions/managedGitignoreFiles.ts",
|
721
721
|
"src/bin/sync-extensions/sync-extension.ts",
|
722
722
|
"src/bin/tools/SemVer.ts",
|
723
723
|
"src/bin/tools/String.prototype.replaceAll.ts",
|
@@ -1081,7 +1081,7 @@
|
|
1081
1081
|
"bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts",
|
1082
1082
|
"bin/sync-extensions/index.d.ts",
|
1083
1083
|
"bin/sync-extensions/installExtensionModulesPeerDependencies.d.ts",
|
1084
|
-
"bin/sync-extensions/
|
1084
|
+
"bin/sync-extensions/managedGitignoreFiles.d.ts",
|
1085
1085
|
"bin/sync-extensions/sync-extension.d.ts",
|
1086
1086
|
"bin/tools/assertNoPnpmDlx.d.ts",
|
1087
1087
|
"bin/tools/canonicalStringify.d.ts",
|