keycloakify 10.0.0-rc.1 → 10.0.0-rc.12

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 (431) hide show
  1. package/PUBLIC_URL.js +1 -1
  2. package/PUBLIC_URL.js.map +1 -1
  3. package/account/Fallback.js +3 -0
  4. package/account/Fallback.js.map +1 -1
  5. package/account/Template.js +2 -2
  6. package/account/Template.js.map +1 -1
  7. package/account/i18n/baseMessages/index.js.map +1 -1
  8. package/account/i18n/i18n.d.ts +3 -4
  9. package/account/i18n/i18n.js +3 -4
  10. package/account/i18n/i18n.js.map +1 -1
  11. package/account/index.d.ts +1 -1
  12. package/account/kcContext/KcContext.d.ts +62 -59
  13. package/account/kcContext/KcContext.js.map +1 -1
  14. package/account/kcContext/createGetKcContext.d.ts +3 -3
  15. package/account/kcContext/createGetKcContext.js.map +1 -1
  16. package/account/kcContext/getKcContextFromWindow.js +1 -1
  17. package/account/kcContext/getKcContextFromWindow.js.map +1 -1
  18. package/account/kcContext/kcContextMocks.js +22 -14
  19. package/account/kcContext/kcContextMocks.js.map +1 -1
  20. package/account/pages/Account.js +1 -1
  21. package/account/pages/Account.js.map +1 -1
  22. package/account/pages/Applications.js +3 -3
  23. package/account/pages/Applications.js.map +1 -1
  24. package/account/pages/FederatedIdentity.d.ts +7 -0
  25. package/account/pages/FederatedIdentity.js +8 -0
  26. package/account/pages/FederatedIdentity.js.map +1 -0
  27. package/account/pages/Log.js +2 -2
  28. package/account/pages/Log.js.map +1 -1
  29. package/account/pages/Password.js +4 -6
  30. package/account/pages/Password.js.map +1 -1
  31. package/account/pages/Sessions.js +1 -5
  32. package/account/pages/Sessions.js.map +1 -1
  33. package/account/pages/Totp.js +2 -2
  34. package/account/pages/Totp.js.map +1 -1
  35. package/bin/246.index.js +466 -0
  36. package/bin/420.index.js +508 -0
  37. package/bin/509.index.js +438 -0
  38. package/bin/772.index.js +1524 -0
  39. package/bin/copy-keycloak-resources-to-public.d.ts +3 -13
  40. package/bin/copy-keycloak-resources-to-public.js +22 -166
  41. package/bin/copy-keycloak-resources-to-public.js.map +1 -1
  42. package/bin/download-builtin-keycloak-theme.d.ts +3 -9
  43. package/bin/download-builtin-keycloak-theme.js +16 -292
  44. package/bin/download-builtin-keycloak-theme.js.map +1 -1
  45. package/bin/eject-keycloak-page.d.ts +4 -1
  46. package/bin/eject-keycloak-page.js +125 -56
  47. package/bin/eject-keycloak-page.js.map +1 -1
  48. package/bin/initialize-email-theme.d.ts +4 -2
  49. package/bin/initialize-email-theme.js +23 -23
  50. package/bin/initialize-email-theme.js.map +1 -1
  51. package/bin/keycloakify/buildJars/buildJar.d.ts +1 -0
  52. package/bin/keycloakify/buildJars/buildJar.js +14 -25
  53. package/bin/keycloakify/buildJars/buildJar.js.map +1 -1
  54. package/bin/keycloakify/buildJars/buildJars.d.ts +1 -4
  55. package/bin/keycloakify/buildJars/buildJars.js +17 -8
  56. package/bin/keycloakify/buildJars/buildJars.js.map +1 -1
  57. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +2 -1
  58. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +39 -17
  59. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +1 -1
  60. package/bin/keycloakify/generateFtl/generateFtl.d.ts +1 -1
  61. package/bin/keycloakify/generateFtl/generateFtl.js +4 -3
  62. package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
  63. package/bin/keycloakify/generateFtl/index.d.ts +0 -1
  64. package/bin/keycloakify/generateFtl/index.js +0 -1
  65. package/bin/keycloakify/generateFtl/index.js.map +1 -1
  66. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.d.ts +1 -1
  67. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.js +7 -7
  68. package/bin/keycloakify/generateSrcMainResources/bringInAccountV1.js.map +1 -0
  69. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.d.ts +1 -1
  70. package/bin/keycloakify/generateSrcMainResources/generateMessageProperties.js.map +1 -0
  71. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.d.ts +7 -0
  72. package/bin/keycloakify/{generateTheme/generateTheme.js → generateSrcMainResources/generateSrcMainResources.js} +13 -19
  73. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.js.map +1 -0
  74. package/bin/keycloakify/{generateTheme/generateSrcMainResources.d.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.d.ts} +4 -8
  75. package/bin/keycloakify/{generateTheme/generateSrcMainResources.js → generateSrcMainResources/generateSrcMainResourcesForMainTheme.js} +53 -52
  76. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.js.map +1 -0
  77. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.d.ts +8 -0
  78. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js +47 -0
  79. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js.map +1 -0
  80. package/bin/keycloakify/generateSrcMainResources/index.d.ts +1 -0
  81. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/index.js +1 -1
  82. package/bin/keycloakify/generateSrcMainResources/index.js.map +1 -0
  83. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.d.ts +1 -1
  84. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.js +3 -3
  85. package/bin/keycloakify/generateSrcMainResources/readExtraPageNames.js.map +1 -0
  86. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.d.ts +1 -2
  87. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.js +3 -2
  88. package/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.js.map +1 -0
  89. package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +2 -0
  90. package/bin/keycloakify/generateStartKeycloakTestingContainer.js +9 -12
  91. package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
  92. package/bin/keycloakify/index.d.ts +0 -1
  93. package/bin/keycloakify/index.js +0 -5
  94. package/bin/keycloakify/index.js.map +1 -1
  95. package/bin/keycloakify/keycloakify.d.ts +4 -1
  96. package/bin/keycloakify/keycloakify.js +49 -63
  97. package/bin/keycloakify/keycloakify.js.map +1 -1
  98. package/bin/keycloakify/replacers/replaceImportsInCssCode.js +1 -1
  99. package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +1 -1
  100. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +1 -1
  101. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +1 -1
  102. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js.map +1 -1
  103. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js +1 -1
  104. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js.map +1 -1
  105. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js +1 -1
  106. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js.map +1 -1
  107. package/bin/main.d.ts +4 -0
  108. package/bin/main.js +145466 -0
  109. package/bin/main.js.map +1 -0
  110. package/bin/main.original.js +287 -0
  111. package/bin/shared/KeycloakVersionRange.d.ts +5 -0
  112. package/bin/shared/KeycloakVersionRange.js +3 -0
  113. package/bin/shared/KeycloakVersionRange.js.map +1 -0
  114. package/bin/{keycloakify/buildOptions → shared}/buildOptions.d.ts +17 -2
  115. package/bin/{keycloakify/buildOptions → shared}/buildOptions.js +71 -35
  116. package/bin/shared/buildOptions.js.map +1 -0
  117. package/bin/{keycloakify/generateFtl/pageId.d.ts → shared/constants.d.ts} +13 -1
  118. package/bin/{keycloakify/generateFtl/pageId.js → shared/constants.js} +22 -3
  119. package/bin/shared/constants.js.map +1 -0
  120. package/bin/shared/copyKeycloakResourcesToPublic.d.ts +8 -0
  121. package/bin/shared/copyKeycloakResourcesToPublic.js +177 -0
  122. package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -0
  123. package/bin/{downloadAndUnzip.js → shared/downloadAndUnzip.js} +11 -11
  124. package/bin/shared/downloadAndUnzip.js.map +1 -0
  125. package/bin/shared/downloadBuiltinKeycloakTheme.d.ts +9 -0
  126. package/bin/shared/downloadBuiltinKeycloakTheme.js +316 -0
  127. package/bin/shared/downloadBuiltinKeycloakTheme.js.map +1 -0
  128. package/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.d.ts +1 -1
  129. package/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.js +7 -7
  130. package/bin/shared/downloadKeycloakStaticResources.js.map +1 -0
  131. package/bin/shared/getJarFileBasename.d.ts +6 -0
  132. package/bin/shared/getJarFileBasename.js +10 -0
  133. package/bin/shared/getJarFileBasename.js.map +1 -0
  134. package/bin/{getThemeSrcDirPath.js → shared/getThemeSrcDirPath.js} +1 -1
  135. package/bin/shared/getThemeSrcDirPath.js.map +1 -0
  136. package/bin/shared/metaInfKeycloakThemes.d.ts +17 -0
  137. package/bin/shared/metaInfKeycloakThemes.js +51 -0
  138. package/bin/shared/metaInfKeycloakThemes.js.map +1 -0
  139. package/bin/shared/promptKeycloakVersion.d.ts +6 -0
  140. package/bin/shared/promptKeycloakVersion.js +159 -0
  141. package/bin/shared/promptKeycloakVersion.js.map +1 -0
  142. package/bin/start-keycloak.d.ts +8 -0
  143. package/bin/start-keycloak.js +287 -0
  144. package/bin/start-keycloak.js.map +1 -0
  145. package/bin/tools/SemVer.js +1 -1
  146. package/bin/tools/SemVer.js.map +1 -1
  147. package/bin/tools/String.prototype.replaceAll.js.map +1 -1
  148. package/bin/tools/crawl.js.map +1 -1
  149. package/bin/tools/crc32.js.map +1 -1
  150. package/bin/tools/deflate.js +10 -1
  151. package/bin/tools/deflate.js.map +1 -1
  152. package/bin/tools/fetchProxyOptions.js +9 -9
  153. package/bin/tools/fetchProxyOptions.js.map +1 -1
  154. package/bin/tools/fs.rm.js.map +1 -1
  155. package/bin/tools/fs.rmSync.js +4 -4
  156. package/bin/tools/fs.rmSync.js.map +1 -1
  157. package/bin/tools/getAbsoluteAndInOsFormatPath.js +28 -0
  158. package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +1 -1
  159. package/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.js +1 -13
  160. package/bin/tools/getNpmWorkspaceRootDirPath.js.map +1 -0
  161. package/bin/tools/getThisCodebaseRootDirPath.js.map +1 -1
  162. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +21 -24
  163. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +1 -1
  164. package/bin/tools/octokit-addons/listTags.js +3 -2
  165. package/bin/tools/octokit-addons/listTags.js.map +1 -1
  166. package/bin/tools/readThisNpmPackageVersion.d.ts +1 -0
  167. package/bin/tools/{readThisNpmProjectVersion.js → readThisNpmPackageVersion.js} +4 -4
  168. package/bin/tools/{readThisNpmProjectVersion.js.map → readThisNpmPackageVersion.js.map} +1 -1
  169. package/bin/tools/transformCodebase.js.map +1 -1
  170. package/bin/tools/trimIndent.js.map +1 -1
  171. package/bin/tools/unzip.js.map +1 -1
  172. package/bin/tsconfig.tsbuildinfo +1 -0
  173. package/lib/BASE_URL.js.map +1 -1
  174. package/login/Fallback.js.map +1 -1
  175. package/login/Template.js +4 -4
  176. package/login/Template.js.map +1 -1
  177. package/login/UserProfileFormFields.js +17 -19
  178. package/login/UserProfileFormFields.js.map +1 -1
  179. package/login/i18n/baseMessages/index.js.map +1 -1
  180. package/login/i18n/i18n.d.ts +3 -4
  181. package/login/i18n/i18n.js +3 -4
  182. package/login/i18n/i18n.js.map +1 -1
  183. package/login/index.d.ts +1 -1
  184. package/login/kcContext/KcContext.d.ts +1 -0
  185. package/login/kcContext/KcContext.js.map +1 -1
  186. package/login/kcContext/createGetKcContext.d.ts +3 -3
  187. package/login/kcContext/createGetKcContext.js.map +1 -1
  188. package/login/kcContext/getKcContextFromWindow.js +1 -1
  189. package/login/kcContext/getKcContextFromWindow.js.map +1 -1
  190. package/login/kcContext/kcContextMocks.js +3 -2
  191. package/login/kcContext/kcContextMocks.js.map +1 -1
  192. package/login/lib/useDownloadTerms.js.map +1 -1
  193. package/login/lib/useUserProfileForm.js +9 -9
  194. package/login/lib/useUserProfileForm.js.map +1 -1
  195. package/login/pages/Code.js +1 -1
  196. package/login/pages/Code.js.map +1 -1
  197. package/login/pages/DeleteAccountConfirm.js +1 -1
  198. package/login/pages/DeleteAccountConfirm.js.map +1 -1
  199. package/login/pages/DeleteCredential.js +1 -1
  200. package/login/pages/DeleteCredential.js.map +1 -1
  201. package/login/pages/Error.js +1 -1
  202. package/login/pages/Error.js.map +1 -1
  203. package/login/pages/FrontchannelLogout.js +1 -1
  204. package/login/pages/FrontchannelLogout.js.map +1 -1
  205. package/login/pages/IdpReviewUserProfile.js +1 -1
  206. package/login/pages/IdpReviewUserProfile.js.map +1 -1
  207. package/login/pages/Info.js +5 -5
  208. package/login/pages/Info.js.map +1 -1
  209. package/login/pages/Login.js +4 -4
  210. package/login/pages/Login.js.map +1 -1
  211. package/login/pages/LoginConfigTotp.js +2 -10
  212. package/login/pages/LoginConfigTotp.js.map +1 -1
  213. package/login/pages/LoginIdpLinkConfirm.js +1 -1
  214. package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
  215. package/login/pages/LoginIdpLinkEmail.js +1 -1
  216. package/login/pages/LoginIdpLinkEmail.js.map +1 -1
  217. package/login/pages/LoginOauth2DeviceVerifyUserCode.js +1 -1
  218. package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
  219. package/login/pages/LoginOauthGrant.js +2 -2
  220. package/login/pages/LoginOauthGrant.js.map +1 -1
  221. package/login/pages/LoginOtp.js +1 -1
  222. package/login/pages/LoginOtp.js.map +1 -1
  223. package/login/pages/LoginPageExpired.js +1 -1
  224. package/login/pages/LoginPageExpired.js.map +1 -1
  225. package/login/pages/LoginPassword.js +3 -3
  226. package/login/pages/LoginPassword.js.map +1 -1
  227. package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
  228. package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
  229. package/login/pages/LoginRecoveryAuthnCodeInput.js +1 -1
  230. package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
  231. package/login/pages/LoginResetOtp.js +1 -1
  232. package/login/pages/LoginResetOtp.js.map +1 -1
  233. package/login/pages/LoginResetPassword.js +2 -2
  234. package/login/pages/LoginResetPassword.js.map +1 -1
  235. package/login/pages/LoginUpdatePassword.js +3 -3
  236. package/login/pages/LoginUpdatePassword.js.map +1 -1
  237. package/login/pages/LoginUpdateProfile.js +2 -4
  238. package/login/pages/LoginUpdateProfile.js.map +1 -1
  239. package/login/pages/LoginUsername.js +3 -3
  240. package/login/pages/LoginUsername.js.map +1 -1
  241. package/login/pages/LoginVerifyEmail.js +1 -1
  242. package/login/pages/LoginVerifyEmail.js.map +1 -1
  243. package/login/pages/LoginX509Info.js +1 -1
  244. package/login/pages/LoginX509Info.js.map +1 -1
  245. package/login/pages/LogoutConfirm.js +1 -1
  246. package/login/pages/LogoutConfirm.js.map +1 -1
  247. package/login/pages/Register.js +4 -8
  248. package/login/pages/Register.js.map +1 -1
  249. package/login/pages/SamlPostForm.js +1 -1
  250. package/login/pages/SamlPostForm.js.map +1 -1
  251. package/login/pages/SelectAuthenticator.js +2 -2
  252. package/login/pages/SelectAuthenticator.js.map +1 -1
  253. package/login/pages/Terms.js +1 -1
  254. package/login/pages/Terms.js.map +1 -1
  255. package/login/pages/UpdateEmail.js +3 -5
  256. package/login/pages/UpdateEmail.js.map +1 -1
  257. package/login/pages/WebauthnAuthenticate.js +6 -6
  258. package/login/pages/WebauthnAuthenticate.js.map +1 -1
  259. package/login/pages/WebauthnError.js +2 -2
  260. package/login/pages/WebauthnError.js.map +1 -1
  261. package/login/pages/WebauthnRegister.js +3 -3
  262. package/login/pages/WebauthnRegister.js.map +1 -1
  263. package/package.json +9760 -1155
  264. package/src/PUBLIC_URL.ts +1 -1
  265. package/src/account/Fallback.tsx +3 -0
  266. package/src/account/Template.tsx +2 -5
  267. package/src/account/i18n/i18n.tsx +5 -8
  268. package/src/account/index.ts +1 -1
  269. package/src/account/kcContext/KcContext.ts +72 -62
  270. package/src/account/kcContext/getKcContextFromWindow.ts +1 -1
  271. package/src/account/kcContext/kcContextMocks.ts +21 -15
  272. package/src/account/pages/Applications.tsx +2 -2
  273. package/src/account/pages/FederatedIdentity.tsx +58 -0
  274. package/src/account/pages/Log.tsx +1 -1
  275. package/src/account/pages/Sessions.tsx +0 -3
  276. package/src/account/pages/Totp.tsx +20 -21
  277. package/src/bin/copy-keycloak-resources-to-public.ts +10 -106
  278. package/src/bin/download-builtin-keycloak-theme.ts +14 -274
  279. package/src/bin/eject-keycloak-page.ts +81 -19
  280. package/src/bin/initialize-email-theme.ts +22 -21
  281. package/src/bin/keycloakify/buildJars/buildJar.ts +13 -17
  282. package/src/bin/keycloakify/buildJars/buildJars.ts +14 -15
  283. package/src/bin/keycloakify/buildJars/generatePom.ts +1 -1
  284. package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +45 -18
  285. package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +160 -232
  286. package/src/bin/keycloakify/generateFtl/generateFtl.ts +7 -4
  287. package/src/bin/keycloakify/generateFtl/index.ts +0 -1
  288. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.ts +8 -7
  289. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.ts +1 -1
  290. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +32 -0
  291. package/src/bin/keycloakify/{generateTheme/generateSrcMainResources.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts} +40 -46
  292. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +56 -0
  293. package/src/bin/keycloakify/generateSrcMainResources/index.ts +1 -0
  294. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.ts +1 -2
  295. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.ts +5 -4
  296. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +14 -15
  297. package/src/bin/keycloakify/index.ts +0 -7
  298. package/src/bin/keycloakify/keycloakify.ts +50 -67
  299. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +2 -2
  300. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +2 -2
  301. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +1 -1
  302. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +2 -2
  303. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +2 -2
  304. package/src/bin/main.ts +175 -0
  305. package/src/bin/shared/KeycloakVersionRange.ts +7 -0
  306. package/src/bin/{keycloakify/buildOptions → shared}/buildOptions.ts +113 -25
  307. package/src/bin/{keycloakify/generateFtl/pageId.ts → shared/constants.ts} +25 -1
  308. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +90 -0
  309. package/src/bin/{downloadAndUnzip.ts → shared/downloadAndUnzip.ts} +6 -6
  310. package/src/bin/shared/downloadBuiltinKeycloakTheme.ts +264 -0
  311. package/src/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.ts +8 -8
  312. package/src/bin/shared/getJarFileBasename.ts +9 -0
  313. package/src/bin/{getThemeSrcDirPath.ts → shared/getThemeSrcDirPath.ts} +1 -1
  314. package/src/bin/shared/metaInfKeycloakThemes.ts +34 -0
  315. package/src/bin/shared/promptKeycloakVersion.ts +106 -0
  316. package/src/bin/start-keycloak.ts +236 -0
  317. package/src/bin/tools/fs.rmSync.ts +4 -4
  318. package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +8 -1
  319. package/src/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.ts +1 -23
  320. package/src/bin/tools/{readThisNpmProjectVersion.ts → readThisNpmPackageVersion.ts} +1 -1
  321. package/src/login/Template.tsx +6 -22
  322. package/src/login/UserProfileFormFields.tsx +2 -5
  323. package/src/login/i18n/i18n.tsx +5 -8
  324. package/src/login/index.ts +1 -1
  325. package/src/login/kcContext/KcContext.ts +2 -2
  326. package/src/login/kcContext/getKcContextFromWindow.ts +1 -1
  327. package/src/login/kcContext/kcContextMocks.ts +3 -3
  328. package/src/login/lib/useUserProfileForm.tsx +10 -10
  329. package/src/login/pages/Code.tsx +1 -1
  330. package/src/login/pages/IdpReviewUserProfile.tsx +1 -1
  331. package/src/login/pages/Login.tsx +1 -1
  332. package/src/login/pages/LoginConfigTotp.tsx +1 -9
  333. package/src/login/pages/LoginUpdateProfile.tsx +1 -1
  334. package/src/login/pages/LoginUsername.tsx +1 -1
  335. package/src/login/pages/Register.tsx +1 -1
  336. package/src/login/pages/UpdateEmail.tsx +1 -1
  337. package/src/login/pages/WebauthnRegister.tsx +1 -1
  338. package/src/vite-plugin/tsconfig.json +2 -1
  339. package/src/vite-plugin/vite-plugin.ts +29 -41
  340. package/tools/Array.prototype.every.js.map +1 -1
  341. package/tools/HTMLElement.prototype.prepend.js.map +1 -1
  342. package/tools/clsx.js.map +1 -1
  343. package/tools/deepAssign.js.map +1 -1
  344. package/tools/deepClone.js.map +1 -1
  345. package/tools/formatNumber.js.map +1 -1
  346. package/tools/memoize.js.map +1 -1
  347. package/tools/useInsertLinkTags.js.map +1 -1
  348. package/tools/useInsertScriptTags.js.map +1 -1
  349. package/tools/useSetClassName.js.map +1 -1
  350. package/tsconfig.tsbuildinfo +1 -0
  351. package/vite-plugin/index.js +50851 -3
  352. package/{bin/keycloakify/buildOptions/index.js → vite-plugin/index.original.js} +1 -2
  353. package/vite-plugin/tsconfig.tsbuildinfo +1 -1
  354. package/vite-plugin/vite-plugin.d.ts +1 -2
  355. package/vite-plugin/vite-plugin.js +30 -52
  356. package/bin/constants.d.ts +0 -10
  357. package/bin/constants.js +0 -13
  358. package/bin/constants.js.map +0 -1
  359. package/bin/downloadAndUnzip.js.map +0 -1
  360. package/bin/getThemeSrcDirPath.js.map +0 -1
  361. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.d.ts +0 -35
  362. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js +0 -14
  363. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js.map +0 -1
  364. package/bin/keycloakify/buildOptions/buildOptions.js.map +0 -1
  365. package/bin/keycloakify/buildOptions/getCacheDirPath.d.ts +0 -5
  366. package/bin/keycloakify/buildOptions/getCacheDirPath.js +0 -22
  367. package/bin/keycloakify/buildOptions/getCacheDirPath.js.map +0 -1
  368. package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js.map +0 -1
  369. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.d.ts +0 -5
  370. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js +0 -26
  371. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js.map +0 -1
  372. package/bin/keycloakify/buildOptions/index.d.ts +0 -1
  373. package/bin/keycloakify/buildOptions/index.js.map +0 -1
  374. package/bin/keycloakify/buildOptions/parsedPackageJson.d.ts +0 -10
  375. package/bin/keycloakify/buildOptions/parsedPackageJson.js +0 -49
  376. package/bin/keycloakify/buildOptions/parsedPackageJson.js.map +0 -1
  377. package/bin/keycloakify/buildOptions/resolvedViteConfig.d.ts +0 -13
  378. package/bin/keycloakify/buildOptions/resolvedViteConfig.js +0 -77
  379. package/bin/keycloakify/buildOptions/resolvedViteConfig.js.map +0 -1
  380. package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +0 -593
  381. package/bin/keycloakify/generateFtl/pageId.js.map +0 -1
  382. package/bin/keycloakify/generateTheme/bringInAccountV1.js.map +0 -1
  383. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +0 -1
  384. package/bin/keycloakify/generateTheme/generateMessageProperties.js.map +0 -1
  385. package/bin/keycloakify/generateTheme/generateSrcMainResources.js.map +0 -1
  386. package/bin/keycloakify/generateTheme/generateTheme.d.ts +0 -13
  387. package/bin/keycloakify/generateTheme/generateTheme.js.map +0 -1
  388. package/bin/keycloakify/generateTheme/generateThemeVariants.d.ts +0 -5
  389. package/bin/keycloakify/generateTheme/generateThemeVariants.js +0 -67
  390. package/bin/keycloakify/generateTheme/generateThemeVariants.js.map +0 -1
  391. package/bin/keycloakify/generateTheme/index.d.ts +0 -1
  392. package/bin/keycloakify/generateTheme/index.js.map +0 -1
  393. package/bin/keycloakify/generateTheme/readExtraPageNames.js.map +0 -1
  394. package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +0 -1
  395. package/bin/promptKeycloakVersion.d.ts +0 -3
  396. package/bin/promptKeycloakVersion.js +0 -121
  397. package/bin/promptKeycloakVersion.js.map +0 -1
  398. package/bin/tools/grant-exec-perms.d.ts +0 -1
  399. package/bin/tools/grant-exec-perms.js +0 -100
  400. package/bin/tools/grant-exec-perms.js.map +0 -1
  401. package/bin/tools/logger.d.ts +0 -12
  402. package/bin/tools/logger.js +0 -23
  403. package/bin/tools/logger.js.map +0 -1
  404. package/bin/tools/readThisNpmProjectVersion.d.ts +0 -1
  405. package/index.d.ts +0 -1
  406. package/index.js +0 -2
  407. package/index.js.map +0 -1
  408. package/lib/keycloakJsAdapter.d.ts +0 -51
  409. package/lib/keycloakJsAdapter.js +0 -74
  410. package/lib/keycloakJsAdapter.js.map +0 -1
  411. package/src/bin/constants.ts +0 -13
  412. package/src/bin/keycloakify/buildOptions/UserProvidedBuildOptions.ts +0 -21
  413. package/src/bin/keycloakify/buildOptions/getCacheDirPath.ts +0 -25
  414. package/src/bin/keycloakify/buildOptions/getReactAppRootDirPath.ts +0 -23
  415. package/src/bin/keycloakify/buildOptions/index.ts +0 -1
  416. package/src/bin/keycloakify/buildOptions/parsedPackageJson.ts +0 -32
  417. package/src/bin/keycloakify/buildOptions/resolvedViteConfig.ts +0 -74
  418. package/src/bin/keycloakify/generateTheme/generateTheme.ts +0 -44
  419. package/src/bin/keycloakify/generateTheme/generateThemeVariants.ts +0 -50
  420. package/src/bin/keycloakify/generateTheme/index.ts +0 -1
  421. package/src/bin/promptKeycloakVersion.ts +0 -49
  422. package/src/bin/tools/grant-exec-perms.ts +0 -19
  423. package/src/bin/tools/logger.ts +0 -27
  424. package/src/index.ts +0 -1
  425. package/src/lib/keycloakJsAdapter.ts +0 -118
  426. package/vite-plugin/index.js.map +0 -1
  427. package/vite-plugin/vite-plugin.js.map +0 -1
  428. /package/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.js +0 -0
  429. /package/bin/{downloadAndUnzip.d.ts → shared/downloadAndUnzip.d.ts} +0 -0
  430. /package/bin/{getThemeSrcDirPath.d.ts → shared/getThemeSrcDirPath.d.ts} +0 -0
  431. /package/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.d.ts +0 -0
