keycloakify 11.6.1 → 11.7.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.
Files changed (96) hide show
  1. package/bin/{653.index.js → 288.index.js} +221 -201
  2. package/bin/313.index.js +377 -0
  3. package/bin/{174.index.js → 33.index.js} +37 -2
  4. package/bin/{615.index.js → 355.index.js} +353 -102
  5. package/bin/363.index.js +1537 -0
  6. package/bin/453.index.js +6 -42
  7. package/bin/{503.index.js → 678.index.js} +577 -53
  8. package/bin/{921.index.js → 780.index.js} +54 -45
  9. package/bin/880.index.js +206 -21
  10. package/bin/9.index.js +850 -0
  11. package/bin/{525.index.js → 911.index.js} +1302 -2
  12. package/bin/930.index.js +164 -0
  13. package/bin/946.index.js +20 -0
  14. package/bin/{153.index.js → 947.index.js} +22 -797
  15. package/bin/main.js +61 -19
  16. package/bin/{eject-file.d.ts → own.d.ts} +2 -1
  17. package/bin/shared/{addPostinstallScriptIfNotPresent.d.ts → initializeSpa/addSyncExtensionsToPostinstallScript.d.ts} +1 -1
  18. package/bin/shared/initializeSpa/index.d.ts +1 -0
  19. package/bin/shared/initializeSpa/initializeSpa.d.ts +9 -0
  20. package/bin/{postinstall/uiModuleMeta.d.ts → sync-extensions/extensionModuleMeta.d.ts} +5 -5
  21. package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +12 -0
  22. package/bin/sync-extensions/index.d.ts +1 -0
  23. package/bin/{postinstall/installUiModulesPeerDependencies.d.ts → sync-extensions/installExtensionModulesPeerDependencies.d.ts} +3 -3
  24. package/bin/{postinstall → sync-extensions}/managedGitignoreFile.d.ts +4 -4
  25. package/bin/tools/getInstalledModuleDirPath.d.ts +0 -1
  26. package/bin/tools/isKnownByGit.d.ts +3 -0
  27. package/bin/tools/isRootPath.d.ts +1 -0
  28. package/bin/tools/listInstalledModules.d.ts +0 -1
  29. package/package.json +41 -63
  30. package/src/bin/eject-page.ts +8 -84
  31. package/src/bin/initialize-account-theme/initialize-account-theme.ts +15 -14
  32. package/src/bin/initialize-admin-theme.ts +17 -124
  33. package/src/bin/initialize-email-theme.ts +10 -34
  34. package/src/bin/keycloakify/generateResources/generateResources.ts +49 -21
  35. package/src/bin/main.ts +61 -16
  36. package/src/bin/own.ts +208 -0
  37. package/src/bin/shared/{addPostinstallScriptIfNotPresent.ts → initializeSpa/addSyncExtensionsToPostinstallScript.ts} +4 -4
  38. package/src/bin/shared/initializeSpa/index.ts +1 -0
  39. package/src/bin/shared/initializeSpa/initializeSpa.ts +149 -0
  40. package/src/bin/{postinstall/uiModuleMeta.ts → sync-extensions/extensionModuleMeta.ts} +48 -43
  41. package/src/bin/{postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts → sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts} +32 -21
  42. package/src/bin/sync-extensions/index.ts +1 -0
  43. package/src/bin/{postinstall/installUiModulesPeerDependencies.ts → sync-extensions/installExtensionModulesPeerDependencies.ts} +15 -13
  44. package/src/bin/{postinstall → sync-extensions}/managedGitignoreFile.ts +18 -18
  45. package/src/bin/{postinstall/postinstall.ts → sync-extensions/sync-extension.ts} +14 -26
  46. package/src/bin/tools/getInstalledModuleDirPath.ts +24 -22
  47. package/src/bin/tools/isKnownByGit.ts +45 -0
  48. package/src/bin/tools/isRootPath.ts +22 -0
  49. package/src/bin/tools/listInstalledModules.ts +4 -6
  50. package/src/bin/tools/npmInstall.ts +1 -1
  51. package/src/bin/tools/untrackFromGit.ts +19 -3
  52. package/src/bin/tsconfig.json +1 -1
  53. package/bin/300.index.js +0 -770
  54. package/bin/375.index.js +0 -4089
  55. package/bin/490.index.js +0 -1108
  56. package/bin/568.index.js +0 -1867
  57. package/bin/735.index.js +0 -907
  58. package/bin/743.index.js +0 -69
  59. package/bin/854.index.js +0 -68
  60. package/bin/initialize-account-theme/copyBoilerplate.d.ts +0 -4
  61. package/bin/initialize-account-theme/initializeAccountTheme_multiPage.d.ts +0 -3
  62. package/bin/initialize-account-theme/initializeAccountTheme_singlePage.d.ts +0 -11
  63. package/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.d.ts +0 -12
  64. package/bin/postinstall/index.d.ts +0 -1
  65. package/bin/shared/getLatestsSemVersionedTag.d.ts +0 -15
  66. package/bin/shared/promptKeycloakVersion.d.ts +0 -10
  67. package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
  68. package/bin/tools/crc32.d.ts +0 -9
  69. package/bin/tools/deflate.d.ts +0 -24
  70. package/bin/tools/isTrackedByGit.d.ts +0 -3
  71. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -15
  72. package/bin/tools/octokit-addons/listTags.d.ts +0 -13
  73. package/bin/tools/tee.d.ts +0 -3
  74. package/bin/tools/trimIndent.d.ts +0 -5
  75. package/src/bin/eject-file.ts +0 -68
  76. package/src/bin/initialize-account-theme/copyBoilerplate.ts +0 -32
  77. package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +0 -21
  78. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +0 -142
  79. package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +0 -7
  80. package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +0 -11
  81. package/src/bin/postinstall/index.ts +0 -1
  82. package/src/bin/shared/getLatestsSemVersionedTag.ts +0 -201
  83. package/src/bin/shared/promptKeycloakVersion.ts +0 -72
  84. package/src/bin/tools/OptionalIfCanBeUndefined.ts +0 -12
  85. package/src/bin/tools/crc32.ts +0 -73
  86. package/src/bin/tools/deflate.ts +0 -61
  87. package/src/bin/tools/isTrackedByGit.ts +0 -29
  88. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +0 -47
  89. package/src/bin/tools/octokit-addons/listTags.ts +0 -60
  90. package/src/bin/tools/tee.ts +0 -39
  91. package/src/bin/tools/trimIndent.ts +0 -49
  92. /package/bin/{postinstall/postinstall.d.ts → sync-extensions/sync-extension.d.ts} +0 -0
  93. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcContext.ts +0 -0
  94. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPage.tsx +0 -0
  95. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPageStory.tsx +0 -0
  96. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/i18n.ts +0 -0
