keycloakify 10.0.0-rc.0 → 10.0.0-rc.10

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 (442) 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/main.js +143109 -0
  36. package/lib/BASE_URL.js.map +1 -1
  37. package/login/Fallback.js.map +1 -1
  38. package/login/Template.js +4 -4
  39. package/login/Template.js.map +1 -1
  40. package/login/UserProfileFormFields.js +17 -19
  41. package/login/UserProfileFormFields.js.map +1 -1
  42. package/login/i18n/baseMessages/index.js.map +1 -1
  43. package/login/i18n/i18n.d.ts +3 -4
  44. package/login/i18n/i18n.js +3 -4
  45. package/login/i18n/i18n.js.map +1 -1
  46. package/login/index.d.ts +1 -1
  47. package/login/kcContext/KcContext.d.ts +1 -0
  48. package/login/kcContext/KcContext.js.map +1 -1
  49. package/login/kcContext/createGetKcContext.d.ts +3 -3
  50. package/login/kcContext/createGetKcContext.js.map +1 -1
  51. package/login/kcContext/getKcContextFromWindow.js +1 -1
  52. package/login/kcContext/getKcContextFromWindow.js.map +1 -1
  53. package/login/kcContext/kcContextMocks.js +3 -2
  54. package/login/kcContext/kcContextMocks.js.map +1 -1
  55. package/login/lib/useDownloadTerms.js.map +1 -1
  56. package/login/lib/useUserProfileForm.js +9 -9
  57. package/login/lib/useUserProfileForm.js.map +1 -1
  58. package/login/pages/Code.js +1 -1
  59. package/login/pages/Code.js.map +1 -1
  60. package/login/pages/DeleteAccountConfirm.js +1 -1
  61. package/login/pages/DeleteAccountConfirm.js.map +1 -1
  62. package/login/pages/DeleteCredential.js +1 -1
  63. package/login/pages/DeleteCredential.js.map +1 -1
  64. package/login/pages/Error.js +1 -1
  65. package/login/pages/Error.js.map +1 -1
  66. package/login/pages/FrontchannelLogout.js +1 -1
  67. package/login/pages/FrontchannelLogout.js.map +1 -1
  68. package/login/pages/IdpReviewUserProfile.js +1 -1
  69. package/login/pages/IdpReviewUserProfile.js.map +1 -1
  70. package/login/pages/Info.js +5 -5
  71. package/login/pages/Info.js.map +1 -1
  72. package/login/pages/Login.js +4 -4
  73. package/login/pages/Login.js.map +1 -1
  74. package/login/pages/LoginConfigTotp.js +2 -10
  75. package/login/pages/LoginConfigTotp.js.map +1 -1
  76. package/login/pages/LoginIdpLinkConfirm.js +1 -1
  77. package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
  78. package/login/pages/LoginIdpLinkEmail.js +1 -1
  79. package/login/pages/LoginIdpLinkEmail.js.map +1 -1
  80. package/login/pages/LoginOauth2DeviceVerifyUserCode.js +1 -1
  81. package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
  82. package/login/pages/LoginOauthGrant.js +2 -2
  83. package/login/pages/LoginOauthGrant.js.map +1 -1
  84. package/login/pages/LoginOtp.js +1 -1
  85. package/login/pages/LoginOtp.js.map +1 -1
  86. package/login/pages/LoginPageExpired.js +1 -1
  87. package/login/pages/LoginPageExpired.js.map +1 -1
  88. package/login/pages/LoginPassword.js +3 -3
  89. package/login/pages/LoginPassword.js.map +1 -1
  90. package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
  91. package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
  92. package/login/pages/LoginRecoveryAuthnCodeInput.js +1 -1
  93. package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
  94. package/login/pages/LoginResetOtp.js +1 -1
  95. package/login/pages/LoginResetOtp.js.map +1 -1
  96. package/login/pages/LoginResetPassword.js +2 -2
  97. package/login/pages/LoginResetPassword.js.map +1 -1
  98. package/login/pages/LoginUpdatePassword.js +3 -3
  99. package/login/pages/LoginUpdatePassword.js.map +1 -1
  100. package/login/pages/LoginUpdateProfile.js +2 -4
  101. package/login/pages/LoginUpdateProfile.js.map +1 -1
  102. package/login/pages/LoginUsername.js +3 -3
  103. package/login/pages/LoginUsername.js.map +1 -1
  104. package/login/pages/LoginVerifyEmail.js +1 -1
  105. package/login/pages/LoginVerifyEmail.js.map +1 -1
  106. package/login/pages/LoginX509Info.js +1 -1
  107. package/login/pages/LoginX509Info.js.map +1 -1
  108. package/login/pages/LogoutConfirm.js +1 -1
  109. package/login/pages/LogoutConfirm.js.map +1 -1
  110. package/login/pages/Register.js +4 -8
  111. package/login/pages/Register.js.map +1 -1
  112. package/login/pages/SamlPostForm.js +1 -1
  113. package/login/pages/SamlPostForm.js.map +1 -1
  114. package/login/pages/SelectAuthenticator.js +2 -2
  115. package/login/pages/SelectAuthenticator.js.map +1 -1
  116. package/login/pages/Terms.js +1 -1
  117. package/login/pages/Terms.js.map +1 -1
  118. package/login/pages/UpdateEmail.js +3 -5
  119. package/login/pages/UpdateEmail.js.map +1 -1
  120. package/login/pages/WebauthnAuthenticate.js +6 -6
  121. package/login/pages/WebauthnAuthenticate.js.map +1 -1
  122. package/login/pages/WebauthnError.js +2 -2
  123. package/login/pages/WebauthnError.js.map +1 -1
  124. package/login/pages/WebauthnRegister.js +3 -3
  125. package/login/pages/WebauthnRegister.js.map +1 -1
  126. package/package.json +62 -509
  127. package/src/PUBLIC_URL.ts +1 -1
  128. package/src/account/Fallback.tsx +3 -0
  129. package/src/account/Template.tsx +2 -5
  130. package/src/account/i18n/i18n.tsx +5 -8
  131. package/src/account/index.ts +1 -1
  132. package/src/account/kcContext/KcContext.ts +72 -62
  133. package/src/account/kcContext/getKcContextFromWindow.ts +1 -1
  134. package/src/account/kcContext/kcContextMocks.ts +21 -15
  135. package/src/account/pages/Applications.tsx +2 -2
  136. package/src/account/pages/FederatedIdentity.tsx +58 -0
  137. package/src/account/pages/Log.tsx +1 -1
  138. package/src/account/pages/Sessions.tsx +0 -3
  139. package/src/account/pages/Totp.tsx +20 -21
  140. package/src/bin/copy-keycloak-resources-to-public.ts +10 -106
  141. package/src/bin/download-builtin-keycloak-theme.ts +14 -274
  142. package/src/bin/eject-keycloak-page.ts +81 -19
  143. package/src/bin/initialize-email-theme.ts +22 -21
  144. package/src/bin/keycloakify/buildJars/buildJar.ts +27 -20
  145. package/src/bin/keycloakify/buildJars/buildJars.ts +14 -15
  146. package/src/bin/keycloakify/buildJars/generatePom.ts +4 -4
  147. package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +45 -18
  148. package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +162 -234
  149. package/src/bin/keycloakify/generateFtl/generateFtl.ts +7 -4
  150. package/src/bin/keycloakify/generateFtl/index.ts +0 -1
  151. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.ts +8 -7
  152. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.ts +1 -1
  153. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +32 -0
  154. package/src/bin/keycloakify/{generateTheme/generateSrcMainResources.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts} +40 -46
  155. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +56 -0
  156. package/src/bin/keycloakify/generateSrcMainResources/index.ts +1 -0
  157. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.ts +1 -2
  158. package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.ts +5 -6
  159. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +14 -15
  160. package/src/bin/keycloakify/index.ts +0 -7
  161. package/src/bin/keycloakify/keycloakify.ts +50 -67
  162. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +2 -2
  163. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +2 -2
  164. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +1 -1
  165. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +2 -2
  166. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +2 -2
  167. package/src/bin/main.ts +175 -0
  168. package/src/bin/shared/KeycloakVersionRange.ts +7 -0
  169. package/src/bin/{keycloakify/buildOptions → shared}/buildOptions.ts +113 -25
  170. package/src/bin/{keycloakify/generateFtl/pageId.ts → shared/constants.ts} +25 -1
  171. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +90 -0
  172. package/src/bin/{downloadAndUnzip.ts → shared/downloadAndUnzip.ts} +6 -6
  173. package/src/bin/shared/downloadBuiltinKeycloakTheme.ts +264 -0
  174. package/src/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.ts +8 -8
  175. package/src/bin/shared/getJarFileBasename.ts +9 -0
  176. package/src/bin/{getThemeSrcDirPath.ts → shared/getThemeSrcDirPath.ts} +1 -1
  177. package/src/bin/shared/metaInfKeycloakThemes.ts +34 -0
  178. package/src/bin/shared/promptKeycloakVersion.ts +106 -0
  179. package/src/bin/start-keycloak.ts +236 -0
  180. package/src/bin/tools/fs.rmSync.ts +4 -4
  181. package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +8 -1
  182. package/src/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.ts +1 -23
  183. package/src/bin/tools/{readThisNpmProjectVersion.ts → readThisNpmPackageVersion.ts} +1 -1
  184. package/src/login/Template.tsx +6 -22
  185. package/src/login/UserProfileFormFields.tsx +2 -5
  186. package/src/login/i18n/i18n.tsx +5 -8
  187. package/src/login/index.ts +1 -1
  188. package/src/login/kcContext/KcContext.ts +2 -2
  189. package/src/login/kcContext/getKcContextFromWindow.ts +1 -1
  190. package/src/login/kcContext/kcContextMocks.ts +3 -3
  191. package/src/login/lib/useUserProfileForm.tsx +10 -10
  192. package/src/login/pages/Code.tsx +1 -1
  193. package/src/login/pages/IdpReviewUserProfile.tsx +1 -1
  194. package/src/login/pages/Login.tsx +1 -1
  195. package/src/login/pages/LoginConfigTotp.tsx +1 -9
  196. package/src/login/pages/LoginUpdateProfile.tsx +1 -1
  197. package/src/login/pages/LoginUsername.tsx +1 -1
  198. package/src/login/pages/Register.tsx +2 -2
  199. package/src/login/pages/UpdateEmail.tsx +1 -1
  200. package/src/login/pages/WebauthnRegister.tsx +1 -1
  201. package/src/vite-plugin/tsconfig.json +2 -1
  202. package/src/vite-plugin/vite-plugin.ts +29 -41
  203. package/tools/Array.prototype.every.js.map +1 -1
  204. package/tools/HTMLElement.prototype.prepend.js.map +1 -1
  205. package/tools/clsx.js.map +1 -1
  206. package/tools/deepAssign.js.map +1 -1
  207. package/tools/deepClone.js.map +1 -1
  208. package/tools/formatNumber.js.map +1 -1
  209. package/tools/memoize.js.map +1 -1
  210. package/tools/useInsertLinkTags.js.map +1 -1
  211. package/tools/useInsertScriptTags.js.map +1 -1
  212. package/tools/useSetClassName.js.map +1 -1
  213. package/bin/constants.d.ts +0 -10
  214. package/bin/constants.js +0 -13
  215. package/bin/constants.js.map +0 -1
  216. package/bin/copy-keycloak-resources-to-public.d.ts +0 -14
  217. package/bin/copy-keycloak-resources-to-public.js +0 -216
  218. package/bin/copy-keycloak-resources-to-public.js.map +0 -1
  219. package/bin/download-builtin-keycloak-theme.d.ts +0 -10
  220. package/bin/download-builtin-keycloak-theme.js +0 -352
  221. package/bin/download-builtin-keycloak-theme.js.map +0 -1
  222. package/bin/downloadAndUnzip.d.ts +0 -16
  223. package/bin/downloadAndUnzip.js +0 -255
  224. package/bin/downloadAndUnzip.js.map +0 -1
  225. package/bin/eject-keycloak-page.d.ts +0 -2
  226. package/bin/eject-keycloak-page.js +0 -132
  227. package/bin/eject-keycloak-page.js.map +0 -1
  228. package/bin/getThemeSrcDirPath.d.ts +0 -6
  229. package/bin/getThemeSrcDirPath.js +0 -123
  230. package/bin/getThemeSrcDirPath.js.map +0 -1
  231. package/bin/initialize-email-theme.d.ts +0 -2
  232. package/bin/initialize-email-theme.js +0 -121
  233. package/bin/initialize-email-theme.js.map +0 -1
  234. package/bin/keycloakify/buildJars/buildJar.d.ts +0 -14
  235. package/bin/keycloakify/buildJars/buildJar.js +0 -216
  236. package/bin/keycloakify/buildJars/buildJar.js.map +0 -1
  237. package/bin/keycloakify/buildJars/buildJars.d.ts +0 -10
  238. package/bin/keycloakify/buildJars/buildJars.js +0 -95
  239. package/bin/keycloakify/buildJars/buildJars.js.map +0 -1
  240. package/bin/keycloakify/buildJars/extensionVersions.d.ts +0 -12
  241. package/bin/keycloakify/buildJars/extensionVersions.js +0 -7
  242. package/bin/keycloakify/buildJars/extensionVersions.js.map +0 -1
  243. package/bin/keycloakify/buildJars/generatePom.d.ts +0 -13
  244. package/bin/keycloakify/buildJars/generatePom.js +0 -94
  245. package/bin/keycloakify/buildJars/generatePom.js.map +0 -1
  246. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +0 -6
  247. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +0 -35
  248. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +0 -1
  249. package/bin/keycloakify/buildJars/index.d.ts +0 -1
  250. package/bin/keycloakify/buildJars/index.js +0 -18
  251. package/bin/keycloakify/buildJars/index.js.map +0 -1
  252. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.d.ts +0 -35
  253. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js +0 -14
  254. package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js.map +0 -1
  255. package/bin/keycloakify/buildOptions/buildOptions.d.ts +0 -25
  256. package/bin/keycloakify/buildOptions/buildOptions.js +0 -178
  257. package/bin/keycloakify/buildOptions/buildOptions.js.map +0 -1
  258. package/bin/keycloakify/buildOptions/getCacheDirPath.d.ts +0 -5
  259. package/bin/keycloakify/buildOptions/getCacheDirPath.js +0 -22
  260. package/bin/keycloakify/buildOptions/getCacheDirPath.js.map +0 -1
  261. package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.d.ts +0 -5
  262. package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js +0 -86
  263. package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js.map +0 -1
  264. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.d.ts +0 -5
  265. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js +0 -26
  266. package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js.map +0 -1
  267. package/bin/keycloakify/buildOptions/index.d.ts +0 -1
  268. package/bin/keycloakify/buildOptions/index.js +0 -18
  269. package/bin/keycloakify/buildOptions/index.js.map +0 -1
  270. package/bin/keycloakify/buildOptions/parsedPackageJson.d.ts +0 -10
  271. package/bin/keycloakify/buildOptions/parsedPackageJson.js +0 -49
  272. package/bin/keycloakify/buildOptions/parsedPackageJson.js.map +0 -1
  273. package/bin/keycloakify/buildOptions/resolvedViteConfig.d.ts +0 -13
  274. package/bin/keycloakify/buildOptions/resolvedViteConfig.js +0 -77
  275. package/bin/keycloakify/buildOptions/resolvedViteConfig.js.map +0 -1
  276. package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +0 -593
  277. package/bin/keycloakify/generateFtl/generateFtl.d.ts +0 -23
  278. package/bin/keycloakify/generateFtl/generateFtl.js +0 -169
  279. package/bin/keycloakify/generateFtl/generateFtl.js.map +0 -1
  280. package/bin/keycloakify/generateFtl/index.d.ts +0 -2
  281. package/bin/keycloakify/generateFtl/index.js +0 -19
  282. package/bin/keycloakify/generateFtl/index.js.map +0 -1
  283. package/bin/keycloakify/generateFtl/pageId.d.ts +0 -4
  284. package/bin/keycloakify/generateFtl/pageId.js +0 -41
  285. package/bin/keycloakify/generateFtl/pageId.js.map +0 -1
  286. package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +0 -11
  287. package/bin/keycloakify/generateStartKeycloakTestingContainer.js +0 -89
  288. package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +0 -1
  289. package/bin/keycloakify/generateTheme/bringInAccountV1.d.ts +0 -9
  290. package/bin/keycloakify/generateTheme/bringInAccountV1.js +0 -153
  291. package/bin/keycloakify/generateTheme/bringInAccountV1.js.map +0 -1
  292. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.d.ts +0 -11
  293. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js +0 -102
  294. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +0 -1
  295. package/bin/keycloakify/generateTheme/generateMessageProperties.d.ts +0 -8
  296. package/bin/keycloakify/generateTheme/generateMessageProperties.js +0 -271
  297. package/bin/keycloakify/generateTheme/generateMessageProperties.js.map +0 -1
  298. package/bin/keycloakify/generateTheme/generateSrcMainResources.d.ts +0 -21
  299. package/bin/keycloakify/generateTheme/generateSrcMainResources.js +0 -340
  300. package/bin/keycloakify/generateTheme/generateSrcMainResources.js.map +0 -1
  301. package/bin/keycloakify/generateTheme/generateTheme.d.ts +0 -13
  302. package/bin/keycloakify/generateTheme/generateTheme.js +0 -115
  303. package/bin/keycloakify/generateTheme/generateTheme.js.map +0 -1
  304. package/bin/keycloakify/generateTheme/generateThemeVariants.d.ts +0 -5
  305. package/bin/keycloakify/generateTheme/generateThemeVariants.js +0 -67
  306. package/bin/keycloakify/generateTheme/generateThemeVariants.js.map +0 -1
  307. package/bin/keycloakify/generateTheme/index.d.ts +0 -1
  308. package/bin/keycloakify/generateTheme/index.js +0 -18
  309. package/bin/keycloakify/generateTheme/index.js.map +0 -1
  310. package/bin/keycloakify/generateTheme/readExtraPageNames.d.ts +0 -5
  311. package/bin/keycloakify/generateTheme/readExtraPageNames.js +0 -105
  312. package/bin/keycloakify/generateTheme/readExtraPageNames.js.map +0 -1
  313. package/bin/keycloakify/generateTheme/readFieldNameUsage.d.ts +0 -7
  314. package/bin/keycloakify/generateTheme/readFieldNameUsage.js +0 -142
  315. package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +0 -1
  316. package/bin/keycloakify/index.d.ts +0 -2
  317. package/bin/keycloakify/index.js +0 -23
  318. package/bin/keycloakify/index.js.map +0 -1
  319. package/bin/keycloakify/keycloakify.d.ts +0 -1
  320. package/bin/keycloakify/keycloakify.js +0 -166
  321. package/bin/keycloakify/keycloakify.js.map +0 -1
  322. package/bin/keycloakify/replacers/replaceImportsInCssCode.d.ts +0 -15
  323. package/bin/keycloakify/replacers/replaceImportsInCssCode.js +0 -88
  324. package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +0 -1
  325. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.d.ts +0 -9
  326. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +0 -38
  327. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +0 -1
  328. package/bin/keycloakify/replacers/replaceImportsInJsCode/index.d.ts +0 -1
  329. package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js +0 -18
  330. package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js.map +0 -1
  331. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.d.ts +0 -12
  332. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js +0 -70
  333. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js.map +0 -1
  334. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.d.ts +0 -13
  335. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js +0 -95
  336. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js.map +0 -1
  337. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.d.ts +0 -12
  338. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js +0 -103
  339. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js.map +0 -1
  340. package/bin/promptKeycloakVersion.d.ts +0 -3
  341. package/bin/promptKeycloakVersion.js +0 -121
  342. package/bin/promptKeycloakVersion.js.map +0 -1
  343. package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
  344. package/bin/tools/OptionalIfCanBeUndefined.js +0 -3
  345. package/bin/tools/OptionalIfCanBeUndefined.js.map +0 -1
  346. package/bin/tools/SemVer.d.ts +0 -26
  347. package/bin/tools/SemVer.js +0 -119
  348. package/bin/tools/SemVer.js.map +0 -1
  349. package/bin/tools/String.prototype.replaceAll.d.ts +0 -1
  350. package/bin/tools/String.prototype.replaceAll.js +0 -29
  351. package/bin/tools/String.prototype.replaceAll.js.map +0 -1
  352. package/bin/tools/crawl.d.ts +0 -5
  353. package/bin/tools/crawl.js +0 -74
  354. package/bin/tools/crawl.js.map +0 -1
  355. package/bin/tools/crc32.d.ts +0 -9
  356. package/bin/tools/crc32.js +0 -64
  357. package/bin/tools/crc32.js.map +0 -1
  358. package/bin/tools/deflate.d.ts +0 -24
  359. package/bin/tools/deflate.js +0 -155
  360. package/bin/tools/deflate.js.map +0 -1
  361. package/bin/tools/fetchProxyOptions.d.ts +0 -5
  362. package/bin/tools/fetchProxyOptions.js +0 -172
  363. package/bin/tools/fetchProxyOptions.js.map +0 -1
  364. package/bin/tools/fs.existsAsync.d.ts +0 -1
  365. package/bin/tools/fs.existsAsync.js +0 -86
  366. package/bin/tools/fs.existsAsync.js.map +0 -1
  367. package/bin/tools/fs.rm.d.ts +0 -8
  368. package/bin/tools/fs.rm.js +0 -151
  369. package/bin/tools/fs.rm.js.map +0 -1
  370. package/bin/tools/fs.rmSync.d.ts +0 -8
  371. package/bin/tools/fs.rmSync.js +0 -58
  372. package/bin/tools/fs.rmSync.js.map +0 -1
  373. package/bin/tools/getAbsoluteAndInOsFormatPath.d.ts +0 -4
  374. package/bin/tools/getAbsoluteAndInOsFormatPath.js +0 -16
  375. package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +0 -1
  376. package/bin/tools/getThisCodebaseRootDirPath.d.ts +0 -1
  377. package/bin/tools/getThisCodebaseRootDirPath.js +0 -43
  378. package/bin/tools/getThisCodebaseRootDirPath.js.map +0 -1
  379. package/bin/tools/grant-exec-perms.d.ts +0 -1
  380. package/bin/tools/grant-exec-perms.js +0 -100
  381. package/bin/tools/grant-exec-perms.js.map +0 -1
  382. package/bin/tools/isInside.d.ts +0 -4
  383. package/bin/tools/isInside.js +0 -10
  384. package/bin/tools/isInside.js.map +0 -1
  385. package/bin/tools/kebabCaseToSnakeCase.d.ts +0 -1
  386. package/bin/tools/kebabCaseToSnakeCase.js +0 -35
  387. package/bin/tools/kebabCaseToSnakeCase.js.map +0 -1
  388. package/bin/tools/logger.d.ts +0 -12
  389. package/bin/tools/logger.js +0 -23
  390. package/bin/tools/logger.js.map +0 -1
  391. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -14
  392. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +0 -119
  393. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +0 -1
  394. package/bin/tools/octokit-addons/listTags.d.ts +0 -13
  395. package/bin/tools/octokit-addons/listTags.js +0 -154
  396. package/bin/tools/octokit-addons/listTags.js.map +0 -1
  397. package/bin/tools/partitionPromiseSettledResults.d.ts +0 -2
  398. package/bin/tools/partitionPromiseSettledResults.js +0 -41
  399. package/bin/tools/partitionPromiseSettledResults.js.map +0 -1
  400. package/bin/tools/readThisNpmProjectVersion.d.ts +0 -1
  401. package/bin/tools/readThisNpmProjectVersion.js +0 -37
  402. package/bin/tools/readThisNpmProjectVersion.js.map +0 -1
  403. package/bin/tools/tee.d.ts +0 -3
  404. package/bin/tools/tee.js +0 -37
  405. package/bin/tools/tee.js.map +0 -1
  406. package/bin/tools/transformCodebase.d.ts +0 -20
  407. package/bin/tools/transformCodebase.js +0 -97
  408. package/bin/tools/transformCodebase.js.map +0 -1
  409. package/bin/tools/trimIndent.d.ts +0 -5
  410. package/bin/tools/trimIndent.js +0 -82
  411. package/bin/tools/trimIndent.js.map +0 -1
  412. package/bin/tools/unzip.d.ts +0 -2
  413. package/bin/tools/unzip.js +0 -274
  414. package/bin/tools/unzip.js.map +0 -1
  415. package/index.d.ts +0 -1
  416. package/index.js +0 -2
  417. package/index.js.map +0 -1
  418. package/lib/keycloakJsAdapter.d.ts +0 -51
  419. package/lib/keycloakJsAdapter.js +0 -74
  420. package/lib/keycloakJsAdapter.js.map +0 -1
  421. package/src/bin/constants.ts +0 -13
  422. package/src/bin/keycloakify/buildOptions/UserProvidedBuildOptions.ts +0 -21
  423. package/src/bin/keycloakify/buildOptions/getCacheDirPath.ts +0 -25
  424. package/src/bin/keycloakify/buildOptions/getReactAppRootDirPath.ts +0 -23
  425. package/src/bin/keycloakify/buildOptions/index.ts +0 -1
  426. package/src/bin/keycloakify/buildOptions/parsedPackageJson.ts +0 -32
  427. package/src/bin/keycloakify/buildOptions/resolvedViteConfig.ts +0 -74
  428. package/src/bin/keycloakify/generateTheme/generateTheme.ts +0 -44
  429. package/src/bin/keycloakify/generateTheme/generateThemeVariants.ts +0 -50
  430. package/src/bin/keycloakify/generateTheme/index.ts +0 -1
  431. package/src/bin/promptKeycloakVersion.ts +0 -49
  432. package/src/bin/tools/grant-exec-perms.ts +0 -19
  433. package/src/bin/tools/logger.ts +0 -27
  434. package/src/index.ts +0 -1
  435. package/src/lib/keycloakJsAdapter.ts +0 -118
  436. package/vite-plugin/index.d.ts +0 -1
  437. package/vite-plugin/index.js +0 -18
  438. package/vite-plugin/index.js.map +0 -1
  439. package/vite-plugin/tsconfig.tsbuildinfo +0 -1
  440. package/vite-plugin/vite-plugin.d.ts +0 -6
  441. package/vite-plugin/vite-plugin.js +0 -158
  442. package/vite-plugin/vite-plugin.js.map +0 -1
@@ -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
  }