@@ -1,112 +1,16 @@
1
- #!/usr/bin/env node
1
+ import { copyKeycloakResourcesToPublic } from "./shared/copyKeycloakResourcesToPublic";
2
+ import { readBuildOptions } from "./shared/buildOptions";
3
+ import type { CliCommandOptions } from "./main";
2
4
 
3
- import { downloadKeycloakStaticResources, type BuildOptionsLike } from "./keycloakify/generateTheme/downloadKeycloakStaticResources";
4
- import { join as pathJoin, relative as pathRelative } from "path";
5
- import { readBuildOptions } from "./keycloakify/buildOptions";
6
- import { themeTypes, keycloak_resources, lastKeycloakVersionWithAccountV1 } from "./constants";
7
- import { readThisNpmProjectVersion } from "./tools/readThisNpmProjectVersion";
8
- import { assert, type Equals } from "tsafe/assert";
9
- import * as fs from "fs";
10
- import { rmSync } from "./tools/fs.rmSync";
5
+ export async function command(params: { cliCommandOptions: CliCommandOptions }) {
6
+ const { cliCommandOptions } = params;
11
7
 
12
- export async function copyKeycloakResourcesToPublic(params: { processArgv: string[] }) {
13
- const { processArgv } = params;
8
+ const buildOptions = readBuildOptions({ cliCommandOptions });
14
9
 
15
- const buildOptions = readBuildOptions({ processArgv });
16
-
17
- const destDirPath = pathJoin(buildOptions.publicDirPath, keycloak_resources);
18
-
19
- const keycloakifyBuildinfoFilePath = pathJoin(destDirPath, "keycloakify.buildinfo");
20
-
21
- const { keycloakifyBuildinfoRaw } = generateKeycloakifyBuildinfoRaw({
22
- destDirPath,
23
- "keycloakifyVersion": readThisNpmProjectVersion(),
24
- buildOptions
25
- });
26
-
27
- skip_if_already_done: {
28
- if (!fs.existsSync(keycloakifyBuildinfoFilePath)) {
29
- break skip_if_already_done;
30
- }
31
-
32
- const keycloakifyBuildinfoRaw_previousRun = fs.readFileSync(keycloakifyBuildinfoFilePath).toString("utf8");
33
-
34
- if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
35
- break skip_if_already_done;
36
- }
37
-
38
- return;
39
- }
40
-
41
- rmSync(destDirPath, { "force": true, "recursive": true });
42
-
43
- for (const themeType of themeTypes) {
44
- await downloadKeycloakStaticResources({
45
- "keycloakVersion": (() => {
46
- switch (themeType) {
47
- case "login":
48
- return buildOptions.loginThemeResourcesFromKeycloakVersion;
49
- case "account":
50
- return lastKeycloakVersionWithAccountV1;
51
- }
52
- })(),
53
- themeType,
54
- "themeDirPath": destDirPath,
55
- buildOptions
56
- });
57
- }
58
-
59
- fs.writeFileSync(
60
- pathJoin(destDirPath, "README.txt"),
61
- Buffer.from(
62
- // prettier-ignore
63
- [
64
- "This is just a test folder that helps develop",
65
- "the login and register page without having to run a Keycloak container"
66
- ].join(" ")
67
- )
68
- );
69
-
70
- fs.writeFileSync(pathJoin(buildOptions.publicDirPath, keycloak_resources, ".gitignore"), Buffer.from("*", "utf8"));
71
-
72
- fs.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
73
- }
74
-
75
- export function generateKeycloakifyBuildinfoRaw(params: {
76
- destDirPath: string;
77
- keycloakifyVersion: string;
78
- buildOptions: BuildOptionsLike & {
79
- loginThemeResourcesFromKeycloakVersion: string;
80
- };
81
- }) {
82
- const { destDirPath, keycloakifyVersion, buildOptions } = params;
83
-
84
- const { cacheDirPath, npmWorkspaceRootDirPath, loginThemeResourcesFromKeycloakVersion, ...rest } = buildOptions;
85
-
86
- assert<Equals<typeof rest, {}>>(true);
87
-
88
- const keycloakifyBuildinfoRaw = JSON.stringify(
89
- {
90
- keycloakifyVersion,
91
- "buildOptions": {
92
- loginThemeResourcesFromKeycloakVersion,
93
- "cacheDirPath": pathRelative(destDirPath, cacheDirPath),
94
- "npmWorkspaceRootDirPath": pathRelative(destDirPath, npmWorkspaceRootDirPath)
95
- }
96
- },
97
- null,
98
- 2
99
- );
100
-
101
- return { keycloakifyBuildinfoRaw };
102
- }
103
-
104
- async function main() {
105
10
  await copyKeycloakResourcesToPublic({
106
- "processArgv": process.argv.slice(2)
11
+ "buildOptions": {
12
+ ...buildOptions,
13
+ "publicDirPath": buildOptions.reactAppRootDirPath
14
+ }
107
15
  });
108
16
  }
