keycloakify 10.0.0-rc.3 → 10.0.0-rc.5

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 (382) 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 +1 -1
  6. package/account/Template.js.map +1 -1
  7. package/account/i18n/baseMessages/index.js.map +1 -1
  8. package/account/i18n/i18n.js +1 -1
  9. package/account/i18n/i18n.js.map +1 -1
  10. package/account/index.d.ts +1 -1
  11. package/account/kcContext/KcContext.d.ts +62 -44
  12. package/account/kcContext/KcContext.js.map +1 -1
  13. package/account/kcContext/createGetKcContext.d.ts +3 -3
  14. package/account/kcContext/createGetKcContext.js.map +1 -1
  15. package/account/kcContext/getKcContextFromWindow.js +1 -1
  16. package/account/kcContext/getKcContextFromWindow.js.map +1 -1
  17. package/account/kcContext/kcContextMocks.js +22 -14
  18. package/account/kcContext/kcContextMocks.js.map +1 -1
  19. package/account/pages/Account.js +1 -1
  20. package/account/pages/Account.js.map +1 -1
  21. package/account/pages/Applications.js +3 -3
  22. package/account/pages/Applications.js.map +1 -1
  23. package/account/pages/FederatedIdentity.d.ts +7 -0
  24. package/account/pages/FederatedIdentity.js +8 -0
  25. package/account/pages/FederatedIdentity.js.map +1 -0
  26. package/account/pages/Log.js +2 -2
  27. package/account/pages/Log.js.map +1 -1
  28. package/account/pages/Password.js +4 -6
  29. package/account/pages/Password.js.map +1 -1
  30. package/account/pages/Sessions.js +1 -5
  31. package/account/pages/Sessions.js.map +1 -1
  32. package/account/pages/Totp.js +2 -2
  33. package/account/pages/Totp.js.map +1 -1
  34. package/bin/copy-keycloak-resources-to-public.d.ts +3 -13
  35. package/bin/copy-keycloak-resources-to-public.js +22 -166
  36. package/bin/copy-keycloak-resources-to-public.js.map +1 -1
  37. package/bin/download-builtin-keycloak-theme.d.ts +3 -9
  38. package/bin/download-builtin-keycloak-theme.js +15 -291
  39. package/bin/download-builtin-keycloak-theme.js.map +1 -1
  40. package/bin/eject-keycloak-page.d.ts +4 -1
  41. package/bin/eject-keycloak-page.js +59 -54
  42. package/bin/eject-keycloak-page.js.map +1 -1
  43. package/bin/initialize-email-theme.d.ts +4 -2
  44. package/bin/initialize-email-theme.js +17 -19
  45. package/bin/initialize-email-theme.js.map +1 -1
  46. package/bin/keycloakify/buildJars/buildJar.d.ts +1 -0
  47. package/bin/keycloakify/buildJars/buildJar.js +14 -25
  48. package/bin/keycloakify/buildJars/buildJar.js.map +1 -1
  49. package/bin/keycloakify/buildJars/buildJars.d.ts +1 -4
  50. package/bin/keycloakify/buildJars/buildJars.js +17 -8
  51. package/bin/keycloakify/buildJars/buildJars.js.map +1 -1
  52. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +2 -1
  53. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +39 -17
  54. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +1 -1
  55. package/bin/keycloakify/generateFtl/generateFtl.d.ts +1 -1
  56. package/bin/keycloakify/generateFtl/generateFtl.js +1 -1
  57. package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
  58. package/bin/keycloakify/generateFtl/index.d.ts +0 -1
  59. package/bin/keycloakify/generateFtl/index.js +0 -1
  60. package/bin/keycloakify/generateFtl/index.js.map +1 -1
  61. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.d.ts +1 -1
  62. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.js +7 -7
  63. package/bin/keycloakify/generateSrcMainResources/bringInAccountV1.js.map +1 -0
  64. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.d.ts +1 -1
  65. package/bin/keycloakify/generateSrcMainResources/generateMessageProperties.js.map +1 -0
  66. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.d.ts +7 -0
  67. package/bin/keycloakify/{generateTheme/generateTheme.js → generateSrcMainResources/generateSrcMainResources.js} +13 -19
  68. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.js.map +1 -0
  69. package/bin/keycloakify/{generateTheme/generateSrcMainResources.d.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.d.ts} +4 -8
  70. package/bin/keycloakify/{generateTheme/generateSrcMainResources.js → generateSrcMainResources/generateSrcMainResourcesForMainTheme.js} +54 -52
  71. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.js.map +1 -0
  72. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.d.ts +8 -0
  73. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js +47 -0
  74. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js.map +1 -0
  75. package/bin/keycloakify/generateSrcMainResources/index.d.ts +1 -0
  76. package/bin/keycloakify/{buildOptions → generateSrcMainResources}/index.js +1 -1
  77. package/bin/keycloakify/generateSrcMainResources/index.js.map +1 -0
  78. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.d.ts +1 -1
  79. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.js +3 -3
  80. package/bin/keycloakify/generateSrcMainResources/readExtraPageNames.js.map +1 -0
  81. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.d.ts +1 -2
  82. package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.js +3 -2
  83. package/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.js.map +1 -0
  84. package/bin/keycloakify/generateStartKeycloakTestingContainer.js +1 -1
  85. package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
  86. package/bin/keycloakify/index.d.ts +0 -1
  87. package/bin/keycloakify/index.js +0 -5
  88. package/bin/keycloakify/index.js.map +1 -1
  89. package/bin/keycloakify/keycloakify.d.ts +4 -1
  90. package/bin/keycloakify/keycloakify.js +15 -61
  91. package/bin/keycloakify/keycloakify.js.map +1 -1
  92. package/bin/keycloakify/replacers/replaceImportsInCssCode.js +1 -1
  93. package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +1 -1
  94. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +1 -1
  95. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +1 -1
  96. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js.map +1 -1
  97. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js +1 -1
  98. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js.map +1 -1
  99. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js +1 -1
  100. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js.map +1 -1
  101. package/bin/main.d.ts +5 -0
  102. package/bin/main.js +224 -0
  103. package/bin/main.js.map +1 -0
  104. package/bin/shared/KeycloakVersionRange.d.ts +5 -0
  105. package/bin/shared/KeycloakVersionRange.js +3 -0
  106. package/bin/shared/KeycloakVersionRange.js.map +1 -0
  107. package/bin/{keycloakify/buildOptions → shared}/buildOptions.d.ts +17 -1
  108. package/bin/{keycloakify/buildOptions → shared}/buildOptions.js +72 -35
  109. package/bin/shared/buildOptions.js.map +1 -0
  110. package/bin/{constants.d.ts → shared/constants.d.ts} +4 -2
  111. package/bin/shared/constants.js +15 -0
  112. package/bin/shared/constants.js.map +1 -0
  113. package/bin/shared/copyKeycloakResourcesToPublic.d.ts +8 -0
  114. package/bin/shared/copyKeycloakResourcesToPublic.js +175 -0
  115. package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -0
  116. package/bin/{downloadAndUnzip.js → shared/downloadAndUnzip.js} +11 -11
  117. package/bin/shared/downloadAndUnzip.js.map +1 -0
  118. package/bin/shared/downloadBuiltinKeycloakTheme.d.ts +9 -0
  119. package/bin/shared/downloadBuiltinKeycloakTheme.js +316 -0
  120. package/bin/shared/downloadBuiltinKeycloakTheme.js.map +1 -0
  121. package/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.d.ts +1 -1
  122. package/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.js +7 -7
  123. package/bin/shared/downloadKeycloakStaticResources.js.map +1 -0
  124. package/bin/shared/getJarFileBasename.d.ts +6 -0
  125. package/bin/shared/getJarFileBasename.js +10 -0
  126. package/bin/shared/getJarFileBasename.js.map +1 -0
  127. package/bin/{getThemeSrcDirPath.js → shared/getThemeSrcDirPath.js} +1 -1
  128. package/bin/shared/getThemeSrcDirPath.js.map +1 -0
  129. package/bin/shared/metaInfKeycloakThemes.d.ts +17 -0
  130. package/bin/shared/metaInfKeycloakThemes.js +51 -0
  131. package/bin/shared/metaInfKeycloakThemes.js.map +1 -0
  132. package/bin/{keycloakify/generateFtl/pageId.d.ts → shared/pageIds.d.ts} +1 -1
  133. package/bin/{keycloakify/generateFtl/pageId.js → shared/pageIds.js} +10 -2
  134. package/bin/shared/pageIds.js.map +1 -0
  135. package/bin/shared/promptKeycloakVersion.d.ts +5 -0
  136. package/bin/{promptKeycloakVersion.js → shared/promptKeycloakVersion.js} +32 -48
  137. package/bin/shared/promptKeycloakVersion.js.map +1 -0
  138. package/bin/start-keycloak-container.d.ts +4 -0
  139. package/bin/start-keycloak-container.js +209 -0
  140. package/bin/start-keycloak-container.js.map +1 -0
  141. package/bin/tools/SemVer.js +1 -1
  142. package/bin/tools/SemVer.js.map +1 -1
  143. package/bin/tools/String.prototype.replaceAll.js.map +1 -1
  144. package/bin/tools/crawl.js.map +1 -1
  145. package/bin/tools/crc32.js.map +1 -1
  146. package/bin/tools/deflate.js +10 -1
  147. package/bin/tools/deflate.js.map +1 -1
  148. package/bin/tools/fetchProxyOptions.js +9 -9
  149. package/bin/tools/fetchProxyOptions.js.map +1 -1
  150. package/bin/tools/fs.rm.js.map +1 -1
  151. package/bin/tools/fs.rmSync.js +4 -4
  152. package/bin/tools/fs.rmSync.js.map +1 -1
  153. package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +1 -1
  154. package/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.js +1 -13
  155. package/bin/tools/getNpmWorkspaceRootDirPath.js.map +1 -0
  156. package/bin/tools/getThisCodebaseRootDirPath.js.map +1 -1
  157. package/bin/tools/logger.d.ts +1 -1
  158. package/bin/tools/logger.js.map +1 -1
  159. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +21 -24
  160. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +1 -1
  161. package/bin/tools/octokit-addons/listTags.js +3 -2
  162. package/bin/tools/octokit-addons/listTags.js.map +1 -1
  163. package/bin/tools/transformCodebase.js.map +1 -1
  164. package/bin/tools/trimIndent.js.map +1 -1
  165. package/bin/tools/unzip.js.map +1 -1
  166. package/lib/BASE_URL.js.map +1 -1
  167. package/lib/keycloakJsAdapter.js.map +1 -1
  168. package/login/Fallback.js.map +1 -1
  169. package/login/Template.js +3 -3
  170. package/login/Template.js.map +1 -1
  171. package/login/UserProfileFormFields.js +17 -19
  172. package/login/UserProfileFormFields.js.map +1 -1
  173. package/login/i18n/baseMessages/index.js.map +1 -1
  174. package/login/i18n/i18n.js +1 -1
  175. package/login/i18n/i18n.js.map +1 -1
  176. package/login/index.d.ts +1 -1
  177. package/login/kcContext/KcContext.js.map +1 -1
  178. package/login/kcContext/createGetKcContext.d.ts +3 -3
  179. package/login/kcContext/createGetKcContext.js.map +1 -1
  180. package/login/kcContext/getKcContextFromWindow.js +1 -1
  181. package/login/kcContext/getKcContextFromWindow.js.map +1 -1
  182. package/login/kcContext/kcContextMocks.js +1 -1
  183. package/login/kcContext/kcContextMocks.js.map +1 -1
  184. package/login/lib/useDownloadTerms.js.map +1 -1
  185. package/login/lib/useUserProfileForm.js +9 -9
  186. package/login/lib/useUserProfileForm.js.map +1 -1
  187. package/login/pages/Code.js +1 -1
  188. package/login/pages/Code.js.map +1 -1
  189. package/login/pages/DeleteAccountConfirm.js +1 -1
  190. package/login/pages/DeleteAccountConfirm.js.map +1 -1
  191. package/login/pages/DeleteCredential.js +1 -1
  192. package/login/pages/DeleteCredential.js.map +1 -1
  193. package/login/pages/Error.js +1 -1
  194. package/login/pages/Error.js.map +1 -1
  195. package/login/pages/FrontchannelLogout.js +1 -1
  196. package/login/pages/FrontchannelLogout.js.map +1 -1
  197. package/login/pages/IdpReviewUserProfile.js +1 -1
  198. package/login/pages/IdpReviewUserProfile.js.map +1 -1
  199. package/login/pages/Info.js +5 -5
  200. package/login/pages/Info.js.map +1 -1
  201. package/login/pages/Login.js +4 -4
  202. package/login/pages/Login.js.map +1 -1
  203. package/login/pages/LoginConfigTotp.js +2 -2
  204. package/login/pages/LoginConfigTotp.js.map +1 -1
  205. package/login/pages/LoginIdpLinkConfirm.js +1 -1
  206. package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
  207. package/login/pages/LoginIdpLinkEmail.js +1 -1
  208. package/login/pages/LoginIdpLinkEmail.js.map +1 -1
  209. package/login/pages/LoginOauth2DeviceVerifyUserCode.js +1 -1
  210. package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
  211. package/login/pages/LoginOauthGrant.js +2 -2
  212. package/login/pages/LoginOauthGrant.js.map +1 -1
  213. package/login/pages/LoginOtp.js +1 -1
  214. package/login/pages/LoginOtp.js.map +1 -1
  215. package/login/pages/LoginPageExpired.js +1 -1
  216. package/login/pages/LoginPageExpired.js.map +1 -1
  217. package/login/pages/LoginPassword.js +3 -3
  218. package/login/pages/LoginPassword.js.map +1 -1
  219. package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
  220. package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
  221. package/login/pages/LoginRecoveryAuthnCodeInput.js +1 -1
  222. package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
  223. package/login/pages/LoginResetOtp.js +1 -1
  224. package/login/pages/LoginResetOtp.js.map +1 -1
  225. package/login/pages/LoginResetPassword.js +2 -2
  226. package/login/pages/LoginResetPassword.js.map +1 -1
  227. package/login/pages/LoginUpdatePassword.js +3 -3
  228. package/login/pages/LoginUpdatePassword.js.map +1 -1
  229. package/login/pages/LoginUpdateProfile.js +2 -4
  230. package/login/pages/LoginUpdateProfile.js.map +1 -1
  231. package/login/pages/LoginUsername.js +3 -3
  232. package/login/pages/LoginUsername.js.map +1 -1
  233. package/login/pages/LoginVerifyEmail.js +1 -1
  234. package/login/pages/LoginVerifyEmail.js.map +1 -1
  235. package/login/pages/LoginX509Info.js +1 -1
  236. package/login/pages/LoginX509Info.js.map +1 -1
  237. package/login/pages/LogoutConfirm.js +1 -1
  238. package/login/pages/LogoutConfirm.js.map +1 -1
  239. package/login/pages/Register.js +4 -8
  240. package/login/pages/Register.js.map +1 -1
  241. package/login/pages/SamlPostForm.js +1 -1
  242. package/login/pages/SamlPostForm.js.map +1 -1
  243. package/login/pages/SelectAuthenticator.js +2 -2
  244. package/login/pages/SelectAuthenticator.js.map +1 -1
  245. package/login/pages/Terms.js +1 -1
  246. package/login/pages/Terms.js.map +1 -1
  247. package/login/pages/UpdateEmail.js +3 -5
  248. package/login/pages/UpdateEmail.js.map +1 -1
  249. package/login/pages/WebauthnAuthenticate.js +6 -6
  250. package/login/pages/WebauthnAuthenticate.js.map +1 -1
  251. package/login/pages/WebauthnError.js +2 -2
  252. package/login/pages/WebauthnError.js.map +1 -1
  253. package/login/pages/WebauthnRegister.js +3 -3
  254. package/login/pages/WebauthnRegister.js.map +1 -1
  255. package/package.json +125 -118
  256. package/src/PUBLIC_URL.ts +1 -1
  257. package/src/account/Fallback.tsx +3 -0
  258. package/src/account/index.ts +1 -1
  259. package/src/account/kcContext/KcContext.ts +73 -47
  260. package/src/account/kcContext/getKcContextFromWindow.ts +1 -1
  261. package/src/account/kcContext/kcContextMocks.ts +21 -15
  262. package/src/account/pages/Applications.tsx +2 -2
  263. package/src/account/pages/FederatedIdentity.tsx +58 -0
  264. package/src/account/pages/Log.tsx +1 -1
  265. package/src/account/pages/Sessions.tsx +0 -3
  266. package/src/account/pages/Totp.tsx +20 -21
  267. package/src/bin/copy-keycloak-resources-to-public.ts +10 -106
  268. package/src/bin/download-builtin-keycloak-theme.ts +13 -273
  269. package/src/bin/eject-keycloak-page.ts +13 -10
  270. package/src/bin/initialize-email-theme.ts +16 -17
  271. package/src/bin/keycloakify/buildJars/buildJar.ts +13 -17
  272. package/src/bin/keycloakify/buildJars/buildJars.ts +14 -15
  273. package/src/bin/keycloakify/buildJars/generatePom.ts +1 -1
  274. package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +45 -18
  275. package/src/bin/keycloakify/generateFtl/generateFtl.ts +2 -2
  276. package/src/bin/keycloakify/generateFtl/index.ts +0 -1
  277. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.ts +8 -7
  278. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.ts +1 -1
  279. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +32 -0
  280. package/src/bin/keycloakify/{generateTheme/generateSrcMainResources.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts} +38 -45
  281. package/src/bin/keycloakify/{generateTheme/generateThemeVariants.ts → generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts} +18 -12
  282. package/src/bin/keycloakify/generateSrcMainResources/index.ts +1 -0
  283. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.ts +2 -2
  284. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.ts +5 -4
  285. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +2 -2
  286. package/src/bin/keycloakify/index.ts +0 -7
  287. package/src/bin/keycloakify/keycloakify.ts +16 -64
  288. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +2 -2
  289. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +2 -2
  290. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +1 -1
  291. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +2 -2
  292. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +2 -2
  293. package/src/bin/main.ts +111 -0
  294. package/src/bin/shared/KeycloakVersionRange.ts +7 -0
  295. package/src/bin/{keycloakify/buildOptions → shared}/buildOptions.ts +114 -24
  296. package/src/bin/{constants.ts → shared/constants.ts} +4 -2
  297. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +87 -0
  298. package/src/bin/{downloadAndUnzip.ts → shared/downloadAndUnzip.ts} +6 -6
  299. package/src/bin/shared/downloadBuiltinKeycloakTheme.ts +264 -0
  300. package/src/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.ts +8 -8
  301. package/src/bin/shared/getJarFileBasename.ts +9 -0
  302. package/src/bin/{getThemeSrcDirPath.ts → shared/getThemeSrcDirPath.ts} +1 -1
  303. package/src/bin/shared/metaInfKeycloakThemes.ts +34 -0
  304. package/src/bin/{keycloakify/generateFtl/pageId.ts → shared/pageIds.ts} +9 -1
  305. package/src/bin/shared/promptKeycloakVersion.ts +69 -0
  306. package/src/bin/start-keycloak-container.ts +141 -0
  307. package/src/bin/tools/fs.rmSync.ts +4 -4
  308. package/src/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.ts +1 -23
  309. package/src/login/UserProfileFormFields.tsx +2 -5
  310. package/src/login/index.ts +1 -1
  311. package/src/login/kcContext/KcContext.ts +2 -2
  312. package/src/login/kcContext/getKcContextFromWindow.ts +1 -1
  313. package/src/login/kcContext/kcContextMocks.ts +2 -2
  314. package/src/login/lib/useUserProfileForm.tsx +10 -10
  315. package/src/vite-plugin/vite-plugin.ts +30 -41
  316. package/tools/Array.prototype.every.js.map +1 -1
  317. package/tools/HTMLElement.prototype.prepend.js.map +1 -1
  318. package/tools/clsx.js.map +1 -1
  319. package/tools/deepAssign.js.map +1 -1
  320. package/tools/deepClone.js.map +1 -1
  321. package/tools/formatNumber.js.map +1 -1
  322. package/tools/memoize.js.map +1 -1
  323. package/tools/useInsertLinkTags.js.map +1 -1
  324. package/tools/useInsertScriptTags.js.map +1 -1
  325. package/tools/useSetClassName.js.map +1 -1
  326. package/vite-plugin/tsconfig.tsbuildinfo +1 -1
  327. package/vite-plugin/vite-plugin.d.ts +1 -2
  328. package/vite-plugin/vite-plugin.js +31 -51
  329. package/vite-plugin/vite-plugin.js.map +1 -1
  330. package/bin/constants.js +0 -13
  331. package/bin/constants.js.map +0 -1
  332. package/bin/downloadAndUnzip.js.map +0 -1
  333. package/bin/getThemeSrcDirPath.js.map +0 -1
  334. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.d.ts +0 -35
  335. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js +0 -14
  336. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js.map +0 -1
  337. package/bin/keycloakify/buildOptions/buildOptions.js.map +0 -1
  338. package/bin/keycloakify/buildOptions/getCacheDirPath.d.ts +0 -5
  339. package/bin/keycloakify/buildOptions/getCacheDirPath.js +0 -22
  340. package/bin/keycloakify/buildOptions/getCacheDirPath.js.map +0 -1
  341. package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js.map +0 -1
  342. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.d.ts +0 -5
  343. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js +0 -26
  344. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js.map +0 -1
  345. package/bin/keycloakify/buildOptions/index.d.ts +0 -1
  346. package/bin/keycloakify/buildOptions/index.js.map +0 -1
  347. package/bin/keycloakify/buildOptions/parsedPackageJson.d.ts +0 -10
  348. package/bin/keycloakify/buildOptions/parsedPackageJson.js +0 -49
  349. package/bin/keycloakify/buildOptions/parsedPackageJson.js.map +0 -1
  350. package/bin/keycloakify/buildOptions/resolvedViteConfig.d.ts +0 -13
  351. package/bin/keycloakify/buildOptions/resolvedViteConfig.js +0 -77
  352. package/bin/keycloakify/buildOptions/resolvedViteConfig.js.map +0 -1
  353. package/bin/keycloakify/generateFtl/pageId.js.map +0 -1
  354. package/bin/keycloakify/generateTheme/bringInAccountV1.js.map +0 -1
  355. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +0 -1
  356. package/bin/keycloakify/generateTheme/generateMessageProperties.js.map +0 -1
  357. package/bin/keycloakify/generateTheme/generateSrcMainResources.js.map +0 -1
  358. package/bin/keycloakify/generateTheme/generateTheme.d.ts +0 -13
  359. package/bin/keycloakify/generateTheme/generateTheme.js.map +0 -1
  360. package/bin/keycloakify/generateTheme/generateThemeVariants.d.ts +0 -5
  361. package/bin/keycloakify/generateTheme/generateThemeVariants.js +0 -67
  362. package/bin/keycloakify/generateTheme/generateThemeVariants.js.map +0 -1
  363. package/bin/keycloakify/generateTheme/index.d.ts +0 -1
  364. package/bin/keycloakify/generateTheme/index.js +0 -18
  365. package/bin/keycloakify/generateTheme/index.js.map +0 -1
  366. package/bin/keycloakify/generateTheme/readExtraPageNames.js.map +0 -1
  367. package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +0 -1
  368. package/bin/promptKeycloakVersion.d.ts +0 -3
  369. package/bin/promptKeycloakVersion.js.map +0 -1
  370. package/src/bin/keycloakify/buildOptions/UserProvidedBuildOptions.ts +0 -21
  371. package/src/bin/keycloakify/buildOptions/getCacheDirPath.ts +0 -25
  372. package/src/bin/keycloakify/buildOptions/getReactAppRootDirPath.ts +0 -23
  373. package/src/bin/keycloakify/buildOptions/index.ts +0 -1
  374. package/src/bin/keycloakify/buildOptions/parsedPackageJson.ts +0 -32
  375. package/src/bin/keycloakify/buildOptions/resolvedViteConfig.ts +0 -74
  376. package/src/bin/keycloakify/generateTheme/generateTheme.ts +0 -44
  377. package/src/bin/keycloakify/generateTheme/index.ts +0 -1
  378. package/src/bin/promptKeycloakVersion.ts +0 -49
  379. /package/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.js +0 -0
  380. /package/bin/{downloadAndUnzip.d.ts → shared/downloadAndUnzip.d.ts} +0 -0
  381. /package/bin/{getThemeSrcDirPath.d.ts → shared/getThemeSrcDirPath.d.ts} +0 -0
  382. /package/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.d.ts +0 -0
