keycloakify 11.6.2 → 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 (69) hide show
  1. package/bin/{735.index.js → 288.index.js} +226 -360
  2. package/bin/313.index.js +377 -0
  3. package/bin/{174.index.js → 33.index.js} +37 -2
  4. package/bin/{840.index.js → 355.index.js} +348 -97
  5. package/bin/363.index.js +153 -144
  6. package/bin/453.index.js +5 -41
  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 +3 -4
  13. package/bin/{153.index.js → 947.index.js} +22 -797
  14. package/bin/main.js +6 -6
  15. package/bin/shared/initializeSpa/index.d.ts +1 -0
  16. package/bin/shared/initializeSpa/initializeSpa.d.ts +9 -0
  17. package/bin/tools/getInstalledModuleDirPath.d.ts +0 -1
  18. package/bin/tools/isRootPath.d.ts +1 -0
  19. package/bin/tools/listInstalledModules.d.ts +0 -1
  20. package/package.json +22 -44
  21. package/src/bin/eject-page.ts +7 -81
  22. package/src/bin/initialize-account-theme/initialize-account-theme.ts +15 -14
  23. package/src/bin/initialize-admin-theme.ts +17 -124
  24. package/src/bin/initialize-email-theme.ts +10 -34
  25. package/src/bin/keycloakify/generateResources/generateResources.ts +49 -21
  26. package/src/bin/own.ts +1 -2
  27. package/src/bin/shared/{addSyncExtensionsToPostinstallScript.ts → initializeSpa/addSyncExtensionsToPostinstallScript.ts} +2 -2
  28. package/src/bin/shared/initializeSpa/index.ts +1 -0
  29. package/src/bin/shared/initializeSpa/initializeSpa.ts +149 -0
  30. package/src/bin/sync-extensions/extensionModuleMeta.ts +0 -1
  31. package/src/bin/tools/getInstalledModuleDirPath.ts +24 -22
  32. package/src/bin/tools/isRootPath.ts +22 -0
  33. package/src/bin/tools/listInstalledModules.ts +2 -4
  34. package/src/bin/tsconfig.json +1 -1
  35. package/bin/375.index.js +0 -4089
  36. package/bin/490.index.js +0 -1108
  37. package/bin/568.index.js +0 -1867
  38. package/bin/743.index.js +0 -69
  39. package/bin/initialize-account-theme/copyBoilerplate.d.ts +0 -4
  40. package/bin/initialize-account-theme/initializeAccountTheme_multiPage.d.ts +0 -3
  41. package/bin/initialize-account-theme/initializeAccountTheme_singlePage.d.ts +0 -11
  42. package/bin/shared/getLatestsSemVersionedTag.d.ts +0 -15
  43. package/bin/shared/promptKeycloakVersion.d.ts +0 -10
  44. package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
  45. package/bin/tools/crc32.d.ts +0 -9
  46. package/bin/tools/deflate.d.ts +0 -24
  47. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -15
  48. package/bin/tools/octokit-addons/listTags.d.ts +0 -13
  49. package/bin/tools/tee.d.ts +0 -3
  50. package/bin/tools/trimIndent.d.ts +0 -5
  51. package/src/bin/initialize-account-theme/copyBoilerplate.ts +0 -32
  52. package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +0 -21
  53. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +0 -142
  54. package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +0 -7
  55. package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +0 -11
  56. package/src/bin/shared/getLatestsSemVersionedTag.ts +0 -201
  57. package/src/bin/shared/promptKeycloakVersion.ts +0 -72
  58. package/src/bin/tools/OptionalIfCanBeUndefined.ts +0 -12
  59. package/src/bin/tools/crc32.ts +0 -73
  60. package/src/bin/tools/deflate.ts +0 -61
  61. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +0 -47
  62. package/src/bin/tools/octokit-addons/listTags.ts +0 -60
  63. package/src/bin/tools/tee.ts +0 -39
  64. package/src/bin/tools/trimIndent.ts +0 -49
  65. /package/bin/shared/{addSyncExtensionsToPostinstallScript.d.ts → initializeSpa/addSyncExtensionsToPostinstallScript.d.ts} +0 -0
  66. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcContext.ts +0 -0
  67. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPage.tsx +0 -0
  68. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPageStory.tsx +0 -0
  69. /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/i18n.ts +0 -0