109
-
110
- if (require.main === module) {
111
- main();
112
- }
@@ -1,282 +1,26 @@
1
- #!/usr/bin/env node
2
1
  import { join as pathJoin } from "path";
3
- import { downloadAndUnzip } from "./downloadAndUnzip";
4
- import { promptKeycloakVersion } from "./promptKeycloakVersion";
5
- import { getLogger } from "./tools/logger";
6
- import { readBuildOptions, type BuildOptions } from "./keycloakify/buildOptions";
7
- import { assert } from "tsafe/assert";
8
- import * as child_process from "child_process";
9
- import * as fs from "fs";
10
- import { rmSync } from "./tools/fs.rmSync";
11
- import { lastKeycloakVersionWithAccountV1 } from "./constants";
12
- import { transformCodebase } from "./tools/transformCodebase";
2
+ import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
3
+ import { readBuildOptions } from "./shared/buildOptions";
4
+ import { downloadBuiltinKeycloakTheme } from "./shared/downloadBuiltinKeycloakTheme";
5
+ import type { CliCommandOptions } from "./main";
13
6
 
14
- export type BuildOptionsLike = {
15
- cacheDirPath: string;
16
- npmWorkspaceRootDirPath: string;
17
- };
7
+ export async function command(params: { cliCommandOptions: CliCommandOptions }) {
8
+ const { cliCommandOptions } = params;
18
9
 
19
- assert<BuildOptions extends BuildOptionsLike ? true : false>();
20
-
21
- export async function downloadBuiltinKeycloakTheme(params: { keycloakVersion: string; destDirPath: string; buildOptions: BuildOptionsLike }) {
22
- const { keycloakVersion, destDirPath, buildOptions } = params;
23
-
24
- await downloadAndUnzip({
25
- destDirPath,
26
- "url": `https://github.com/keycloak/keycloak/archive/refs/tags/${keycloakVersion}.zip`,
27
- "specificDirsToExtract": ["", "-community"].map(ext => `keycloak-${keycloakVersion}/themes/src/main/resources${ext}/theme`),
28
- buildOptions,
29
- "preCacheTransform": {
30
- "actionCacheId": "npm install and build",
31
- "action": async ({ destDirPath }) => {
32
- install_common_node_modules: {
33
- const commonResourcesDirPath = pathJoin(destDirPath, "keycloak", "common", "resources");
34
-
35
- if (!fs.existsSync(commonResourcesDirPath)) {
36
- break install_common_node_modules;
37
- }
38
-
39
- if (!fs.existsSync(pathJoin(commonResourcesDirPath, "package.json"))) {
40
- break install_common_node_modules;
41
- }
42
-
43
- if (fs.existsSync(pathJoin(commonResourcesDirPath, "node_modules"))) {
44
- break install_common_node_modules;
45
- }
46
-
47
- child_process.execSync("npm install --omit=dev", {
48
- "cwd": commonResourcesDirPath,
49
- "stdio": "ignore"
50
- });
51
- }
52
-
53
- repatriate_common_resources_from_base_login_theme: {
54
- const baseLoginThemeResourceDir = pathJoin(destDirPath, "base", "login", "resources");
55
-
56
- if (!fs.existsSync(baseLoginThemeResourceDir)) {
57
- break repatriate_common_resources_from_base_login_theme;
58
- }
59
-
60
- transformCodebase({
61
- "srcDirPath": baseLoginThemeResourceDir,
62
- "destDirPath": pathJoin(destDirPath, "keycloak", "login", "resources")
63
- });
64
- }
65
-
66
- install_and_move_to_common_resources_generated_in_keycloak_v2: {
67
- if (!fs.readFileSync(pathJoin(destDirPath, "keycloak", "login", "theme.properties")).toString("utf8").includes("web_modules")) {
68
- break install_and_move_to_common_resources_generated_in_keycloak_v2;
69
- }
70
-
71
- const accountV2DirSrcDirPath = pathJoin(destDirPath, "keycloak.v2", "account", "src");
72
-
73
- if (!fs.existsSync(accountV2DirSrcDirPath)) {
74
- break install_and_move_to_common_resources_generated_in_keycloak_v2;
75
- }
76
-
77
- const packageManager = fs.existsSync(pathJoin(accountV2DirSrcDirPath, "pnpm-lock.yaml")) ? "pnpm" : "npm";
78
-
79
- if (packageManager === "pnpm") {
80
- try {
81
- child_process.execSync(`which pnpm`);
82
- } catch {
83
- console.log(`Installing pnpm globally`);
84
- child_process.execSync(`npm install -g pnpm`);
85
- }
86
- }
87
-
88
- child_process.execSync(`${packageManager} install`, { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
89
-
90
- const packageJsonFilePath = pathJoin(accountV2DirSrcDirPath, "package.json");
91
-
92
- const packageJsonRaw = fs.readFileSync(packageJsonFilePath);
93
-
94
- const parsedPackageJson = JSON.parse(packageJsonRaw.toString("utf8"));
95
-
96
- parsedPackageJson.scripts.build = parsedPackageJson.scripts.build
97
- .replace(`${packageManager} run check-types`, "true")
98
- .replace(`${packageManager} run babel`, "true");
99
-
100
- fs.writeFileSync(packageJsonFilePath, Buffer.from(JSON.stringify(parsedPackageJson, null, 2), "utf8"));
101
-
102
- child_process.execSync(`${packageManager} run build`, { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
103
-
104
- fs.writeFileSync(packageJsonFilePath, packageJsonRaw);
105
-
106
- fs.rmSync(pathJoin(accountV2DirSrcDirPath, "node_modules"), { "recursive": true });
107
- }
108
-
109
- remove_keycloak_v2: {
110
- const keycloakV2DirPath = pathJoin(destDirPath, "keycloak.v2");
111
-
112
- if (!fs.existsSync(keycloakV2DirPath)) {
113
- break remove_keycloak_v2;
114
- }
115
-
116
- rmSync(keycloakV2DirPath, { "recursive": true });
117
- }
118
-
119
- // Note, this is an optimization for reducing the size of the jar
120
- remove_unused_node_modules: {
121
- const nodeModuleDirPath = pathJoin(destDirPath, "keycloak", "common", "resources", "node_modules");
122
-
123
- if (!fs.existsSync(nodeModuleDirPath)) {
124
- break remove_unused_node_modules;
125
- }
126
-
127
- const toDeletePerfixes = [
128
- "angular",
129
- "bootstrap",
130
- "rcue",
131
- "font-awesome",
132
- "ng-file-upload",
133
- pathJoin("patternfly", "dist", "sass"),
134
- pathJoin("patternfly", "dist", "less"),
135
- pathJoin("patternfly", "dist", "js"),
136
- "d3",
137
- pathJoin("jquery", "src"),
138
- "c3",
139
- "core-js",
140
- "eonasdan-bootstrap-datetimepicker",
141
- "moment",
142
- "react",
143
- "patternfly-bootstrap-treeview",
144
- "popper.js",
145
- "tippy.js",
146
- "jquery-match-height",
147
- "google-code-prettify",
148
- "patternfly-bootstrap-combobox",
149
- "focus-trap",
150
- "tabbable",
151
- "scheduler",
152
- "@types",
153
- "datatables.net",
154
- "datatables.net-colreorder",
155
- "tslib",
156
- "prop-types",
157
- "file-selector",
158
- "datatables.net-colreorder-bs",
159
- "object-assign",
160
- "warning",
161
- "js-tokens",
162
- "loose-envify",
163
- "prop-types-extra",
164
- "attr-accept",
165
- "datatables.net-select",
166
- "drmonty-datatables-colvis",
167
- "datatables.net-bs",
168
- pathJoin("@patternfly", "react"),
169
- pathJoin("@patternfly", "patternfly", "docs")
170
- ];
171
-
172
- transformCodebase({
173
- "srcDirPath": nodeModuleDirPath,
174
- "destDirPath": nodeModuleDirPath,
175
- "transformSourceCode": ({ sourceCode, fileRelativePath }) => {
176
- if (fileRelativePath.endsWith(".map")) {
177
- return undefined;
178
- }
179
-
180
- if (toDeletePerfixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
181
- return undefined;
182
- }
183
-
184
- if (fileRelativePath.startsWith(pathJoin("patternfly", "dist", "fonts"))) {
185
- if (
186
- !fileRelativePath.endsWith(".woff2") &&
187
- !fileRelativePath.endsWith(".woff") &&
188
- !fileRelativePath.endsWith(".ttf")
189
- ) {
190
- return undefined;
191
- }
192
- }
193
-
194
- return { "modifiedSourceCode": sourceCode };
195
- }
196
- });
197
- }
198
-
199
- // Just like node_modules
200
- remove_unused_lib: {
201
- const libDirPath = pathJoin(destDirPath, "keycloak", "common", "resources", "lib");
202
-
203
- if (!fs.existsSync(libDirPath)) {
204
- break remove_unused_lib;
205
- }
206
-
207
- const toDeletePerfixes = ["ui-ace", "filesaver", "fileupload", "angular", "ui-ace"];
208
-
209
- transformCodebase({
210
- "srcDirPath": libDirPath,
211
- "destDirPath": libDirPath,
212
- "transformSourceCode": ({ sourceCode, fileRelativePath }) => {
213
- if (fileRelativePath.endsWith(".map")) {
214
- return undefined;
215
- }
216
-
217
- if (toDeletePerfixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
218
- return undefined;
219
- }
220
-
221
- return { "modifiedSourceCode": sourceCode };
222
- }
223
- });
224
- }
225
-
226
- last_account_v1_transformations: {
227
- if (lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
228
- break last_account_v1_transformations;
229
- }
230
-
231
- {
232
- const accountCssFilePath = pathJoin(destDirPath, "keycloak", "account", "resources", "css", "account.css");
233
-
234
- fs.writeFileSync(
235
- accountCssFilePath,
236
- Buffer.from(fs.readFileSync(accountCssFilePath).toString("utf8").replace("top: -34px;", "top: -34px !important;"), "utf8")
237
- );
238
- }
239
-
240
- // Note, this is an optimization for reducing the size of the jar,
241
- // For this version we know exactly which resources are used.
242
- {
243
- const nodeModulesDirPath = pathJoin(destDirPath, "keycloak", "common", "resources", "node_modules");
244
-
245
- const toKeepPrefixes = [
246
- ...["patternfly.min.css", "patternfly-additions.min.css", "patternfly-additions.min.css"].map(fileBasename =>
247
- pathJoin("patternfly", "dist", "css", fileBasename)
248
- ),
249
- pathJoin("patternfly", "dist", "fonts")
250
- ];
251
-
252
- transformCodebase({
253
- "srcDirPath": nodeModulesDirPath,
254
- "destDirPath": nodeModulesDirPath,
255
- "transformSourceCode": ({ sourceCode, fileRelativePath }) => {
256
- if (toKeepPrefixes.find(prefix => fileRelativePath.startsWith(prefix)) === undefined) {
257
- return undefined;
258
- }
259
- return { "modifiedSourceCode": sourceCode };
260
- }
261
- });
262
- }
263
- }
264
- }
265
- }
266
- });
267
- }
268
-
269
- async function main() {
270
10
  const buildOptions = readBuildOptions({
271
- "processArgv": process.argv.slice(2)
11
+ cliCommandOptions
272
12
  });
273
13
 
274
- const logger = getLogger({ "isSilent": buildOptions.isSilent });
275
- const { keycloakVersion } = await promptKeycloakVersion();
14
+ console.log("Select the Keycloak version from which you want to download the builtins theme:");
15
+
16
+ const { keycloakVersion } = await promptKeycloakVersion({
17
+ "startingFromMajor": undefined,
18
+ "cacheDirPath": buildOptions.cacheDirPath
19
+ });
276
20
 
277
21
  const destDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme");
278
22
 
279
- logger.log(`Downloading builtins theme of Keycloak ${keycloakVersion} here ${destDirPath}`);
23
+ console.log(`Downloading builtins theme of Keycloak ${keycloakVersion} here ${destDirPath}`);
280
24
 
281
25
  await downloadBuiltinKeycloakTheme({
282
26
  keycloakVersion,
@@ -284,7 +28,3 @@ async function main() {
284
28
  buildOptions
285
29
  });
286
30
  }
287
-
288
- if (require.main === module) {
289
- main();
290
- }
@@ -2,24 +2,32 @@
2
2
 
3
3
  import { getThisCodebaseRootDirPath } from "./tools/getThisCodebaseRootDirPath";
4
4
  import cliSelect from "cli-select";
5
- import { loginThemePageIds, accountThemePageIds, type LoginThemePageId, type AccountThemePageId } from "./keycloakify/generateFtl";
5
+ import {
6
+ loginThemePageIds,
7
+ accountThemePageIds,
8
+ type LoginThemePageId,
9
+ type AccountThemePageId,
10
+ themeTypes,
11
+ type ThemeType
12
+ } from "./shared/constants";
6
13
  import { capitalize } from "tsafe/capitalize";
7
- import { readFile, writeFile } from "fs/promises";
8
- import { existsSync } from "fs";
9
- import { join as pathJoin, relative as pathRelative } from "path";
14
+ import * as fs from "fs";
15
+ import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
10
16
  import { kebabCaseToCamelCase } from "./tools/kebabCaseToSnakeCase";
11
17
  import { assert, Equals } from "tsafe/assert";
12
- import { getThemeSrcDirPath } from "./getThemeSrcDirPath";
13
- import { themeTypes, type ThemeType } from "./constants";
14
- import { getReactAppRootDirPath } from "./keycloakify/buildOptions/getReactAppRootDirPath";
18
+ import { getThemeSrcDirPath } from "./shared/getThemeSrcDirPath";
19
+ import type { CliCommandOptions } from "./main";
20
+ import { readBuildOptions } from "./shared/buildOptions";
15
21
 
16
- (async () => {
17
- console.log("Select a theme type");
22
+ export async function command(params: { cliCommandOptions: CliCommandOptions }) {
23
+ const { cliCommandOptions } = params;
18
24
 
19
- const { reactAppRootDirPath } = getReactAppRootDirPath({
20
- "processArgv": process.argv.slice(2)
25
+ const buildOptions = readBuildOptions({
26
+ cliCommandOptions
21
27
  });
22
28
 
29
+ console.log("Theme type:");
30
+
23
31
  const { value: themeType } = await cliSelect<ThemeType>({
24
32
  "values": [...themeTypes]
25
33
  }).catch(() => {
@@ -28,7 +36,7 @@ import { getReactAppRootDirPath } from "./keycloakify/buildOptions/getReactAppRo
28
36
  process.exit(-1);
29
37
  });
30
38
 
31
- console.log("Select a page you would like to eject");
39
+ console.log("Select the page you want to customize:");
32
40
 
33
41
  const { value: pageId } = await cliSelect<LoginThemePageId | AccountThemePageId>({
34
42
  "values": (() => {
@@ -46,19 +54,73 @@ import { getReactAppRootDirPath } from "./keycloakify/buildOptions/getReactAppRo
46
54
  process.exit(-1);
47
55
  });
48
56
 
49
- const pageBasename = capitalize(kebabCaseToCamelCase(pageId)).replace(/ftl$/, "tsx");
57
+ const componentPageBasename = capitalize(kebabCaseToCamelCase(pageId)).replace(/ftl$/, "tsx");
50
58
 
51
- const { themeSrcDirPath } = getThemeSrcDirPath({ reactAppRootDirPath });
59
+ const { themeSrcDirPath } = getThemeSrcDirPath({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath });
52
60
 
53
- const targetFilePath = pathJoin(themeSrcDirPath, themeType, "pages", pageBasename);
61
+ const targetFilePath = pathJoin(themeSrcDirPath, themeType, "pages", componentPageBasename);
54
62
 
55
- if (existsSync(targetFilePath)) {
63
+ if (fs.existsSync(targetFilePath)) {
56
64
  console.log(`${pageId} is already ejected, ${pathRelative(process.cwd(), targetFilePath)} already exists`);
57
65
 
58
66
  process.exit(-1);
59
67
  }
60
68
 
61
- await writeFile(targetFilePath, await readFile(pathJoin(getThisCodebaseRootDirPath(), "src", themeType, "pages", pageBasename)));
69
+ {
70
+ const targetDirPath = pathDirname(targetFilePath);
71
+
72
+ if (!fs.existsSync(targetDirPath)) {
73
+ fs.mkdirSync(targetDirPath, { "recursive": true });
74
+ }
75
+ }
76
+
77
+ const componentPageContent = fs
78
+ .readFileSync(pathJoin(getThisCodebaseRootDirPath(), "src", themeType, "pages", componentPageBasename))
79
+ .toString("utf8");
80
+
81
+ fs.writeFileSync(targetFilePath, Buffer.from(componentPageContent, "utf8"));
82
+
83
+ const userProfileFormFieldComponentName = "UserProfileFormFields";
62
84
 
63
- console.log(`${pathRelative(process.cwd(), targetFilePath)} created`);
64
- })();
85
+ console.log(
86
+ [
87
+ ``,
88
+ `\`${pathJoin(".", pathRelative(process.cwd(), targetFilePath))}\` copy pasted from the Keycloakify source code into your project.`,
89
+ ``,
90
+ `You now need to update your page router:`,
91
+ ``,
92
+ `\`${pathJoin(".", pathRelative(process.cwd(), themeSrcDirPath), themeType, "KcApp.tsx")}\`:`,
93
+ "```",
94
+ `// ...`,
95
+ ``,
96
+ `+const ${componentPageBasename.replace(/.tsx$/, "")} = lazy(() => import("./pages/${componentPageBasename}"));`,
97
+ ``,
98
+ ` export default function KcApp(props: { kcContext: KcContext; }) {`,
99
+ ``,
100
+ ` // ...`,
101
+ ``,
102
+ ` return (`,
103
+ ` <Suspense>`,
104
+ ` {(() => {`,
105
+ ` switch (kcContext.pageId) {`,
106
+ ` // ...`,
107
+ ` case "${pageId}": return (`,
108
+ `+ <Login`,
109
+ `+ {...{ kcContext, i18n, classes }}`,
110
+ `+ Template={Template}`,
111
+ ...(!componentPageContent.includes(userProfileFormFieldComponentName)
112
+ ? []
113
+ : [`+ ${userProfileFormFieldComponentName}={${userProfileFormFieldComponentName}}`]),
114
+ `+ doUseDefaultCss={true}`,
115
+ `+ />`,
116
+ `+ );`,
117
+ ` default: return <Fallback /* .. */ />;`,
118
+ ` }`,
119
+ ` })()}`,
120
+ ` </Suspense>`,
121
+ ` );`,
122
+ ` }`,
123
+ "```"
124
+ ].join("\n")
125
+ );
126
+ }
@@ -1,21 +1,17 @@
1
- #!/usr/bin/env node
2
-
3
- import { downloadBuiltinKeycloakTheme } from "./download-builtin-keycloak-theme";
1
+ import { downloadBuiltinKeycloakTheme } from "./shared/downloadBuiltinKeycloakTheme";
4
2
  import { join as pathJoin, relative as pathRelative } from "path";
5
3
  import { transformCodebase } from "./tools/transformCodebase";
6
- import { promptKeycloakVersion } from "./promptKeycloakVersion";
7
- import { readBuildOptions } from "./keycloakify/buildOptions";
4
+ import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
5
+ import { readBuildOptions } from "./shared/buildOptions";
8
6
  import * as fs from "fs";
9
- import { getLogger } from "./tools/logger";
10
- import { getThemeSrcDirPath } from "./getThemeSrcDirPath";
7
+ import { getThemeSrcDirPath } from "./shared/getThemeSrcDirPath";
11
8
  import { rmSync } from "./tools/fs.rmSync";
9
+ import type { CliCommandOptions } from "./main";
12
10
 
13
- export async function main() {
14
- const buildOptions = readBuildOptions({
15
- "processArgv": process.argv.slice(2)
16
- });
11
+ export async function command(params: { cliCommandOptions: CliCommandOptions }) {
12
+ const { cliCommandOptions } = params;
17
13
 
18
- const logger = getLogger({ "isSilent": buildOptions.isSilent });
14
+ const buildOptions = readBuildOptions({ cliCommandOptions });
19
15
 
20
16
  const { themeSrcDirPath } = getThemeSrcDirPath({
21
17
  "reactAppRootDirPath": buildOptions.reactAppRootDirPath
@@ -24,14 +20,22 @@ export async function main() {
24
20
  const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
25
21
 
26
22
  if (fs.existsSync(emailThemeSrcDirPath)) {
27
- logger.warn(`There is already a ${pathRelative(process.cwd(), emailThemeSrcDirPath)} directory in your project. Aborting.`);
23
+ console.warn(`There is already a ${pathRelative(process.cwd(), emailThemeSrcDirPath)} directory in your project. Aborting.`);
28
24
 
29
25
  process.exit(-1);
30
26
  }
31
27
 
32
- const { keycloakVersion } = await promptKeycloakVersion();
28
+ console.log("Initialize with the base email theme from which version of Keycloak?");
33
29
 
34
- const builtinKeycloakThemeTmpDirPath = pathJoin(emailThemeSrcDirPath, "..", "tmp_xIdP3_builtin_keycloak_theme");
30
+ const { keycloakVersion } = await promptKeycloakVersion({
31
+ // NOTE: This is arbitrary
32
+ "startingFromMajor": 17,
33
+ "cacheDirPath": buildOptions.cacheDirPath
34
+ });
35
+
36
+ const builtinKeycloakThemeTmpDirPath = pathJoin(buildOptions.cacheDirPath, "initialize-email-theme_tmp");
37
+
38
+ rmSync(builtinKeycloakThemeTmpDirPath, { "recursive": true, "force": true });
35
39
 
36
40
  await downloadBuiltinKeycloakTheme({
37
41
  keycloakVersion,
@@ -50,11 +54,8 @@ export async function main() {
50
54
  fs.writeFileSync(themePropertyFilePath, Buffer.from(`parent=base\n${fs.readFileSync(themePropertyFilePath).toString("utf8")}`, "utf8"));
51
55
  }
52
56
 
53
- logger.log(`${pathRelative(process.cwd(), emailThemeSrcDirPath)} ready to be customized, feel free to remove every file you do not customize`);
54
-
55
- rmSync(builtinKeycloakThemeTmpDirPath, { "recursive": true, "force": true });
56
- }
57
+ console.log(`The \`${pathJoin(".", pathRelative(process.cwd(), emailThemeSrcDirPath))}\` directory have been created.`);
58
+ console.log("You can delete any file you don't modify.");
57
59
 
58
- if (require.main === module) {
59
- main();
60
+ rmSync(builtinKeycloakThemeTmpDirPath, { "recursive": true });
60
61
  }