@@ -0,0 +1,264 @@
1
+ import { join as pathJoin } from "path";
2
+ import { downloadAndUnzip } from "./downloadAndUnzip";
3
+ import { type BuildOptions } from "./buildOptions";
4
+ import { assert } from "tsafe/assert";
5
+ import * as child_process from "child_process";
6
+ import * as fs from "fs";
7
+ import { rmSync } from "../tools/fs.rmSync";
8
+ import { lastKeycloakVersionWithAccountV1 } from "../shared/constants";
9
+ import { transformCodebase } from "../tools/transformCodebase";
10
+
11
+ export type BuildOptionsLike = {
12
+ cacheDirPath: string;
13
+ npmWorkspaceRootDirPath: string;
14
+ };
15
+
16
+ assert<BuildOptions extends BuildOptionsLike ? true : false>();
17
+
18
+ export async function downloadBuiltinKeycloakTheme(params: { keycloakVersion: string; destDirPath: string; buildOptions: BuildOptionsLike }) {
19
+ const { keycloakVersion, destDirPath, buildOptions } = params;
20
+
21
+ await downloadAndUnzip({
22
+ destDirPath,
23
+ "url": `https://github.com/keycloak/keycloak/archive/refs/tags/${keycloakVersion}.zip`,
24
+ "specificDirsToExtract": ["", "-community"].map(ext => `keycloak-${keycloakVersion}/themes/src/main/resources${ext}/theme`),
25
+ buildOptions,
26
+ "preCacheTransform": {
27
+ "actionCacheId": "npm install and build",
28
+ "action": async ({ destDirPath }) => {
29
+ install_common_node_modules: {
30
+ const commonResourcesDirPath = pathJoin(destDirPath, "keycloak", "common", "resources");
31
+
32
+ if (!fs.existsSync(commonResourcesDirPath)) {
33
+ break install_common_node_modules;
34
+ }
35
+
36
+ if (!fs.existsSync(pathJoin(commonResourcesDirPath, "package.json"))) {
37
+ break install_common_node_modules;
38
+ }
39
+
40
+ if (fs.existsSync(pathJoin(commonResourcesDirPath, "node_modules"))) {
41
+ break install_common_node_modules;
42
+ }
43
+
44
+ child_process.execSync("npm install --omit=dev", {
45
+ "cwd": commonResourcesDirPath,
46
+ "stdio": "ignore"
47
+ });
48
+ }
49
+
50
+ repatriate_common_resources_from_base_login_theme: {
51
+ const baseLoginThemeResourceDir = pathJoin(destDirPath, "base", "login", "resources");
52
+
53
+ if (!fs.existsSync(baseLoginThemeResourceDir)) {
54
+ break repatriate_common_resources_from_base_login_theme;
55
+ }
56
+
57
+ transformCodebase({
58
+ "srcDirPath": baseLoginThemeResourceDir,
59
+ "destDirPath": pathJoin(destDirPath, "keycloak", "login", "resources")
60
+ });
61
+ }
62
+
63
+ install_and_move_to_common_resources_generated_in_keycloak_v2: {
64
+ if (!fs.readFileSync(pathJoin(destDirPath, "keycloak", "login", "theme.properties")).toString("utf8").includes("web_modules")) {
65
+ break install_and_move_to_common_resources_generated_in_keycloak_v2;
66
+ }
67
+
68
+ const accountV2DirSrcDirPath = pathJoin(destDirPath, "keycloak.v2", "account", "src");
69
+
70
+ if (!fs.existsSync(accountV2DirSrcDirPath)) {
71
+ break install_and_move_to_common_resources_generated_in_keycloak_v2;
72
+ }
73
+
74
+ const packageManager = fs.existsSync(pathJoin(accountV2DirSrcDirPath, "pnpm-lock.yaml")) ? "pnpm" : "npm";
75
+
76
+ if (packageManager === "pnpm") {
77
+ try {
78
+ child_process.execSync(`which pnpm`);
79
+ } catch {
80
+ console.log(`Installing pnpm globally`);
81
+ child_process.execSync(`npm install -g pnpm`);
82
+ }
83
+ }
84
+
85
+ child_process.execSync(`${packageManager} install`, { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
86
+
87
+ const packageJsonFilePath = pathJoin(accountV2DirSrcDirPath, "package.json");
88
+
89
+ const packageJsonRaw = fs.readFileSync(packageJsonFilePath);
90
+
91
+ const parsedPackageJson = JSON.parse(packageJsonRaw.toString("utf8"));
92
+
93
+ parsedPackageJson.scripts.build = parsedPackageJson.scripts.build
94
+ .replace(`${packageManager} run check-types`, "true")
95
+ .replace(`${packageManager} run babel`, "true");
96
+
97
+ fs.writeFileSync(packageJsonFilePath, Buffer.from(JSON.stringify(parsedPackageJson, null, 2), "utf8"));
98
+
99
+ child_process.execSync(`${packageManager} run build`, { "cwd": accountV2DirSrcDirPath, "stdio": "ignore" });
100
+
101
+ fs.writeFileSync(packageJsonFilePath, packageJsonRaw);
102
+
103
+ fs.rmSync(pathJoin(accountV2DirSrcDirPath, "node_modules"), { "recursive": true });
104
+ }
105
+
106
+ remove_keycloak_v2: {
107
+ const keycloakV2DirPath = pathJoin(destDirPath, "keycloak.v2");
108
+
109
+ if (!fs.existsSync(keycloakV2DirPath)) {
110
+ break remove_keycloak_v2;
111
+ }
112
+
113
+ rmSync(keycloakV2DirPath, { "recursive": true });
114
+ }
115
+
116
+ // Note, this is an optimization for reducing the size of the jar
117
+ remove_unused_node_modules: {
118
+ const nodeModuleDirPath = pathJoin(destDirPath, "keycloak", "common", "resources", "node_modules");
119
+
120
+ if (!fs.existsSync(nodeModuleDirPath)) {
121
+ break remove_unused_node_modules;
122
+ }
123
+
124
+ const toDeletePerfixes = [
125
+ "angular",
126
+ "bootstrap",
127
+ "rcue",
128
+ "font-awesome",
129
+ "ng-file-upload",
130
+ pathJoin("patternfly", "dist", "sass"),
131
+ pathJoin("patternfly", "dist", "less"),
132
+ pathJoin("patternfly", "dist", "js"),
133
+ "d3",
134
+ pathJoin("jquery", "src"),
135
+ "c3",
136
+ "core-js",
137
+ "eonasdan-bootstrap-datetimepicker",
138
+ "moment",
139
+ "react",
140
+ "patternfly-bootstrap-treeview",
141
+ "popper.js",
142
+ "tippy.js",
143
+ "jquery-match-height",
144
+ "google-code-prettify",
145
+ "patternfly-bootstrap-combobox",
146
+ "focus-trap",
147
+ "tabbable",
148
+ "scheduler",
149
+ "@types",
150
+ "datatables.net",
151
+ "datatables.net-colreorder",
152
+ "tslib",
153
+ "prop-types",
154
+ "file-selector",
155
+ "datatables.net-colreorder-bs",
156
+ "object-assign",
157
+ "warning",
158
+ "js-tokens",
159
+ "loose-envify",
160
+ "prop-types-extra",
161
+ "attr-accept",
162
+ "datatables.net-select",
163
+ "drmonty-datatables-colvis",
164
+ "datatables.net-bs",
165
+ pathJoin("@patternfly", "react"),
166
+ pathJoin("@patternfly", "patternfly", "docs")
167
+ ];
168
+
169
+ transformCodebase({
170
+ "srcDirPath": nodeModuleDirPath,
171
+ "destDirPath": nodeModuleDirPath,
172
+ "transformSourceCode": ({ sourceCode, fileRelativePath }) => {
173
+ if (fileRelativePath.endsWith(".map")) {
174
+ return undefined;
175
+ }
176
+
177
+ if (toDeletePerfixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
178
+ return undefined;
179
+ }
180
+
181
+ if (fileRelativePath.startsWith(pathJoin("patternfly", "dist", "fonts"))) {
182
+ if (
183
+ !fileRelativePath.endsWith(".woff2") &&
184
+ !fileRelativePath.endsWith(".woff") &&
185
+ !fileRelativePath.endsWith(".ttf")
186
+ ) {
187
+ return undefined;
188
+ }
189
+ }
190
+
191
+ return { "modifiedSourceCode": sourceCode };
192
+ }
193
+ });
194
+ }
195
+
196
+ // Just like node_modules
197
+ remove_unused_lib: {
198
+ const libDirPath = pathJoin(destDirPath, "keycloak", "common", "resources", "lib");
199
+
200
+ if (!fs.existsSync(libDirPath)) {
201
+ break remove_unused_lib;
202
+ }
203
+
204
+ const toDeletePerfixes = ["ui-ace", "filesaver", "fileupload", "angular", "ui-ace"];
205
+
206
+ transformCodebase({
207
+ "srcDirPath": libDirPath,
208
+ "destDirPath": libDirPath,
209
+ "transformSourceCode": ({ sourceCode, fileRelativePath }) => {
210
+ if (fileRelativePath.endsWith(".map")) {
211
+ return undefined;
212
+ }
213
+
214
+ if (toDeletePerfixes.find(prefix => fileRelativePath.startsWith(prefix)) !== undefined) {
215
+ return undefined;
216
+ }
217
+
218
+ return { "modifiedSourceCode": sourceCode };
219
+ }
220
+ });
221
+ }
222
+
223
+ last_account_v1_transformations: {
224
+ if (lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
225
+ break last_account_v1_transformations;
226
+ }
227
+
228
+ {
229
+ const accountCssFilePath = pathJoin(destDirPath, "keycloak", "account", "resources", "css", "account.css");
230
+
231
+ fs.writeFileSync(
232
+ accountCssFilePath,
233
+ Buffer.from(fs.readFileSync(accountCssFilePath).toString("utf8").replace("top: -34px;", "top: -34px !important;"), "utf8")
234
+ );
235
+ }
236
+
237
+ // Note, this is an optimization for reducing the size of the jar,
238
+ // For this version we know exactly which resources are used.
239
+ {
240
+ const nodeModulesDirPath = pathJoin(destDirPath, "keycloak", "common", "resources", "node_modules");
241
+
242
+ const toKeepPrefixes = [
243
+ ...["patternfly.min.css", "patternfly-additions.min.css", "patternfly-additions.min.css"].map(fileBasename =>
244
+ pathJoin("patternfly", "dist", "css", fileBasename)
245
+ ),
246
+ pathJoin("patternfly", "dist", "fonts")
247
+ ];
248
+
249
+ transformCodebase({
250
+ "srcDirPath": nodeModulesDirPath,
251
+ "destDirPath": nodeModulesDirPath,
252
+ "transformSourceCode": ({ sourceCode, fileRelativePath }) => {
253
+ if (toKeepPrefixes.find(prefix => fileRelativePath.startsWith(prefix)) === undefined) {
254
+ return undefined;
255
+ }
256
+ return { "modifiedSourceCode": sourceCode };
257
+ }
258
+ });
259
+ }
260
+ }
261
+ }
262
+ }
263
+ });
264
+ }
@@ -1,11 +1,11 @@
1
- import { transformCodebase } from "../../tools/transformCodebase";
1
+ import { transformCodebase } from "../tools/transformCodebase";
2
2
  import { join as pathJoin } from "path";
3
- import { downloadBuiltinKeycloakTheme } from "../../download-builtin-keycloak-theme";
4
- import { resources_common, type ThemeType } from "../../constants";
5
- import { BuildOptions } from "../buildOptions";
3
+ import { downloadBuiltinKeycloakTheme } from "./downloadBuiltinKeycloakTheme";
4
+ import { resources_common, type ThemeType } from "./constants";
5
+ import type { BuildOptions } from "./buildOptions";
6
6
  import { assert } from "tsafe/assert";
7
7
  import * as crypto from "crypto";
8
- import { rmSync } from "../../tools/fs.rmSync";
8
+ import { rmSync } from "../tools/fs.rmSync";
9
9
 
10
10
  export type BuildOptionsLike = {
11
11
  cacheDirPath: string;
@@ -23,8 +23,8 @@ export async function downloadKeycloakStaticResources(params: {
23
23
  const { themeType, themeDirPath, keycloakVersion, buildOptions } = params;
24
24
 
25
25
  const tmpDirPath = pathJoin(
26
- themeDirPath,
27
- `tmp_suLeKsxId_${crypto.createHash("sha256").update(`${themeType}-${keycloakVersion}`).digest("hex").slice(0, 8)}`
26
+ buildOptions.cacheDirPath,
27
+ `downloadKeycloakStaticResources_tmp_${crypto.createHash("sha256").update(`${themeType}-${keycloakVersion}`).digest("hex").slice(0, 8)}`
28
28
  );
29
29
 
30
30
  await downloadBuiltinKeycloakTheme({
@@ -45,5 +45,5 @@ export async function downloadKeycloakStaticResources(params: {
45
45
  "destDirPath": pathJoin(resourcesPath, resources_common)
46
46
  });
47
47
 
48
- rmSync(tmpDirPath, { "recursive": true, "force": true });
48
+ rmSync(tmpDirPath, { "recursive": true });
49
49
  }
@@ -0,0 +1,9 @@
1
+ import type { KeycloakVersionRange } from "./KeycloakVersionRange";
2
+
3
+ export function getJarFileBasename(params: { keycloakVersionRange: KeycloakVersionRange }) {
4
+ const { keycloakVersionRange } = params;
5
+
6
+ const jarFileBasename = `keycloak-theme-for-kc-${keycloakVersionRange}.jar`;
7
+
8
+ return { jarFileBasename };
9
+ }
@@ -1,6 +1,6 @@
1
1
  import * as fs from "fs";
2
2
  import { exclude } from "tsafe";
3
- import { crawl } from "./tools/crawl";
3
+ import { crawl } from "../tools/crawl";
4
4
  import { join as pathJoin } from "path";
5
5
  import { themeTypes } from "./constants";
6
6
 
@@ -0,0 +1,34 @@
1
+ import { join as pathJoin, dirname as pathDirname } from "path";
2
+ import type { ThemeType } from "./constants";
3
+ import * as fs from "fs";
4
+
5
+ export type MetaInfKeycloakTheme = {
6
+ themes: { name: string; types: (ThemeType | "email")[] }[];
7
+ };
8
+
9
+ export function getMetaInfKeycloakThemesJsonPath(params: { keycloakifyBuildDirPath: string }) {
10
+ const { keycloakifyBuildDirPath } = params;
11
+
12
+ return pathJoin(keycloakifyBuildDirPath, "src", "main", "resources", "META-INF", "keycloak-themes.json");
13
+ }
14
+
15
+ export function readMetaInfKeycloakThemes(params: { keycloakifyBuildDirPath: string }): MetaInfKeycloakTheme {
16
+ const { keycloakifyBuildDirPath } = params;
17
+
18
+ return JSON.parse(fs.readFileSync(getMetaInfKeycloakThemesJsonPath({ keycloakifyBuildDirPath })).toString("utf8")) as MetaInfKeycloakTheme;
19
+ }
20
+
21
+ export function writeMetaInfKeycloakThemes(params: { keycloakifyBuildDirPath: string; metaInfKeycloakThemes: MetaInfKeycloakTheme }) {
22
+ const { keycloakifyBuildDirPath, metaInfKeycloakThemes } = params;
23
+
24
+ const metaInfKeycloakThemesJsonPath = getMetaInfKeycloakThemesJsonPath({ keycloakifyBuildDirPath });
25
+
26
+ {
27
+ const dirPath = pathDirname(metaInfKeycloakThemesJsonPath);
28
+ if (!fs.existsSync(dirPath)) {
29
+ fs.mkdirSync(dirPath, { "recursive": true });
30
+ }
31
+ }
32
+
33
+ fs.writeFileSync(metaInfKeycloakThemesJsonPath, Buffer.from(JSON.stringify(metaInfKeycloakThemes, null, 2), "utf8"));
34
+ }
@@ -35,7 +35,15 @@ export const loginThemePageIds = [
35
35
  "webauthn-error.ftl"
36
36
  ] as const;
37
37
 
38
- export const accountThemePageIds = ["password.ftl", "account.ftl", "sessions.ftl", "totp.ftl", "applications.ftl", "log.ftl"] as const;
38
+ export const accountThemePageIds = [
39
+ "password.ftl",
40
+ "account.ftl",
41
+ "sessions.ftl",
42
+ "totp.ftl",
43
+ "applications.ftl",
44
+ "log.ftl",
45
+ "federatedIdentity.ftl"
46
+ ] as const;
39
47
 
40
48
  export type LoginThemePageId = (typeof loginThemePageIds)[number];
41
49
  export type AccountThemePageId = (typeof accountThemePageIds)[number];
@@ -0,0 +1,69 @@
1
+ import { getLatestsSemVersionedTagFactory } from "../tools/octokit-addons/getLatestsSemVersionedTag";
2
+ import { Octokit } from "@octokit/rest";
3
+ import cliSelect from "cli-select";
4
+ import { lastKeycloakVersionWithAccountV1 } from "./constants";
5
+ import { SemVer } from "../tools/SemVer";
6
+
7
+ export async function promptKeycloakVersion(params: { startingFromMajor: number | undefined }) {
8
+ const { startingFromMajor } = params;
9
+
10
+ const { getLatestsSemVersionedTag } = (() => {
11
+ const { octokit } = (() => {
12
+ const githubToken = process.env.GITHUB_TOKEN;
13
+
14
+ const octokit = new Octokit(githubToken === undefined ? undefined : { "auth": githubToken });
15
+
16
+ return { octokit };
17
+ })();
18
+
19
+ const { getLatestsSemVersionedTag } = getLatestsSemVersionedTagFactory({ octokit });
20
+
21
+ return { getLatestsSemVersionedTag };
22
+ })();
23
+
24
+ console.log("Select Keycloak version");
25
+
26
+ const semVersionedTagByMajor = new Map<number, { tag: string; version: SemVer }>();
27
+
28
+ (
29
+ await getLatestsSemVersionedTag({
30
+ "count": 50,
31
+ "owner": "keycloak",
32
+ "repo": "keycloak"
33
+ })
34
+ ).forEach(semVersionedTag => {
35
+ if (startingFromMajor !== undefined && semVersionedTag.version.major < startingFromMajor) {
36
+ return;
37
+ }
38
+
39
+ const currentSemVersionedTag = semVersionedTagByMajor.get(semVersionedTag.version.major);
40
+
41
+ if (currentSemVersionedTag !== undefined && SemVer.compare(semVersionedTag.version, currentSemVersionedTag.version) === -1) {
42
+ return;
43
+ }
44
+
45
+ semVersionedTagByMajor.set(semVersionedTag.version.major, semVersionedTag);
46
+ });
47
+
48
+ const lastMajorVersions = Array.from(semVersionedTagByMajor.values()).map(({ tag: version }) => {
49
+ let out = version;
50
+
51
+ if (version === lastKeycloakVersionWithAccountV1) {
52
+ out += " (last version with account v1 built in)";
53
+ }
54
+
55
+ return out;
56
+ });
57
+
58
+ const { value } = await cliSelect<string>({
59
+ "values": lastMajorVersions
60
+ }).catch(() => {
61
+ console.log("Aborting");
62
+
63
+ process.exit(-1);
64
+ });
65
+
66
+ const keycloakVersion = value.split(" ")[0];
67
+
68
+ return { keycloakVersion };
69
+ }
@@ -0,0 +1,141 @@
1
+ import { readBuildOptions } from "./shared/buildOptions";
2
+ import type { CliCommandOptions } from "./main";
3
+ import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
4
+ import { readMetaInfKeycloakThemes } from "./shared/metaInfKeycloakThemes";
5
+ import { accountV1ThemeName } from "./shared/constants";
6
+ import { SemVer } from "./tools/SemVer";
7
+ import type { KeycloakVersionRange } from "./shared/KeycloakVersionRange";
8
+ import { getJarFileBasename } from "./shared/getJarFileBasename";
9
+ import { assert, type Equals } from "tsafe/assert";
10
+ import * as fs from "fs";
11
+ import { join as pathJoin, posix as pathPosix } from "path";
12
+ import * as child_process from "child_process";
13
+
14
+ export async function command(params: { cliCommandOptions: CliCommandOptions }) {
15
+ const { cliCommandOptions } = params;
16
+
17
+ const buildOptions = readBuildOptions({ cliCommandOptions });
18
+
19
+ const metaInfKeycloakThemes = readMetaInfKeycloakThemes({
20
+ "keycloakifyBuildDirPath": buildOptions.keycloakifyBuildDirPath
21
+ });
22
+
23
+ const doesImplementAccountTheme = metaInfKeycloakThemes.themes.some(({ name }) => name === accountV1ThemeName);
24
+
25
+ const { keycloakVersion, keycloakMajorNumber } = await (async function getKeycloakMajor(): Promise<{
26
+ keycloakVersion: string;
27
+ keycloakMajorNumber: number;
28
+ }> {
29
+ const { keycloakVersion } = await promptKeycloakVersion({
30
+ "startingFromMajor": 17
31
+ });
32
+
33
+ const keycloakMajorNumber = SemVer.parse(keycloakVersion).major;
34
+
35
+ if (doesImplementAccountTheme && keycloakMajorNumber === 22) {
36
+ console.log([
37
+ "Unfortunately, Keycloakify themes that implements an account theme do not work on Keycloak 22",
38
+ "Please select any other Keycloak version"
39
+ ]);
40
+ return getKeycloakMajor();
41
+ }
42
+
43
+ return { keycloakVersion, keycloakMajorNumber };
44
+ })();
45
+
46
+ const keycloakVersionRange: KeycloakVersionRange = (() => {
47
+ if (doesImplementAccountTheme) {
48
+ const keycloakVersionRange = (() => {
49
+ if (keycloakMajorNumber <= 21) {
50
+ return "21-and-below" as const;
51
+ }
52
+
53
+ assert(keycloakMajorNumber !== 22);
54
+
55
+ if (keycloakMajorNumber === 23) {
56
+ return "23" as const;
57
+ }
58
+
59
+ return "24-and-above" as const;
60
+ })();
61
+
62
+ assert<Equals<typeof keycloakVersionRange, KeycloakVersionRange.WithAccountTheme>>();
63
+
64
+ return keycloakVersionRange;
65
+ } else {
66
+ const keycloakVersionRange = (() => {
67
+ if (keycloakMajorNumber <= 21) {
68
+ return "21-and-below" as const;
69
+ }
70
+
71
+ return "22-and-above" as const;
72
+ })();
73
+
74
+ assert<Equals<typeof keycloakVersionRange, KeycloakVersionRange.WithoutAccountTheme>>();
75
+
76
+ return keycloakVersionRange;
77
+ }
78
+ })();
79
+
80
+ const { jarFileBasename } = getJarFileBasename({ keycloakVersionRange });
81
+
82
+ const mountTargets = buildOptions.themeNames
83
+ .map(themeName => {
84
+ const themeEntry = metaInfKeycloakThemes.themes.find(({ name }) => name === themeName);
85
+
86
+ assert(themeEntry !== undefined);
87
+
88
+ return themeEntry.types
89
+ .map(themeType => {
90
+ const localPathDirname = pathJoin(
91
+ buildOptions.keycloakifyBuildDirPath,
92
+ "src",
93
+ "main",
94
+ "resources",
95
+ "theme",
96
+ themeName,
97
+ themeType
98
+ );
99
+
100
+ return fs
101
+ .readdirSync(localPathDirname)
102
+ .filter(fileOrDirectoryBasename => !fileOrDirectoryBasename.endsWith(".properties"))
103
+ .map(fileOrDirectoryBasename => ({
104
+ "localPath": pathJoin(localPathDirname, fileOrDirectoryBasename),
105
+ "containerPath": pathPosix.join("/", "opt", "keycloak", "themes", themeName, themeType, fileOrDirectoryBasename)
106
+ }));
107
+ })
108
+ .flat();
109
+ })
110
+ .flat();
111
+
112
+ const containerName = "keycloak-keycloakify";
113
+
114
+ try {
115
+ child_process.execSync(`docker rm ${containerName}`, { "stdio": "ignore" });
116
+ } catch {}
117
+
118
+ const child = child_process.spawn(
119
+ "docker",
120
+ [
121
+ "run",
122
+ ...["-p", "8080:8080"],
123
+ ...["--name", containerName],
124
+ ...["-e", "KEYCLOAK_ADMIN=admin"],
125
+ ...["-e", "KEYCLOAK_ADMIN_PASSWORD=admin"],
126
+ ...["-v", `"${pathJoin(buildOptions.keycloakifyBuildDirPath, jarFileBasename)}":"/opt/keycloak/providers/keycloak-theme.jar"`],
127
+ ...(keycloakMajorNumber <= 20 ? ["-e", "JAVA_OPTS=-Dkeycloak.profile=preview"] : []),
128
+ ...mountTargets.map(({ localPath, containerPath }) => ["-v", `"${localPath}":"${containerPath}":rw`]).flat(),
129
+ ...["-it", `quay.io/keycloak/keycloak:${keycloakVersion}`],
130
+ "start-dev",
131
+ ...(21 <= keycloakMajorNumber && keycloakMajorNumber < 24 ? ["--features=declarative-user-profile"] : [])
132
+ ],
133
+ {
134
+ "cwd": buildOptions.keycloakifyBuildDirPath
135
+ }
136
+ );
137
+
138
+ child.stdout.on("data", data => console.log(data.toString("utf8")));
139
+
140
+ child.stderr.on("data", data => console.error(data.toString("utf8")));
141
+ }
@@ -20,13 +20,13 @@ export function rmSync(dirPath: string, options: { recursive: true; force?: true
20
20
 
21
21
  const removeDir_rec = (dirPath: string) =>
22
22
  fs.readdirSync(dirPath).forEach(basename => {
23
- const fileOrDirpath = pathJoin(dirPath, basename);
23
+ const fileOrDirPath = pathJoin(dirPath, basename);
24
24
 
25
- if (fs.lstatSync(fileOrDirpath).isDirectory()) {
26
- removeDir_rec(fileOrDirpath);
25
+ if (fs.lstatSync(fileOrDirPath).isDirectory()) {
26
+ removeDir_rec(fileOrDirPath);
27
27
  return;
28
28
  } else {
29
- fs.unlinkSync(fileOrDirpath);
29
+ fs.unlinkSync(fileOrDirPath);
30
30
  }
31
31
  });
32
32
 
@@ -2,31 +2,14 @@ import * as child_process from "child_process";
2
2
  import { join as pathJoin, resolve as pathResolve, sep as pathSep } from "path";
3
3
  import { assert } from "tsafe/assert";
4
4
 
5
- let cache:
6
- | {
7
- reactAppRootDirPath: string;
8
- npmWorkspaceRootDirPath: string;
9
- }
10
- | undefined = undefined;
11
-
12
5
  export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string }) {
13
6
  const { reactAppRootDirPath } = params;
14
7
 
15
- use_cache: {
16
- if (cache === undefined || cache.reactAppRootDirPath !== reactAppRootDirPath) {
17
- break use_cache;
18
- }
19
-
20
- const { npmWorkspaceRootDirPath } = cache;
21
-
22
- return { npmWorkspaceRootDirPath };
23
- }
24
-
25
8
  const npmWorkspaceRootDirPath = (function callee(depth: number): string {
26
9
  const cwd = pathResolve(pathJoin(...[reactAppRootDirPath, ...Array(depth).fill("..")]));
27
10
 
28
11
  try {
29
- child_process.execSync("npm config get", { cwd, "stdio": ["pipe", "pipe", "pipe"] });
12
+ child_process.execSync("npm config get", { cwd, "stdio": "ignore" });
30
13
  } catch (error) {
31
14
  if (String(error).includes("ENOWORKSPACES")) {
32
15
  assert(cwd !== pathSep, "NPM workspace not found");
@@ -40,10 +23,5 @@ export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string
40
23
  return cwd;
41
24
  })(0);
42
25
 
43
- cache = {
44
- reactAppRootDirPath,
45
- npmWorkspaceRootDirPath
46
- };
47
-
48
26
  return { npmWorkspaceRootDirPath };
49
27
  }
@@ -201,18 +201,15 @@ function FieldErrors(props: {
201
201
  <span
202
202
  id={`input-error-${attribute.name}${fieldIndex === undefined ? "" : `-${fieldIndex}`}`}
203
203
  className={getClassName("kcInputErrorMessageClass")}
204
- style={{
205
- "position": displayableErrors.length === 1 ? "absolute" : undefined
206
- }}
207
204
  aria-live="polite"
208
205
  >
209
206
  {displayableErrors
210
207
  .filter(error => error.fieldIndex === fieldIndex)
211
208
  .map(({ errorMessage }, i, arr) => (
212
- <>
209
+ <Fragment key={i}>
213
210
  <span key={i}>{errorMessage}</span>
214
211
  {arr.length - 1 !== i && <br />}
215
- </>
212
+ </Fragment>
216
213
  ))}
217
214
  </span>
218
215
  );