package/bin/main.js CHANGED
@@ -16201,7 +16201,7 @@ program
16201
16201
  .task({
16202
16202
  skip,
16203
16203
  handler: async ({ projectDirPath, keycloakVersion, port, realmJsonFilePath }) => {
16204
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(174), __nccwpck_require__.e(525), __nccwpck_require__.e(568), __nccwpck_require__.e(503), __nccwpck_require__.e(153)]).then(__nccwpck_require__.bind(__nccwpck_require__, 43153));
16204
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(33), __nccwpck_require__.e(911), __nccwpck_require__.e(678), __nccwpck_require__.e(9), __nccwpck_require__.e(947)]).then(__nccwpck_require__.bind(__nccwpck_require__, 32947));
16205
16205
  await command({
16206
16206
  buildContext: getBuildContext({ projectDirPath }),
16207
16207
  cliCommandOptions: {
@@ -16244,7 +16244,7 @@ program
16244
16244
  .task({
16245
16245
  skip,
16246
16246
  handler: async ({ projectDirPath }) => {
16247
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(174), __nccwpck_require__.e(525), __nccwpck_require__.e(375), __nccwpck_require__.e(568), __nccwpck_require__.e(490)]).then(__nccwpck_require__.bind(__nccwpck_require__, 23490));
16247
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(911), __nccwpck_require__.e(9), __nccwpck_require__.e(313)]).then(__nccwpck_require__.bind(__nccwpck_require__, 16932));
16248
16248
  await command({ buildContext: getBuildContext({ projectDirPath }) });
16249
16249
  }
16250
16250
  });
@@ -16256,7 +16256,7 @@ program
16256
16256
  .task({
16257
16257
  skip,
16258
16258
  handler: async ({ projectDirPath }) => {
16259
- const { command } = await __nccwpck_require__.e(/* import() */ 921).then(__nccwpck_require__.bind(__nccwpck_require__, 21921));
16259
+ const { command } = await __nccwpck_require__.e(/* import() */ 780).then(__nccwpck_require__.bind(__nccwpck_require__, 75780));
16260
16260
  await command({ buildContext: getBuildContext({ projectDirPath }) });
16261
16261
  }
16262
16262
  });
@@ -16268,7 +16268,7 @@ program
16268
16268
  .task({
16269
16269
  skip,
16270
16270
  handler: async ({ projectDirPath }) => {
16271
- const { command } = await __nccwpck_require__.e(/* import() */ 840).then(__nccwpck_require__.bind(__nccwpck_require__, 48840));
16271
+ const { command } = await __nccwpck_require__.e(/* import() */ 355).then(__nccwpck_require__.bind(__nccwpck_require__, 60355));
16272
16272
  await command({ buildContext: getBuildContext({ projectDirPath }) });
16273
16273
  }
16274
16274
  });
@@ -16321,7 +16321,7 @@ program
16321
16321
  .task({
16322
16322
  skip,
16323
16323
  handler: async ({ projectDirPath }) => {
16324
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(174), __nccwpck_require__.e(363), __nccwpck_require__.e(946)]).then(__nccwpck_require__.bind(__nccwpck_require__, 74946));
16324
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(33), __nccwpck_require__.e(363), __nccwpck_require__.e(946)]).then(__nccwpck_require__.bind(__nccwpck_require__, 74946));
16325
16325
  await command({ buildContext: getBuildContext({ projectDirPath }) });
16326
16326
  }
16327
16327
  });