package/bin/743.index.js DELETED
@@ -1,69 +0,0 @@
1
- "use strict";
2
- exports.id = 743;
3
- exports.ids = [743];
4
- exports.modules = {
5
-
6
- /***/ 81434:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "T": () => (/* binding */ copyBoilerplate)
11
- /* harmony export */ });
12
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
13
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
14
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
15
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
16
- /* harmony import */ var _tools_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58822);
17
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
18
-
19
-
20
-
21
-
22
- function copyBoilerplate(params) {
23
- const { accountThemeType, accountThemeSrcDirPath } = params;
24
- fs__WEBPACK_IMPORTED_MODULE_0__.cpSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_tools_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__/* .getThisCodebaseRootDirPath */ .e)(), "src", "bin", "initialize-account-theme", "src", (() => {
25
- switch (accountThemeType) {
26
- case "Single-Page":
27
- return "single-page";
28
- case "Multi-Page":
29
- return "multi-page";
30
- }
31
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(false);
32
- })()), accountThemeSrcDirPath, { recursive: true });
33
- }
34
- //# sourceMappingURL=copyBoilerplate.js.map
35
-
36
- /***/ }),
37
-
38
- /***/ 22743:
39
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
40
-
41
- __webpack_require__.r(__webpack_exports__);
42
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
43
- /* harmony export */ "initializeAccountTheme_multiPage": () => (/* binding */ initializeAccountTheme_multiPage)
44
- /* harmony export */ });
45
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
46
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
47
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(78818);
48
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_1__);
49
- /* harmony import */ var _copyBoilerplate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81434);
50
-
51
-
52
-
53
- async function initializeAccountTheme_multiPage(params) {
54
- const { accountThemeSrcDirPath } = params;
55
- (0,_copyBoilerplate__WEBPACK_IMPORTED_MODULE_2__/* .copyBoilerplate */ .T)({
56
- accountThemeType: "Multi-Page",
57
- accountThemeSrcDirPath
58
- });
59
- console.log([
60
- chalk__WEBPACK_IMPORTED_MODULE_1___default().green("The Multi-Page account theme has been initialized."),
61
- `Directory created: ${chalk__WEBPACK_IMPORTED_MODULE_1___default().bold((0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(process.cwd(), accountThemeSrcDirPath))}`
62
- ].join("\n"));
63
- }
64
- //# sourceMappingURL=initializeAccountTheme_multiPage.js.map
65
-
66
- /***/ })
67
-
68
- };
69
- ;
package/bin/854.index.js DELETED
@@ -1,68 +0,0 @@
1
- "use strict";
2
- exports.id = 854;
3
- exports.ids = [854];
4
- exports.modules = {
5
-
6
- /***/ 85854:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- __webpack_require__.r(__webpack_exports__);
10
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
- /* harmony export */ "command": () => (/* binding */ command)
12
- /* harmony export */ });
13
- /* harmony import */ var _postinstall_getUiModuleFileSourceCodeReadyToBeCopied__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6385);
14
- /* harmony import */ var _tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84794);
15
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71017);
16
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
17
- /* harmony import */ var _postinstall_uiModuleMeta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(58644);
18
- /* harmony import */ var _tools_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21022);
19
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(73292);
20
- /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_5__);
21
- /* harmony import */ var _postinstall_managedGitignoreFile__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(36843);
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
- async function command(params) {
30
- const { buildContext, cliCommandOptions } = params;
31
- const fileRelativePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.relative)(buildContext.themeSrcDirPath, (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_1__/* .getAbsoluteAndInOsFormatPath */ .c)({
32
- cwd: buildContext.themeSrcDirPath,
33
- pathIsh: cliCommandOptions.file
34
- }));
35
- const uiModuleMetas = await (0,_postinstall_uiModuleMeta__WEBPACK_IMPORTED_MODULE_3__/* .getUiModuleMetas */ .j)({ buildContext });
36
- const uiModuleMeta = uiModuleMetas.find(({ files }) => files.map(({ fileRelativePath }) => fileRelativePath).includes(fileRelativePath));
37
- if (!uiModuleMeta) {
38
- throw new Error(`No UI module found for the file ${fileRelativePath}`);
39
- }
40
- const uiModuleDirPath = await (0,_tools_getInstalledModuleDirPath__WEBPACK_IMPORTED_MODULE_4__/* .getInstalledModuleDirPath */ .p)({
41
- moduleName: uiModuleMeta.moduleName,
42
- packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_2__.dirname)(buildContext.packageJsonFilePath),
43
- projectDirPath: buildContext.projectDirPath
44
- });
45
- const sourceCode = await (0,_postinstall_getUiModuleFileSourceCodeReadyToBeCopied__WEBPACK_IMPORTED_MODULE_0__/* .getUiModuleFileSourceCodeReadyToBeCopied */ .X)({
46
- buildContext,
47
- fileRelativePath,
48
- isForEjection: true,
49
- uiModuleName: uiModuleMeta.moduleName,
50
- uiModuleDirPath,
51
- uiModuleVersion: uiModuleMeta.version
52
- });
53
- await fs_promises__WEBPACK_IMPORTED_MODULE_5__.writeFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath), sourceCode);
54
- const { ejectedFilesRelativePaths } = await (0,_postinstall_managedGitignoreFile__WEBPACK_IMPORTED_MODULE_6__/* .readManagedGitignoreFile */ .w)({
55
- buildContext
56
- });
57
- await (0,_postinstall_managedGitignoreFile__WEBPACK_IMPORTED_MODULE_6__/* .writeManagedGitignoreFile */ .Y)({
58
- buildContext,
59
- uiModuleMetas,
60
- ejectedFilesRelativePaths: [...ejectedFilesRelativePaths, fileRelativePath]
61
- });
62
- }
63
- //# sourceMappingURL=eject-file.js.map
64
-
65
- /***/ })
66
-
67
- };
68
- ;
@@ -1,4 +0,0 @@
1
- export declare function copyBoilerplate(params: {
2
- accountThemeType: "Single-Page" | "Multi-Page";
3
- accountThemeSrcDirPath: string;
4
- }): void;
@@ -1,3 +0,0 @@
1
- export declare function initializeAccountTheme_multiPage(params: {
2
- accountThemeSrcDirPath: string;
3
- }): Promise<void>;
@@ -1,11 +0,0 @@
1
- import type { BuildContext } from "../shared/buildContext";
2
- import { type BuildContextLike as BuildContextLike_getLatestsSemVersionedTag } from "../shared/getLatestsSemVersionedTag";
3
- type BuildContextLike = BuildContextLike_getLatestsSemVersionedTag & {
4
- fetchOptions: BuildContext["fetchOptions"];
5
- packageJsonFilePath: string;
6
- };
7
- export declare function initializeAccountTheme_singlePage(params: {
8
- accountThemeSrcDirPath: string;
9
- buildContext: BuildContextLike;
10
- }): Promise<void>;
11
- export {};
@@ -1,12 +0,0 @@
1
- /// <reference types="node" />
2
- export type BuildContextLike = {
3
- themeSrcDirPath: string;
4
- };
5
- export declare function getUiModuleFileSourceCodeReadyToBeCopied(params: {
6
- buildContext: BuildContextLike;
7
- fileRelativePath: string;
8
- isForEjection: boolean;
9
- uiModuleDirPath: string;
10
- uiModuleName: string;
11
- uiModuleVersion: string;
12
- }): Promise<Buffer>;
@@ -1 +0,0 @@
1
- export * from "./postinstall";
@@ -1,15 +0,0 @@
1
- import { getLatestsSemVersionedTagFactory } from "../tools/octokit-addons/getLatestsSemVersionedTag";
2
- import type { ReturnType } from "tsafe";
3
- import type { Param0 } from "tsafe";
4
- import type { BuildContext } from "./buildContext";
5
- type GetLatestsSemVersionedTag = ReturnType<typeof getLatestsSemVersionedTagFactory>["getLatestsSemVersionedTag"];
6
- type Params = Param0<GetLatestsSemVersionedTag>;
7
- type R = ReturnType<GetLatestsSemVersionedTag>;
8
- export type BuildContextLike = {
9
- cacheDirPath: string;
10
- fetchOptions: BuildContext["fetchOptions"];
11
- };
12
- export declare function getLatestsSemVersionedTag({ buildContext, ...params }: Params & {
13
- buildContext: BuildContextLike;
14
- }): Promise<R>;
15
- export {};
@@ -1,10 +0,0 @@
1
- import { type BuildContextLike as BuildContextLike_getLatestsSemVersionedTag } from "./getLatestsSemVersionedTag";
2
- export type BuildContextLike = BuildContextLike_getLatestsSemVersionedTag & {};
3
- export declare function promptKeycloakVersion(params: {
4
- startingFromMajor: number | undefined;
5
- excludeMajorVersions: number[];
6
- doOmitPatch: boolean;
7
- buildContext: BuildContextLike;
8
- }): Promise<{
9
- keycloakVersion: string;
10
- }>;
@@ -1,14 +0,0 @@
1
- type PropertiesThatCanBeUndefined<T extends Record<string, unknown>> = {
2
- [Key in keyof T]: undefined extends T[Key] ? Key : never;
3
- }[keyof T];
4
- /**
5
- * OptionalIfCanBeUndefined<{ p1: string | undefined; p2: string; }>
6
- * is
7
- * { p1?: string | undefined; p2: string }
8
- */
9
- export type OptionalIfCanBeUndefined<T extends Record<string, unknown>> = {
10
- [K in PropertiesThatCanBeUndefined<T>]?: T[K];
11
- } & {
12
- [K in Exclude<keyof T, PropertiesThatCanBeUndefined<T>>]: T[K];
13
- };
14
- export {};
@@ -1,9 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Readable } from "stream";
4
- /**
5
- *
6
- * @param input either a byte stream, a string or a buffer, you want to have the checksum for
7
- * @returns a promise for a checksum (uint32)
8
- */
9
- export declare function crc32(input: Readable | String | Buffer): Promise<number>;
@@ -1,24 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Readable } from "stream";
4
- /**
5
- * @param data buffer containing the data to be compressed
6
- * @returns a buffer containing the compressed/deflated data and the crc32 checksum
7
- * of the source data
8
- */
9
- export declare function deflateBuffer(data: Buffer): Promise<{
10
- deflated: Buffer;
11
- crc32: number;
12
- }>;
13
- /**
14
- * @param input a byte stream, containing data to be compressed
15
- * @param sink a method that will accept chunks of compressed data; We don't pass
16
- * a writable here, since we don't want the writablestream to be closed after
17
- * a single file
18
- * @returns a promise, which will resolve with the crc32 checksum and the
19
- * compressed size
20
- */
21
- export declare function deflateStream(input: Readable, sink: (chunk: Buffer) => void): Promise<{
22
- crc32: number;
23
- compressedSize: number;
24
- }>;
@@ -1,3 +0,0 @@
1
- export declare function getIsTrackedByGit(params: {
2
- filePath: string;
3
- }): Promise<boolean>;
@@ -1,15 +0,0 @@
1
- import type { Octokit } from "@octokit/rest";
2
- import { SemVer } from "../SemVer";
3
- export declare function getLatestsSemVersionedTagFactory(params: {
4
- octokit: Octokit;
5
- }): {
6
- getLatestsSemVersionedTag: (params: {
7
- owner: string;
8
- repo: string;
9
- count: number;
10
- doIgnoreReleaseCandidates: boolean;
11
- }) => Promise<{
12
- tag: string;
13
- version: SemVer;
14
- }[]>;
15
- };
@@ -1,13 +0,0 @@
1
- import type { Octokit } from "@octokit/rest";
2
- export declare function listTagsFactory(params: {
3
- octokit: Octokit;
4
- }): {
5
- listTags: (params: {
6
- owner: string;
7
- repo: string;
8
- }) => AsyncGenerator<string>;
9
- getLatestTag: (params: {
10
- owner: string;
11
- repo: string;
12
- }) => Promise<string | undefined>;
13
- };
@@ -1,3 +0,0 @@
1
- /// <reference types="node" />
2
- import { PassThrough, Readable } from "stream";
3
- export default function tee(input: Readable): readonly [PassThrough, PassThrough];
@@ -1,5 +0,0 @@
1
- /**
2
- * Shift all lines left by the *smallest* indentation level,
3
- * and remove initial newline and all trailing spaces.
4
- */
5
- export default function trimIndent(strings: TemplateStringsArray, ...args: any[]): string;
@@ -1,68 +0,0 @@
1
- import type { BuildContext } from "./shared/buildContext";
2
- import { getUiModuleFileSourceCodeReadyToBeCopied } from "./postinstall/getUiModuleFileSourceCodeReadyToBeCopied";
3
- import { getAbsoluteAndInOsFormatPath } from "./tools/getAbsoluteAndInOsFormatPath";
4
- import { relative as pathRelative, dirname as pathDirname, join as pathJoin } from "path";
5
- import { getUiModuleMetas } from "./postinstall/uiModuleMeta";
6
- import { getInstalledModuleDirPath } from "./tools/getInstalledModuleDirPath";
7
- import * as fsPr from "fs/promises";
8
- import {
9
- readManagedGitignoreFile,
10
- writeManagedGitignoreFile
11
- } from "./postinstall/managedGitignoreFile";
12
-
13
- export async function command(params: {
14
- buildContext: BuildContext;
15
- cliCommandOptions: {
16
- file: string;
17
- };
18
- }) {
19
- const { buildContext, cliCommandOptions } = params;
20
-
21
- const fileRelativePath = pathRelative(
22
- buildContext.themeSrcDirPath,
23
- getAbsoluteAndInOsFormatPath({
24
- cwd: buildContext.themeSrcDirPath,
25
- pathIsh: cliCommandOptions.file
26
- })
27
- );
28
-
29
- const uiModuleMetas = await getUiModuleMetas({ buildContext });
30
-
31
- const uiModuleMeta = uiModuleMetas.find(({ files }) =>
32
- files.map(({ fileRelativePath }) => fileRelativePath).includes(fileRelativePath)
33
- );
34
-
35
- if (!uiModuleMeta) {
36
- throw new Error(`No UI module found for the file ${fileRelativePath}`);
37
- }
38
-
39
- const uiModuleDirPath = await getInstalledModuleDirPath({
40
- moduleName: uiModuleMeta.moduleName,
41
- packageJsonDirPath: pathDirname(buildContext.packageJsonFilePath),
42
- projectDirPath: buildContext.projectDirPath
43
- });
44
-
45
- const sourceCode = await getUiModuleFileSourceCodeReadyToBeCopied({
46
- buildContext,
47
- fileRelativePath,
48
- isForEjection: true,
49
- uiModuleName: uiModuleMeta.moduleName,
50
- uiModuleDirPath,
51
- uiModuleVersion: uiModuleMeta.version
52
- });
53
-
54
- await fsPr.writeFile(
55
- pathJoin(buildContext.themeSrcDirPath, fileRelativePath),
56
- sourceCode
57
- );
58
-
59
- const { ejectedFilesRelativePaths } = await readManagedGitignoreFile({
60
- buildContext
61
- });
62
-
63
- await writeManagedGitignoreFile({
64
- buildContext,
65
- uiModuleMetas,
66
- ejectedFilesRelativePaths: [...ejectedFilesRelativePaths, fileRelativePath]
67
- });
68
- }
@@ -1,32 +0,0 @@
1
- import * as fs from "fs";
2
- import { join as pathJoin } from "path";
3
- import { getThisCodebaseRootDirPath } from "../tools/getThisCodebaseRootDirPath";
4
- import { assert, type Equals } from "tsafe/assert";
5
-
6
- export function copyBoilerplate(params: {
7
- accountThemeType: "Single-Page" | "Multi-Page";
8
- accountThemeSrcDirPath: string;
9
- }) {
10
- const { accountThemeType, accountThemeSrcDirPath } = params;
11
-
12
- fs.cpSync(
13
- pathJoin(
14
- getThisCodebaseRootDirPath(),
15
- "src",
16
- "bin",
17
- "initialize-account-theme",
18
- "src",
19
- (() => {
20
- switch (accountThemeType) {
21
- case "Single-Page":
22
- return "single-page";
23
- case "Multi-Page":
24
- return "multi-page";
25
- }
26
- assert<Equals<typeof accountThemeType, never>>(false);
27
- })()
28
- ),
29
- accountThemeSrcDirPath,
30
- { recursive: true }
31
- );
32
- }
@@ -1,21 +0,0 @@
1
- import { relative as pathRelative } from "path";
2
- import chalk from "chalk";
3
- import { copyBoilerplate } from "./copyBoilerplate";
4
-
5
- export async function initializeAccountTheme_multiPage(params: {
6
- accountThemeSrcDirPath: string;
7
- }) {
8
- const { accountThemeSrcDirPath } = params;
9
-
10
- copyBoilerplate({
11
- accountThemeType: "Multi-Page",
12
- accountThemeSrcDirPath
13
- });
14
-
15
- console.log(
16
- [
17
- chalk.green("The Multi-Page account theme has been initialized."),
18
- `Directory created: ${chalk.bold(pathRelative(process.cwd(), accountThemeSrcDirPath))}`
19
- ].join("\n")
20
- );
21
- }
@@ -1,142 +0,0 @@
1
- import { relative as pathRelative, dirname as pathDirname } from "path";
2
- import type { BuildContext } from "../shared/buildContext";
3
- import * as fs from "fs";
4
- import chalk from "chalk";
5
- import {
6
- getLatestsSemVersionedTag,
7
- type BuildContextLike as BuildContextLike_getLatestsSemVersionedTag
8
- } from "../shared/getLatestsSemVersionedTag";
9
- import { SemVer } from "../tools/SemVer";
10
- import fetch from "make-fetch-happen";
11
- import { z } from "zod";
12
- import { assert, type Equals, is } from "tsafe/assert";
13
- import { id } from "tsafe/id";
14
- import { npmInstall } from "../tools/npmInstall";
15
- import { copyBoilerplate } from "./copyBoilerplate";
16
-
17
- type BuildContextLike = BuildContextLike_getLatestsSemVersionedTag & {
18
- fetchOptions: BuildContext["fetchOptions"];
19
- packageJsonFilePath: string;
20
- };
21
-
22
- assert<BuildContext extends BuildContextLike ? true : false>();
23
-
24
- export async function initializeAccountTheme_singlePage(params: {
25
- accountThemeSrcDirPath: string;
26
- buildContext: BuildContextLike;
27
- }) {
28
- const { accountThemeSrcDirPath, buildContext } = params;
29
-
30
- const OWNER = "keycloakify";
31
- const REPO = "keycloak-account-ui";
32
-
33
- const [semVersionedTag] = await getLatestsSemVersionedTag({
34
- owner: OWNER,
35
- repo: REPO,
36
- count: 1,
37
- doIgnoreReleaseCandidates: false,
38
- buildContext
39
- });
40
-
41
- const dependencies = await fetch(
42
- `https://raw.githubusercontent.com/${OWNER}/${REPO}/${semVersionedTag.tag}/dependencies.gen.json`,
43
- buildContext.fetchOptions
44
- )
45
- .then(r => r.json())
46
- .then(
47
- (() => {
48
- type Dependencies = {
49
- dependencies: Record<string, string>;
50
- devDependencies?: Record<string, string>;
51
- };
52
-
53
- const zDependencies = (() => {
54
- type TargetType = Dependencies;
55
-
56
- const zTargetType = z.object({
57
- dependencies: z.record(z.string()),
58
- devDependencies: z.record(z.string()).optional()
59
- });
60
-
61
- assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
62
-
63
- return id<z.ZodType<TargetType>>(zTargetType);
64
- })();
65
-
66
- return o => zDependencies.parse(o);
67
- })()
68
- );
69
-
70
- dependencies.dependencies["@keycloakify/keycloak-account-ui"] = SemVer.stringify(
71
- semVersionedTag.version
72
- );
73
-
74
- const parsedPackageJson = (() => {
75
- type ParsedPackageJson = {
76
- dependencies?: Record<string, string>;
77
- devDependencies?: Record<string, string>;
78
- };
79
-
80
- const zParsedPackageJson = (() => {
81
- type TargetType = ParsedPackageJson;
82
-
83
- const zTargetType = z.object({
84
- dependencies: z.record(z.string()).optional(),
85
- devDependencies: z.record(z.string()).optional()
86
- });
87
-
88
- assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
89
-
90
- return id<z.ZodType<TargetType>>(zTargetType);
91
- })();
92
- const parsedPackageJson = JSON.parse(
93
- fs.readFileSync(buildContext.packageJsonFilePath).toString("utf8")
94
- );
95
-
96
- zParsedPackageJson.parse(parsedPackageJson);
97
-
98
- assert(is<ParsedPackageJson>(parsedPackageJson));
99
-
100
- return parsedPackageJson;
101
- })();
102
-
103
- parsedPackageJson.dependencies = {
104
- ...parsedPackageJson.dependencies,
105
- ...dependencies.dependencies
106
- };
107
-
108
- parsedPackageJson.devDependencies = {
109
- ...parsedPackageJson.devDependencies,
110
- ...dependencies.devDependencies
111
- };
112
-
113
- if (Object.keys(parsedPackageJson.devDependencies).length === 0) {
114
- delete parsedPackageJson.devDependencies;
115
- }
116
-
117
- fs.writeFileSync(
118
- buildContext.packageJsonFilePath,
119
- JSON.stringify(parsedPackageJson, undefined, 4)
120
- );
121
-
122
- await npmInstall({
123
- packageJsonDirPath: pathDirname(buildContext.packageJsonFilePath)
124
- });
125
-
126
- copyBoilerplate({
127
- accountThemeType: "Single-Page",
128
- accountThemeSrcDirPath
129
- });
130
-
131
- console.log(
132
- [
133
- chalk.green(
134
- "The Single-Page account theme has been successfully initialized."
135
- ),
136
- `Using Account UI of Keycloak version: ${chalk.bold(semVersionedTag.tag.split("-")[0])}`,
137
- `Directory created: ${chalk.bold(pathRelative(process.cwd(), accountThemeSrcDirPath))}`,
138
- `Dependencies added to your project's package.json: `,
139
- chalk.bold(JSON.stringify(dependencies, null, 2))
140
- ].join("\n")
141
- );
142
- }
@@ -1,7 +0,0 @@
1
- import type { KcContextLike } from "@keycloakify/keycloak-account-ui";
2
- import type { KcEnvName } from "../kc.gen";
3
-
4
- export type KcContext = KcContextLike & {
5
- themeType: "account";
6
- properties: Record<KcEnvName, string>;
7
- };
@@ -1,11 +0,0 @@
1
- import { lazy } from "react";
2
- import { KcAccountUiLoader } from "@keycloakify/keycloak-account-ui";
3
- import type { KcContext } from "./KcContext";
4
-
5
- const KcAccountUi = lazy(() => import("@keycloakify/keycloak-account-ui/KcAccountUi"));
6
-
7
- export default function KcPage(props: { kcContext: KcContext }) {
8
- const { kcContext } = props;
9
-
10
- return <KcAccountUiLoader kcContext={kcContext} KcAccountUi={KcAccountUi} />;
11
- }
@@ -1 +0,0 @@
1
- export * from "./postinstall";