@@ -16374,7 +16374,7 @@ program
16374
16374
  .task({
16375
16375
  skip,
16376
16376
  handler: async ({ projectDirPath, path, revert }) => {
16377
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(174), __nccwpck_require__.e(363), __nccwpck_require__.e(930)]).then(__nccwpck_require__.bind(__nccwpck_require__, 71930));
16377
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(33), __nccwpck_require__.e(363), __nccwpck_require__.e(930)]).then(__nccwpck_require__.bind(__nccwpck_require__, 71930));
16378
16378
  await command({
16379
16379
  buildContext: getBuildContext({ projectDirPath }),
16380
16380
  cliCommandOptions: { path, isRevert: revert }
@@ -0,0 +1 @@
1
+ export * from "./initializeSpa";
@@ -0,0 +1,9 @@
1
+ import { type BuildContextLike as BuildContextLike_addSyncExtensionsToPostinstallScript } from "./addSyncExtensionsToPostinstallScript";
2
+ export type BuildContextLike = BuildContextLike_addSyncExtensionsToPostinstallScript & {
3
+ themeSrcDirPath: string;
4
+ packageJsonFilePath: string;
5
+ };
6
+ export declare function initializeSpa(params: {
7
+ themeType: "account" | "admin";
8
+ buildContext: BuildContextLike;
9
+ }): Promise<void>;
@@ -1,5 +1,4 @@
1
1
  export declare function getInstalledModuleDirPath(params: {
2
2
  moduleName: string;
3
3
  packageJsonDirPath: string;
4
- projectDirPath: string;
5
4
  }): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function getIsRootPath(filePath: string): boolean;
@@ -1,6 +1,5 @@
1
1
  export declare function listInstalledModules(params: {
2
2
  packageJsonFilePath: string;
3
- projectDirPath: string;
4
3
  filter: (params: {
5
4
  moduleName: string;
6
5
  }) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.6.2",
3
+ "version": "11.7.0",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -648,17 +648,12 @@
648
648
  "src/bin/add-story.ts",
649
649
  "src/bin/copy-keycloak-resources-to-public.ts",
650
650
  "src/bin/eject-page.ts",
651
- "src/bin/initialize-account-theme/copyBoilerplate.ts",
652
651
  "src/bin/initialize-account-theme/index.ts",
653
652
  "src/bin/initialize-account-theme/initialize-account-theme.ts",
654
- "src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts",
655
- "src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts",
656
- "src/bin/initialize-account-theme/src/multi-page/KcContext.ts",
657
- "src/bin/initialize-account-theme/src/multi-page/KcPage.tsx",
658
- "src/bin/initialize-account-theme/src/multi-page/KcPageStory.tsx",
659
- "src/bin/initialize-account-theme/src/multi-page/i18n.ts",
660
- "src/bin/initialize-account-theme/src/single-page/KcContext.ts",
661
- "src/bin/initialize-account-theme/src/single-page/KcPage.tsx",
653
+ "src/bin/initialize-account-theme/multi-page-boilerplate/KcContext.ts",
654
+ "src/bin/initialize-account-theme/multi-page-boilerplate/KcPage.tsx",
655
+ "src/bin/initialize-account-theme/multi-page-boilerplate/KcPageStory.tsx",
656
+ "src/bin/initialize-account-theme/multi-page-boilerplate/i18n.ts",
662
657
  "src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts",
663
658
  "src/bin/initialize-admin-theme.ts",
664
659
  "src/bin/initialize-email-theme.ts",
@@ -686,15 +681,15 @@
686
681
  "src/bin/main.ts",
687
682
  "src/bin/own.ts",
688
683
  "src/bin/shared/KeycloakVersionRange.ts",
689
- "src/bin/shared/addSyncExtensionsToPostinstallScript.ts",
690
684
  "src/bin/shared/buildContext.ts",
691
685
  "src/bin/shared/constants.ts",
692
686
  "src/bin/shared/customHandler.ts",
693
687
  "src/bin/shared/customHandler_delegate.ts",
694
688
  "src/bin/shared/exitIfUncommittedChanges.ts",
695
- "src/bin/shared/getLatestsSemVersionedTag.ts",
689
+ "src/bin/shared/initializeSpa/addSyncExtensionsToPostinstallScript.ts",
690
+ "src/bin/shared/initializeSpa/index.ts",
691
+ "src/bin/shared/initializeSpa/initializeSpa.ts",
696
692
  "src/bin/shared/metaInfKeycloakThemes.ts",
697
- "src/bin/shared/promptKeycloakVersion.ts",
698
693
  "src/bin/start-keycloak/appBuild.ts",
699
694
  "src/bin/start-keycloak/getSupportedDockerImageTags.ts",
700
695
  "src/bin/start-keycloak/index.ts",
@@ -727,7 +722,6 @@
727
722
  "src/bin/sync-extensions/installExtensionModulesPeerDependencies.ts",
728
723
  "src/bin/sync-extensions/managedGitignoreFile.ts",
729
724
  "src/bin/sync-extensions/sync-extension.ts",
730
- "src/bin/tools/OptionalIfCanBeUndefined.ts",
731
725
  "src/bin/tools/SemVer.ts",
732
726
  "src/bin/tools/String.prototype.replaceAll.ts",
733
727
  "src/bin/tools/Stringifyable.ts",
@@ -735,9 +729,7 @@
735
729
  "src/bin/tools/canonicalStringify.ts",
736
730
  "src/bin/tools/crawl.ts",
737
731
  "src/bin/tools/crawlAsync.ts",
738
- "src/bin/tools/crc32.ts",
739
732
  "src/bin/tools/createObjectThatThrowsIfAccessed.ts",
740
- "src/bin/tools/deflate.ts",
741
733
  "src/bin/tools/downloadAndExtractArchive.ts",
742
734
  "src/bin/tools/escapeStringForPropertiesFile.ts",
743
735
  "src/bin/tools/extractArchive.ts",
@@ -750,18 +742,15 @@
750
742
  "src/bin/tools/getThisCodebaseRootDirPath.ts",
751
743
  "src/bin/tools/isInside.ts",
752
744
  "src/bin/tools/isKnownByGit.ts",
745
+ "src/bin/tools/isRootPath.ts",
753
746
  "src/bin/tools/kebabCaseToSnakeCase.ts",
754
747
  "src/bin/tools/listInstalledModules.ts",
755
748
  "src/bin/tools/nodeModulesBinDirPath.ts",
756
749
  "src/bin/tools/npmInstall.ts",
757
- "src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts",
758
- "src/bin/tools/octokit-addons/listTags.ts",
759
750
  "src/bin/tools/partitionPromiseSettledResults.ts",
760
751
  "src/bin/tools/readThisNpmPackageVersion.ts",
761
752
  "src/bin/tools/runPrettier.ts",
762
- "src/bin/tools/tee.ts",
763
753
  "src/bin/tools/transformCodebase.ts",
764
- "src/bin/tools/trimIndent.ts",
765
754
  "src/bin/tools/untrackFromGit.ts",
766
755
  "src/bin/tsconfig.json",
767
756
  "src/bin/update-kc-gen.ts",
@@ -1037,11 +1026,8 @@
1037
1026
  "bin/add-story.d.ts",
1038
1027
  "bin/copy-keycloak-resources-to-public.d.ts",
1039
1028
  "bin/eject-page.d.ts",
1040
- "bin/initialize-account-theme/copyBoilerplate.d.ts",
1041
1029
  "bin/initialize-account-theme/index.d.ts",
1042
1030
  "bin/initialize-account-theme/initialize-account-theme.d.ts",
1043
- "bin/initialize-account-theme/initializeAccountTheme_multiPage.d.ts",
1044
- "bin/initialize-account-theme/initializeAccountTheme_singlePage.d.ts",
1045
1031
  "bin/initialize-account-theme/updateAccountThemeImplementationInConfig.d.ts",
1046
1032
  "bin/initialize-admin-theme.d.ts",
1047
1033
  "bin/initialize-email-theme.d.ts",
@@ -1067,16 +1053,16 @@
1067
1053
  "bin/keycloakify/replacers/replaceImportsInJsCode/webpack.d.ts",
1068
1054
  "bin/main.d.ts",
1069
1055
  "bin/own.d.ts",
1070
- "bin/shared/addSyncExtensionsToPostinstallScript.d.ts",
1071
1056
  "bin/shared/buildContext.d.ts",
1072
1057
  "bin/shared/constants.d.ts",
1073
1058
  "bin/shared/customHandler_delegate.d.ts",
1074
1059
  "bin/shared/customHandler.d.ts",
1075
1060
  "bin/shared/exitIfUncommittedChanges.d.ts",
1076
- "bin/shared/getLatestsSemVersionedTag.d.ts",
1061
+ "bin/shared/initializeSpa/addSyncExtensionsToPostinstallScript.d.ts",
1062
+ "bin/shared/initializeSpa/index.d.ts",
1063
+ "bin/shared/initializeSpa/initializeSpa.d.ts",
1077
1064
  "bin/shared/KeycloakVersionRange.d.ts",
1078
1065
  "bin/shared/metaInfKeycloakThemes.d.ts",
1079
- "bin/shared/promptKeycloakVersion.d.ts",
1080
1066
  "bin/start-keycloak/appBuild.d.ts",
1081
1067
  "bin/start-keycloak/getSupportedDockerImageTags.d.ts",
1082
1068
  "bin/start-keycloak/index.d.ts",
@@ -1103,9 +1089,7 @@
1103
1089
  "bin/tools/canonicalStringify.d.ts",
1104
1090
  "bin/tools/crawl.d.ts",
1105
1091
  "bin/tools/crawlAsync.d.ts",
1106
- "bin/tools/crc32.d.ts",
1107
1092
  "bin/tools/createObjectThatThrowsIfAccessed.d.ts",
1108
- "bin/tools/deflate.d.ts",
1109
1093
  "bin/tools/downloadAndExtractArchive.d.ts",
1110
1094
  "bin/tools/escapeStringForPropertiesFile.d.ts",
1111
1095
  "bin/tools/extractArchive.d.ts",
@@ -1118,49 +1102,43 @@
1118
1102
  "bin/tools/getThisCodebaseRootDirPath.d.ts",
1119
1103
  "bin/tools/isInside.d.ts",
1120
1104
  "bin/tools/isKnownByGit.d.ts",
1105
+ "bin/tools/isRootPath.d.ts",
1121
1106
  "bin/tools/kebabCaseToSnakeCase.d.ts",
1122
1107
  "bin/tools/listInstalledModules.d.ts",
1123
1108
  "bin/tools/nodeModulesBinDirPath.d.ts",
1124
1109
  "bin/tools/npmInstall.d.ts",
1125
- "bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts",
1126
- "bin/tools/octokit-addons/listTags.d.ts",
1127
- "bin/tools/OptionalIfCanBeUndefined.d.ts",
1128
1110
  "bin/tools/partitionPromiseSettledResults.d.ts",
1129
1111
  "bin/tools/readThisNpmPackageVersion.d.ts",
1130
1112
  "bin/tools/runPrettier.d.ts",
1131
1113
  "bin/tools/SemVer.d.ts",
1132
1114
  "bin/tools/String.prototype.replaceAll.d.ts",
1133
1115
  "bin/tools/Stringifyable.d.ts",
1134
- "bin/tools/tee.d.ts",
1135
1116
  "bin/tools/transformCodebase.d.ts",
1136
- "bin/tools/trimIndent.d.ts",
1137
1117
  "bin/tools/untrackFromGit.d.ts",
1138
1118
  "bin/update-kc-gen.d.ts",
1139
1119
  "bin/main.js",
1140
- "bin/153.index.js",
1141
- "bin/174.index.js",
1142
1120
  "bin/266.index.js",
1121
+ "bin/288.index.js",
1143
1122
  "bin/304.index.js",
1123
+ "bin/313.index.js",
1124
+ "bin/33.index.js",
1125
+ "bin/355.index.js",
1144
1126
  "bin/363.index.js",
1145
- "bin/375.index.js",
1146
1127
  "bin/40.index.js",
1147
1128
  "bin/453.index.js",
1148
- "bin/490.index.js",
1149
- "bin/503.index.js",
1150
- "bin/525.index.js",
1151
- "bin/568.index.js",
1152
1129
  "bin/658.index.js",
1130
+ "bin/678.index.js",
1153
1131
  "bin/720.index.js",
1154
- "bin/735.index.js",
1155
- "bin/743.index.js",
1132
+ "bin/780.index.js",
1156
1133
  "bin/783.index.js",
1157
1134
  "bin/786.index.js",
1158
- "bin/840.index.js",
1159
1135
  "bin/877.index.js",
1160
1136
  "bin/880.index.js",
1161
- "bin/921.index.js",
1137
+ "bin/9.index.js",
1138
+ "bin/911.index.js",
1162
1139
  "bin/930.index.js",
1163
1140
  "bin/946.index.js",
1141
+ "bin/947.index.js",
1164
1142
  "bin/97.index.js",
1165
1143
  "bin/shared/constants.js",
1166
1144
  "bin/shared/constants.js.map",
@@ -11,12 +11,7 @@ import {
11
11
  } from "./shared/constants";
12
12
  import { capitalize } from "tsafe/capitalize";
13
13
  import * as fs from "fs";
14
- import {
15
- join as pathJoin,
16
- relative as pathRelative,
17
- dirname as pathDirname,
18
- basename as pathBasename
19
- } from "path";
14
+ import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
20
15
  import { kebabCaseToCamelCase } from "./tools/kebabCaseToSnakeCase";
21
16
  import { assert, Equals } from "tsafe/assert";
22
17
  import type { BuildContext } from "./shared/buildContext";
@@ -77,85 +72,16 @@ export async function command(params: { buildContext: BuildContext }) {
77
72
  (assert(buildContext.implementedThemeTypes.account.isImplemented),
78
73
  buildContext.implementedThemeTypes.account.type === "Single-Page")
79
74
  ) {
80
- const srcDirPath = pathJoin(
81
- pathDirname(buildContext.packageJsonFilePath),
82
- "node_modules",
83
- "@keycloakify",
84
- `keycloak-account-ui`,
85
- "src"
86
- );
87
-
88
75
  console.log(
89
- [
90
- `There isn't an interactive CLI to eject components of the Account SPA UI.`,
91
- `You can however copy paste into your codebase the any file or directory from the following source directory:`,
92
- ``,
93
- `${chalk.bold(pathJoin(pathRelative(process.cwd(), srcDirPath)))}`,
94
- ``
95
- ].join("\n")
96
- );
97
-
98
- eject_entrypoint: {
99
- const kcUiTsxFileRelativePath = `KcAccountUi.tsx` as const;
100
-
101
- const themeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "account");
102
-
103
- const targetFilePath = pathJoin(themeSrcDirPath, kcUiTsxFileRelativePath);
104
-
105
- if (fs.existsSync(targetFilePath)) {
106
- break eject_entrypoint;
107
- }
108
-
109
- fs.cpSync(pathJoin(srcDirPath, kcUiTsxFileRelativePath), targetFilePath);
110
-
111
- {
112
- const kcPageTsxFilePath = pathJoin(themeSrcDirPath, "KcPage.tsx");
113
-
114
- const kcPageTsxCode = fs.readFileSync(kcPageTsxFilePath).toString("utf8");
115
-
116
- const componentName = pathBasename(kcUiTsxFileRelativePath).replace(
117
- /.tsx$/,
118
- ""
119
- );
120
-
121
- let modifiedKcPageTsxCode = kcPageTsxCode.replace(
122
- `@keycloakify/keycloak-account-ui/${componentName}`,
123
- `./${componentName}`
124
- );
125
-
126
- run_prettier: {
127
- if (!(await getIsPrettierAvailable())) {
128
- break run_prettier;
129
- }
130
-
131
- modifiedKcPageTsxCode = await runPrettier({
132
- filePath: kcPageTsxFilePath,
133
- sourceCode: modifiedKcPageTsxCode
134
- });
135
- }
136
-
137
- fs.writeFileSync(
138
- kcPageTsxFilePath,
139
- Buffer.from(modifiedKcPageTsxCode, "utf8")
140
- );
141
- }
142
-
143
- const routesTsxFilePath = pathRelative(
144
- process.cwd(),
145
- pathJoin(srcDirPath, "routes.tsx")
146
- );
147
-
148
- console.log(
76
+ chalk.yellow(
149
77
  [
150
- `To help you get started ${chalk.bold(pathRelative(process.cwd(), targetFilePath))} has been copied into your project.`,
151
- `The next step is usually to eject ${chalk.bold(routesTsxFilePath)}`,
152
- `with \`cp ${routesTsxFilePath} ${pathRelative(process.cwd(), themeSrcDirPath)}\``,
153
- `then update the import of routes in ${kcUiTsxFileRelativePath}.`
78
+ "You are implementing a Single-Page Account theme.",
79
+ "The eject-page command isn't applicable in this context"
154
80
  ].join("\n")
155
- );
156
- }
81
+ )
82
+ );
157
83
 
158
- process.exit(0);
84
+ process.exit(1);
159
85
  return;
160
86
  }
161
87
 
@@ -7,6 +7,7 @@ import { updateAccountThemeImplementationInConfig } from "./updateAccountThemeIm
7
7
  import { command as updateKcGenCommand } from "../update-kc-gen";
8
8
  import { maybeDelegateCommandToCustomHandler } from "../shared/customHandler_delegate";
9
9
  import { exitIfUncommittedChanges } from "../shared/exitIfUncommittedChanges";
10
+ import { getThisCodebaseRootDirPath } from "../tools/getThisCodebaseRootDirPath";
10
11
 
11
12
  export async function command(params: { buildContext: BuildContext }) {
12
13
  const { buildContext } = params;
@@ -50,24 +51,24 @@ export async function command(params: { buildContext: BuildContext }) {
50
51
 
51
52
  switch (accountThemeType) {
52
53
  case "Multi-Page":
53
- {
54
- const { initializeAccountTheme_multiPage } = await import(
55
- "./initializeAccountTheme_multiPage"
56
- );
57
-
58
- await initializeAccountTheme_multiPage({
59
- accountThemeSrcDirPath
60
- });
61
- }
54
+ fs.cpSync(
55
+ pathJoin(
56
+ getThisCodebaseRootDirPath(),
57
+ "src",
58
+ "bin",
59
+ "initialize-account-theme",
60
+ "multi-page-boilerplate"
61
+ ),
62
+ accountThemeSrcDirPath,
63
+ { recursive: true }
64
+ );
62
65
  break;
63
66
  case "Single-Page":
64
67
  {
65
- const { initializeAccountTheme_singlePage } = await import(
66
- "./initializeAccountTheme_singlePage"
67
- );
68
+ const { initializeSpa } = await import("../shared/initializeSpa");
68
69
 
69
- await initializeAccountTheme_singlePage({
70
- accountThemeSrcDirPath,
70
+ await initializeSpa({
71
+ themeType: "account",
71
72
  buildContext
72
73
  });
73
74
  }
@@ -1,15 +1,8 @@
1
- import { dirname as pathDirname, join as pathJoin, relative as pathRelative } from "path";
2
1
  import type { BuildContext } from "./shared/buildContext";
3
- import * as fs from "fs";
4
2
  import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_delegate";
5
- import { assert, is, type Equals } from "tsafe/assert";
6
- import { id } from "tsafe/id";
7
- import { addSyncExtensionsToPostinstallScript } from "./shared/addSyncExtensionsToPostinstallScript";
8
- import { getIsPrettierAvailable, runPrettier } from "./tools/runPrettier";
9
- import { npmInstall } from "./tools/npmInstall";
10
- import * as child_process from "child_process";
11
- import { z } from "zod";
12
- import chalk from "chalk";
3
+ import { initializeSpa } from "./shared/initializeSpa";
4
+ import { exitIfUncommittedChanges } from "./shared/exitIfUncommittedChanges";
5
+ import { command as updateKcGenCommand } from "./update-kc-gen";
13
6
 
14
7
  export async function command(params: { buildContext: BuildContext }) {
15
8
  const { buildContext } = params;
@@ -23,124 +16,24 @@ export async function command(params: { buildContext: BuildContext }) {
23
16
  return;
24
17
  }
25
18
 
26
- {
27
- const adminThemeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "admin");
28
-
29
- if (
30
- fs.existsSync(adminThemeSrcDirPath) &&
31
- fs.readdirSync(adminThemeSrcDirPath).length > 0
32
- ) {
33
- console.warn(
34
- chalk.red(
35
- `There is already a ${pathRelative(
36
- process.cwd(),
37
- adminThemeSrcDirPath
38
- )} directory in your project. Aborting.`
39
- )
40
- );
41
-
42
- process.exit(-1);
43
- }
44
- }
45
-
46
- const parsedPackageJson = (() => {
47
- type ParsedPackageJson = {
48
- scripts?: Record<string, string | undefined>;
49
- dependencies?: Record<string, string | undefined>;
50
- devDependencies?: Record<string, string | undefined>;
51
- };
52
-
53
- const zParsedPackageJson = (() => {
54
- type TargetType = ParsedPackageJson;
55
-
56
- const zTargetType = z.object({
57
- scripts: z.record(z.union([z.string(), z.undefined()])).optional(),
58
- dependencies: z.record(z.union([z.string(), z.undefined()])).optional(),
59
- devDependencies: z.record(z.union([z.string(), z.undefined()])).optional()
60
- });
61
-
62
- assert<Equals<z.infer<typeof zTargetType>, TargetType>>;
63
-
64
- return id<z.ZodType<TargetType>>(zTargetType);
65
- })();
66
- const parsedPackageJson = JSON.parse(
67
- fs.readFileSync(buildContext.packageJsonFilePath).toString("utf8")
68
- );
69
-
70
- zParsedPackageJson.parse(parsedPackageJson);
71
-
72
- assert(is<ParsedPackageJson>(parsedPackageJson));
73
-
74
- return parsedPackageJson;
75
- })();
19
+ exitIfUncommittedChanges({
20
+ projectDirPath: buildContext.projectDirPath
21
+ });
76
22
 
77
- addSyncExtensionsToPostinstallScript({
78
- parsedPackageJson,
23
+ await initializeSpa({
24
+ themeType: "admin",
79
25
  buildContext
80
26
  });
81
27
 
82
- const uiSharedMajor = (() => {
83
- const dependencies = {
84
- ...parsedPackageJson.devDependencies,
85
- ...parsedPackageJson.dependencies
86
- };
87
-
88
- const version = dependencies["@keycloakify/keycloak-ui-shared"];
89
-
90
- if (version === undefined) {
91
- return undefined;
28
+ await updateKcGenCommand({
29
+ buildContext: {
30
+ ...buildContext,
31
+ implementedThemeTypes: {
32
+ ...buildContext.implementedThemeTypes,
33
+ admin: {
34
+ isImplemented: true
35
+ }
36
+ }
92
37
  }
93
-
94
- const match = version.match(/^[^~]?(\d+)\./);
95
-
96
- if (match === null) {
97
- return undefined;
98
- }
99
-
100
- return match[1];
101
- })();
102
-
103
- const moduleName = "@keycloakify/keycloak-admin-ui";
104
-
105
- const version = (
106
- JSON.parse(
107
- child_process
108
- .execSync(`npm show ${moduleName} versions --json`)
109
- .toString("utf8")
110
- .trim()
111
- ) as string[]
112
- )
113
- .reverse()
114
- .filter(version => !version.includes("-"))
115
- .find(version =>
116
- uiSharedMajor === undefined ? true : version.startsWith(`${uiSharedMajor}.`)
117
- );
118
-
119
- assert(version !== undefined);
120
-
121
- (parsedPackageJson.dependencies ??= {})[moduleName] = `~${version}`;
122
-
123
- if (parsedPackageJson.devDependencies !== undefined) {
124
- delete parsedPackageJson.devDependencies[moduleName];
125
- }
126
-
127
- {
128
- let sourceCode = JSON.stringify(parsedPackageJson, undefined, 2);
129
-
130
- if (await getIsPrettierAvailable()) {
131
- sourceCode = await runPrettier({
132
- sourceCode,
133
- filePath: buildContext.packageJsonFilePath
134
- });
135
- }
136
-
137
- fs.writeFileSync(
138
- buildContext.packageJsonFilePath,
139
- Buffer.from(sourceCode, "utf8")
140
- );
141
- }
142
-
143
- await npmInstall({
144
- packageJsonDirPath: pathDirname(buildContext.packageJsonFilePath)
145
38
  });
146
39
  }
@@ -1,13 +1,11 @@
1
1
  import { join as pathJoin, relative as pathRelative } from "path";
2
2
  import { transformCodebase } from "./tools/transformCodebase";
3
- import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
4
3
  import type { BuildContext } from "./shared/buildContext";
5
4
  import * as fs from "fs";
6
5
  import { downloadAndExtractArchive } from "./tools/downloadAndExtractArchive";
7
6
  import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_delegate";
8
- import fetch from "make-fetch-happen";
9
- import { SemVer } from "./tools/SemVer";
10
7
  import { assert } from "tsafe/assert";
8
+ import { getSupportedDockerImageTags } from "./start-keycloak/getSupportedDockerImageTags";
11
9
 
12
10
  export async function command(params: { buildContext: BuildContext }) {
13
11
  const { buildContext } = params;
@@ -39,40 +37,18 @@ export async function command(params: { buildContext: BuildContext }) {
39
37
 
40
38
  console.log("Initialize with the base email theme from which version of Keycloak?");
41
39
 
42
- let { keycloakVersion } = await promptKeycloakVersion({
43
- // NOTE: This is arbitrary
44
- startingFromMajor: 17,
45
- excludeMajorVersions: [],
46
- doOmitPatch: false,
47
- buildContext
48
- });
49
-
50
- const getUrl = (keycloakVersion: string) => {
51
- return `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`;
52
- };
53
-
54
- keycloakVersion = await (async () => {
55
- const keycloakVersionParsed = SemVer.parse(keycloakVersion);
56
-
57
- while (true) {
58
- const url = getUrl(SemVer.stringify(keycloakVersionParsed));
59
-
60
- const response = await fetch(url, buildContext.fetchOptions);
61
-
62
- if (response.ok) {
63
- break;
64
- }
65
-
66
- assert(keycloakVersionParsed.patch !== 0);
40
+ const { extractedDirPath } = await downloadAndExtractArchive({
41
+ url: await (async () => {
42
+ const { latestMajorTags } = await getSupportedDockerImageTags({
43
+ buildContext
44
+ });
67
45
 
68
- keycloakVersionParsed.patch--;
69
- }
46
+ const keycloakVersion = latestMajorTags[0];
70
47
 
71
- return SemVer.stringify(keycloakVersionParsed);
72
- })();
48
+ assert(keycloakVersion !== undefined);
73
49
 
74
- const { extractedDirPath } = await downloadAndExtractArchive({
75
- url: getUrl(keycloakVersion),
50
+ return `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`;
51
+ })(),
76
52
  cacheDirPath: buildContext.cacheDirPath,
77
53
  fetchOptions: buildContext.fetchOptions,
78
54
  uniqueIdOfOnArchiveFile: "extractOnlyEmailTheme",