keycloakify 10.0.0-rc.2 → 10.0.0-rc.20
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.
- package/PUBLIC_URL.js +1 -1
- package/PUBLIC_URL.js.map +1 -1
- package/account/Fallback.js +3 -0
- package/account/Fallback.js.map +1 -1
- package/account/Template.js +7 -7
- package/account/Template.js.map +1 -1
- package/account/i18n/baseMessages/index.js.map +1 -1
- package/account/i18n/i18n.d.ts +3 -4
- package/account/i18n/i18n.js +38 -31
- package/account/i18n/i18n.js.map +1 -1
- package/account/index.d.ts +1 -1
- package/account/kcContext/KcContext.d.ts +62 -59
- package/account/kcContext/KcContext.js.map +1 -1
- package/account/kcContext/createGetKcContext.d.ts +3 -3
- package/account/kcContext/createGetKcContext.js +20 -15
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/getKcContext.js.map +1 -1
- package/account/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/account/kcContext/getKcContextFromWindow.js +1 -1
- package/account/kcContext/getKcContextFromWindow.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +155 -143
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/account/lib/useGetClassName.js +14 -14
- package/account/lib/useGetClassName.js.map +1 -1
- package/account/pages/Account.js +2 -2
- package/account/pages/Account.js.map +1 -1
- package/account/pages/Applications.js +3 -3
- package/account/pages/Applications.js.map +1 -1
- package/account/pages/FederatedIdentity.d.ts +7 -0
- package/account/pages/FederatedIdentity.js +8 -0
- package/account/pages/FederatedIdentity.js.map +1 -0
- package/account/pages/Log.js +2 -2
- package/account/pages/Log.js.map +1 -1
- package/account/pages/Password.js +9 -11
- package/account/pages/Password.js.map +1 -1
- package/account/pages/Sessions.js +1 -5
- package/account/pages/Sessions.js.map +1 -1
- package/account/pages/Totp.js +5 -5
- package/account/pages/Totp.js.map +1 -1
- package/bin/246.index.js +466 -0
- package/bin/420.index.js +508 -0
- package/bin/509.index.js +438 -0
- package/bin/772.index.js +1524 -0
- package/bin/main.js +155612 -0
- package/bin/{keycloakify/generateFtl/pageId.d.ts → shared/constants.d.ts} +16 -1
- package/bin/shared/constants.js +63 -0
- package/bin/shared/constants.js.map +1 -0
- package/lib/BASE_URL.js.map +1 -1
- package/lib/isStorybook.js +2 -1
- package/lib/isStorybook.js.map +1 -1
- package/lib/useGetClassName.js.map +1 -1
- package/login/Fallback.js.map +1 -1
- package/login/Template.js +17 -17
- package/login/Template.js.map +1 -1
- package/login/UserProfileFormFields.js +59 -59
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/baseMessages/ca.d.ts +1 -1
- package/login/i18n/baseMessages/ca.js +1 -1
- package/login/i18n/baseMessages/el.d.ts +0 -1
- package/login/i18n/baseMessages/el.js +0 -1
- package/login/i18n/baseMessages/el.js.map +1 -1
- package/login/i18n/baseMessages/en.d.ts +1 -1
- package/login/i18n/baseMessages/en.js +1 -1
- package/login/i18n/baseMessages/es.d.ts +1 -1
- package/login/i18n/baseMessages/es.js +1 -1
- package/login/i18n/baseMessages/fa.d.ts +0 -1
- package/login/i18n/baseMessages/fa.js +0 -1
- package/login/i18n/baseMessages/fa.js.map +1 -1
- package/login/i18n/baseMessages/hu.d.ts +1 -1
- package/login/i18n/baseMessages/hu.js +1 -1
- package/login/i18n/baseMessages/index.d.ts +1 -2
- package/login/i18n/baseMessages/index.js.map +1 -1
- package/login/i18n/baseMessages/zh-CN.d.ts +1 -1
- package/login/i18n/baseMessages/zh-CN.js +1 -1
- package/login/i18n/i18n.d.ts +5 -5
- package/login/i18n/i18n.js +59 -41
- package/login/i18n/i18n.js.map +1 -1
- package/login/index.d.ts +1 -1
- package/login/kcContext/KcContext.d.ts +1 -0
- package/login/kcContext/KcContext.js +1 -0
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.d.ts +3 -3
- package/login/kcContext/createGetKcContext.js +30 -22
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/getKcContext.js.map +1 -1
- package/login/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/login/kcContext/getKcContextFromWindow.js +1 -1
- package/login/kcContext/getKcContextFromWindow.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +235 -232
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/lib/useDownloadTerms.js +5 -6
- package/login/lib/useDownloadTerms.js.map +1 -1
- package/login/lib/useGetClassName.js +112 -112
- package/login/lib/useGetClassName.js.map +1 -1
- package/login/lib/useUserProfileForm.js +188 -188
- package/login/lib/useUserProfileForm.js.map +1 -1
- package/login/pages/Code.js +1 -1
- package/login/pages/Code.js.map +1 -1
- package/login/pages/DeleteAccountConfirm.js +5 -1
- package/login/pages/DeleteAccountConfirm.js.map +1 -1
- package/login/pages/DeleteCredential.js +1 -1
- package/login/pages/DeleteCredential.js.map +1 -1
- package/login/pages/Error.js +1 -1
- package/login/pages/Error.js.map +1 -1
- package/login/pages/FrontchannelLogout.js +1 -1
- package/login/pages/FrontchannelLogout.js.map +1 -1
- package/login/pages/IdpReviewUserProfile.js +1 -1
- package/login/pages/IdpReviewUserProfile.js.map +1 -1
- package/login/pages/Info.js +5 -5
- package/login/pages/Info.js.map +1 -1
- package/login/pages/Login.js +4 -4
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginConfigTotp.js +2 -2
- package/login/pages/LoginConfigTotp.js.map +1 -1
- package/login/pages/LoginIdpLinkConfirm.js +1 -1
- package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
- package/login/pages/LoginIdpLinkEmail.js +1 -1
- package/login/pages/LoginIdpLinkEmail.js.map +1 -1
- package/login/pages/LoginOauth2DeviceVerifyUserCode.js +1 -1
- package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
- package/login/pages/LoginOauthGrant.js +2 -2
- package/login/pages/LoginOauthGrant.js.map +1 -1
- package/login/pages/LoginOtp.js +1 -1
- package/login/pages/LoginOtp.js.map +1 -1
- package/login/pages/LoginPageExpired.js +1 -1
- package/login/pages/LoginPageExpired.js.map +1 -1
- package/login/pages/LoginPassword.js +3 -3
- package/login/pages/LoginPassword.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +6 -6
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeInput.js +1 -1
- package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
- package/login/pages/LoginResetOtp.js +1 -1
- package/login/pages/LoginResetOtp.js.map +1 -1
- package/login/pages/LoginResetPassword.js +2 -2
- package/login/pages/LoginResetPassword.js.map +1 -1
- package/login/pages/LoginUpdatePassword.js +3 -3
- package/login/pages/LoginUpdatePassword.js.map +1 -1
- package/login/pages/LoginUpdateProfile.js +2 -4
- package/login/pages/LoginUpdateProfile.js.map +1 -1
- package/login/pages/LoginUsername.js +3 -3
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/LoginVerifyEmail.js +1 -1
- package/login/pages/LoginVerifyEmail.js.map +1 -1
- package/login/pages/LoginX509Info.js +1 -1
- package/login/pages/LoginX509Info.js.map +1 -1
- package/login/pages/LogoutConfirm.js +1 -1
- package/login/pages/LogoutConfirm.js.map +1 -1
- package/login/pages/Register.js +4 -8
- package/login/pages/Register.js.map +1 -1
- package/login/pages/SamlPostForm.js +1 -1
- package/login/pages/SamlPostForm.js.map +1 -1
- package/login/pages/SelectAuthenticator.js +2 -2
- package/login/pages/SelectAuthenticator.js.map +1 -1
- package/login/pages/Terms.js +1 -1
- package/login/pages/Terms.js.map +1 -1
- package/login/pages/UpdateEmail.js +3 -5
- package/login/pages/UpdateEmail.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +17 -14
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnError.js +2 -2
- package/login/pages/WebauthnError.js.map +1 -1
- package/login/pages/WebauthnRegister.js +10 -10
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +103 -512
- package/src/PUBLIC_URL.ts +4 -1
- package/src/account/Fallback.tsx +3 -0
- package/src/account/Template.tsx +7 -10
- package/src/account/TemplateProps.ts +4 -1
- package/src/account/i18n/i18n.tsx +44 -37
- package/src/account/index.ts +1 -1
- package/src/account/kcContext/KcContext.ts +76 -63
- package/src/account/kcContext/createGetKcContext.ts +48 -22
- package/src/account/kcContext/getKcContext.ts +3 -1
- package/src/account/kcContext/getKcContextFromWindow.ts +7 -3
- package/src/account/kcContext/kcContextMocks.ts +172 -162
- package/src/account/lib/useGetClassName.ts +15 -14
- package/src/account/pages/Account.tsx +2 -2
- package/src/account/pages/Applications.tsx +2 -2
- package/src/account/pages/FederatedIdentity.tsx +58 -0
- package/src/account/pages/Log.tsx +1 -1
- package/src/account/pages/Password.tsx +8 -8
- package/src/account/pages/Sessions.tsx +0 -3
- package/src/account/pages/Totp.tsx +23 -26
- package/src/bin/copy-keycloak-resources-to-public.ts +10 -106
- package/src/bin/download-keycloak-default-theme.ts +63 -0
- package/src/bin/eject-page.ts +176 -0
- package/src/bin/initialize-email-theme.ts +38 -29
- package/src/bin/keycloakify/buildJars/buildJar.ts +192 -72
- package/src/bin/keycloakify/buildJars/buildJars.ts +41 -23
- package/src/bin/keycloakify/buildJars/extensionVersions.ts +2 -1
- package/src/bin/keycloakify/buildJars/generatePom.ts +12 -4
- package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +73 -21
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +182 -252
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +59 -15
- package/src/bin/keycloakify/generateFtl/index.ts +0 -1
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.ts +34 -22
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.ts +72 -20
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +34 -0
- package/src/bin/keycloakify/{generateTheme/generateSrcMainResources.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts} +113 -74
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +80 -0
- package/src/bin/keycloakify/generateSrcMainResources/index.ts +1 -0
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.ts +21 -8
- package/src/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.ts +83 -0
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +31 -18
- package/src/bin/keycloakify/index.ts +0 -7
- package/src/bin/keycloakify/keycloakify.ts +77 -69
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +26 -7
- package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +8 -4
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +7 -4
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +25 -7
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +50 -12
- package/src/bin/main.ts +212 -0
- package/src/bin/shared/KeycloakVersionRange.ts +9 -0
- package/src/bin/shared/buildOptions.ts +307 -0
- package/src/bin/{keycloakify/generateFtl/pageId.ts → shared/constants.ts} +31 -1
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +104 -0
- package/src/bin/shared/downloadKeycloakDefaultTheme.ts +207 -0
- package/src/bin/shared/downloadKeycloakStaticResources.ts +53 -0
- package/src/bin/shared/getJarFileBasename.ts +11 -0
- package/src/bin/{getThemeSrcDirPath.ts → shared/getThemeSrcDirPath.ts} +6 -3
- package/src/bin/shared/metaInfKeycloakThemes.ts +61 -0
- package/src/bin/shared/promptKeycloakVersion.ts +125 -0
- package/src/bin/start-keycloak/appBuild.ts +129 -0
- package/src/bin/start-keycloak/index.ts +1 -0
- package/src/bin/start-keycloak/keycloakifyBuild.ts +41 -0
- package/src/bin/start-keycloak/myrealm-realm-23.json +2142 -0
- package/src/bin/start-keycloak/myrealm-realm-24.json +2318 -0
- package/src/bin/start-keycloak/start-keycloak.ts +467 -0
- package/src/bin/tools/SemVer.ts +32 -13
- package/src/bin/tools/String.prototype.replaceAll.ts +9 -2
- package/src/bin/tools/crawl.ts +4 -1
- package/src/bin/tools/crc32.ts +42 -24
- package/src/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.ts +262 -0
- package/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts +96 -0
- package/src/bin/tools/downloadAndExtractArchive/index.ts +1 -0
- package/src/bin/tools/extractArchive.ts +132 -0
- package/src/bin/tools/fetchProxyOptions.ts +31 -8
- package/src/bin/tools/fs.rmSync.ts +4 -4
- package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +17 -2
- package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +73 -0
- package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +8 -2
- package/src/bin/tools/octokit-addons/listTags.ts +15 -4
- package/src/bin/tools/partitionPromiseSettledResults.ts +12 -3
- package/src/bin/tools/{readThisNpmProjectVersion.ts → readThisNpmPackageVersion.ts} +6 -2
- package/src/bin/tools/transformCodebase.ts +29 -10
- package/src/bin/tools/trimIndent.ts +4 -1
- package/src/lib/isStorybook.ts +3 -1
- package/src/lib/useGetClassName.ts +12 -3
- package/src/login/Template.tsx +20 -36
- package/src/login/TemplateProps.ts +4 -1
- package/src/login/UserProfileFormFields.tsx +46 -47
- package/src/login/i18n/baseMessages/ca.ts +1 -1
- package/src/login/i18n/baseMessages/el.ts +0 -1
- package/src/login/i18n/baseMessages/en.ts +1 -1
- package/src/login/i18n/baseMessages/es.ts +1 -1
- package/src/login/i18n/baseMessages/fa.ts +0 -1
- package/src/login/i18n/baseMessages/hu.ts +1 -1
- package/src/login/i18n/baseMessages/zh-CN.ts +1 -1
- package/src/login/i18n/i18n.tsx +77 -54
- package/src/login/index.ts +1 -1
- package/src/login/kcContext/KcContext.ts +23 -4
- package/src/login/kcContext/createGetKcContext.ts +84 -37
- package/src/login/kcContext/getKcContext.ts +3 -1
- package/src/login/kcContext/getKcContextFromWindow.ts +7 -3
- package/src/login/kcContext/kcContextMocks.ts +340 -326
- package/src/login/lib/useDownloadTerms.ts +13 -9
- package/src/login/lib/useGetClassName.ts +119 -112
- package/src/login/lib/useUserProfileForm.tsx +227 -213
- package/src/login/pages/Code.tsx +1 -1
- package/src/login/pages/DeleteAccountConfirm.tsx +9 -3
- package/src/login/pages/FrontchannelLogout.tsx +1 -1
- package/src/login/pages/IdpReviewUserProfile.tsx +1 -1
- package/src/login/pages/Login.tsx +3 -3
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +3 -3
- package/src/login/pages/LoginResetPassword.tsx +2 -2
- package/src/login/pages/LoginUpdateProfile.tsx +1 -1
- package/src/login/pages/LoginUsername.tsx +3 -3
- package/src/login/pages/Register.tsx +1 -1
- package/src/login/pages/UpdateEmail.tsx +1 -1
- package/src/login/pages/WebauthnAuthenticate.tsx +11 -8
- package/src/login/pages/WebauthnRegister.tsx +8 -8
- package/src/tools/AndByDiscriminatingKey.ts +12 -6
- package/src/tools/Array.prototype.every.ts +4 -1
- package/src/tools/LazyOrNot.ts +3 -1
- package/src/tools/StatefulObservable/README.md +16 -0
- package/src/tools/StatefulObservable/StatefulObservable.ts +58 -0
- package/src/tools/StatefulObservable/hooks/index.ts +2 -0
- package/src/tools/StatefulObservable/hooks/useObservable.ts +25 -0
- package/src/tools/StatefulObservable/hooks/useRerenderOnChange.ts +19 -0
- package/src/tools/StatefulObservable/index.ts +2 -0
- package/src/tools/clsx.ts +7 -1
- package/src/tools/deepAssign.ts +15 -8
- package/src/tools/deepClone.ts +3 -1
- package/src/tools/formatNumber.ts +4 -1
- package/src/tools/useConstCallback.ts +3 -1
- package/src/tools/useInsertLinkTags.ts +20 -7
- package/src/tools/useInsertScriptTags.ts +7 -2
- package/src/tools/useSetClassName.ts +4 -1
- package/src/vite-plugin/tsconfig.json +2 -1
- package/src/vite-plugin/vite-plugin.ts +64 -52
- package/tools/Array.prototype.every.js +2 -1
- package/tools/Array.prototype.every.js.map +1 -1
- package/tools/HTMLElement.prototype.prepend.js.map +1 -1
- package/tools/StatefulObservable/StatefulObservable.d.ts +8 -0
- package/tools/StatefulObservable/StatefulObservable.js +36 -0
- package/tools/StatefulObservable/StatefulObservable.js.map +1 -0
- package/tools/StatefulObservable/hooks/index.d.ts +2 -0
- package/tools/StatefulObservable/hooks/index.js +3 -0
- package/tools/StatefulObservable/hooks/index.js.map +1 -0
- package/tools/StatefulObservable/hooks/useObservable.d.ts +8 -0
- package/tools/StatefulObservable/hooks/useObservable.js +17 -0
- package/tools/StatefulObservable/hooks/useObservable.js.map +1 -0
- package/tools/StatefulObservable/hooks/useRerenderOnChange.d.ts +5 -0
- package/tools/StatefulObservable/hooks/useRerenderOnChange.js +14 -0
- package/tools/StatefulObservable/hooks/useRerenderOnChange.js.map +1 -0
- package/tools/StatefulObservable/index.d.ts +2 -0
- package/tools/StatefulObservable/index.js +3 -0
- package/tools/StatefulObservable/index.js.map +1 -0
- package/tools/clsx.js.map +1 -1
- package/tools/deepAssign.js +9 -7
- package/tools/deepAssign.js.map +1 -1
- package/tools/deepClone.js.map +1 -1
- package/tools/formatNumber.js.map +1 -1
- package/tools/memoize.js.map +1 -1
- package/tools/useConstCallback.js.map +1 -1
- package/tools/useInsertLinkTags.js +5 -4
- package/tools/useInsertLinkTags.js.map +1 -1
- package/tools/useInsertScriptTags.js +5 -2
- package/tools/useInsertScriptTags.js.map +1 -1
- package/tools/useSetClassName.js.map +1 -1
- package/vite-plugin/index.js +50234 -3
- package/bin/constants.d.ts +0 -10
- package/bin/constants.js +0 -13
- package/bin/constants.js.map +0 -1
- package/bin/copy-keycloak-resources-to-public.d.ts +0 -14
- package/bin/copy-keycloak-resources-to-public.js +0 -216
- package/bin/copy-keycloak-resources-to-public.js.map +0 -1
- package/bin/download-builtin-keycloak-theme.d.ts +0 -10
- package/bin/download-builtin-keycloak-theme.js +0 -352
- package/bin/download-builtin-keycloak-theme.js.map +0 -1
- package/bin/downloadAndUnzip.d.ts +0 -16
- package/bin/downloadAndUnzip.js +0 -255
- package/bin/downloadAndUnzip.js.map +0 -1
- package/bin/eject-keycloak-page.d.ts +0 -2
- package/bin/eject-keycloak-page.js +0 -132
- package/bin/eject-keycloak-page.js.map +0 -1
- package/bin/getThemeSrcDirPath.d.ts +0 -6
- package/bin/getThemeSrcDirPath.js +0 -123
- package/bin/getThemeSrcDirPath.js.map +0 -1
- package/bin/initialize-email-theme.d.ts +0 -2
- package/bin/initialize-email-theme.js +0 -121
- package/bin/initialize-email-theme.js.map +0 -1
- package/bin/keycloakify/buildJars/buildJar.d.ts +0 -14
- package/bin/keycloakify/buildJars/buildJar.js +0 -224
- package/bin/keycloakify/buildJars/buildJar.js.map +0 -1
- package/bin/keycloakify/buildJars/buildJars.d.ts +0 -10
- package/bin/keycloakify/buildJars/buildJars.js +0 -95
- package/bin/keycloakify/buildJars/buildJars.js.map +0 -1
- package/bin/keycloakify/buildJars/extensionVersions.d.ts +0 -12
- package/bin/keycloakify/buildJars/extensionVersions.js +0 -7
- package/bin/keycloakify/buildJars/extensionVersions.js.map +0 -1
- package/bin/keycloakify/buildJars/generatePom.d.ts +0 -13
- package/bin/keycloakify/buildJars/generatePom.js +0 -95
- package/bin/keycloakify/buildJars/generatePom.js.map +0 -1
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +0 -6
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +0 -35
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +0 -1
- package/bin/keycloakify/buildJars/index.d.ts +0 -1
- package/bin/keycloakify/buildJars/index.js +0 -18
- package/bin/keycloakify/buildJars/index.js.map +0 -1
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.d.ts +0 -35
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js +0 -14
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js.map +0 -1
- package/bin/keycloakify/buildOptions/buildOptions.d.ts +0 -25
- package/bin/keycloakify/buildOptions/buildOptions.js +0 -178
- package/bin/keycloakify/buildOptions/buildOptions.js.map +0 -1
- package/bin/keycloakify/buildOptions/getCacheDirPath.d.ts +0 -5
- package/bin/keycloakify/buildOptions/getCacheDirPath.js +0 -22
- package/bin/keycloakify/buildOptions/getCacheDirPath.js.map +0 -1
- package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.d.ts +0 -5
- package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js +0 -86
- package/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.js.map +0 -1
- package/bin/keycloakify/buildOptions/getReactAppRootDirPath.d.ts +0 -5
- package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js +0 -26
- package/bin/keycloakify/buildOptions/getReactAppRootDirPath.js.map +0 -1
- package/bin/keycloakify/buildOptions/index.d.ts +0 -1
- package/bin/keycloakify/buildOptions/index.js +0 -18
- package/bin/keycloakify/buildOptions/index.js.map +0 -1
- package/bin/keycloakify/buildOptions/parsedPackageJson.d.ts +0 -10
- package/bin/keycloakify/buildOptions/parsedPackageJson.js +0 -49
- package/bin/keycloakify/buildOptions/parsedPackageJson.js.map +0 -1
- package/bin/keycloakify/buildOptions/resolvedViteConfig.d.ts +0 -13
- package/bin/keycloakify/buildOptions/resolvedViteConfig.js +0 -77
- package/bin/keycloakify/buildOptions/resolvedViteConfig.js.map +0 -1
- package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +0 -604
- package/bin/keycloakify/generateFtl/generateFtl.d.ts +0 -23
- package/bin/keycloakify/generateFtl/generateFtl.js +0 -169
- package/bin/keycloakify/generateFtl/generateFtl.js.map +0 -1
- package/bin/keycloakify/generateFtl/index.d.ts +0 -2
- package/bin/keycloakify/generateFtl/index.js +0 -19
- package/bin/keycloakify/generateFtl/index.js.map +0 -1
- package/bin/keycloakify/generateFtl/pageId.js +0 -41
- package/bin/keycloakify/generateFtl/pageId.js.map +0 -1
- package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +0 -11
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js +0 -89
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +0 -1
- package/bin/keycloakify/generateTheme/bringInAccountV1.d.ts +0 -9
- package/bin/keycloakify/generateTheme/bringInAccountV1.js +0 -153
- package/bin/keycloakify/generateTheme/bringInAccountV1.js.map +0 -1
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.d.ts +0 -11
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js +0 -102
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateMessageProperties.d.ts +0 -8
- package/bin/keycloakify/generateTheme/generateMessageProperties.js +0 -271
- package/bin/keycloakify/generateTheme/generateMessageProperties.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateSrcMainResources.d.ts +0 -21
- package/bin/keycloakify/generateTheme/generateSrcMainResources.js +0 -340
- package/bin/keycloakify/generateTheme/generateSrcMainResources.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateTheme.d.ts +0 -13
- package/bin/keycloakify/generateTheme/generateTheme.js +0 -115
- package/bin/keycloakify/generateTheme/generateTheme.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateThemeVariants.d.ts +0 -5
- package/bin/keycloakify/generateTheme/generateThemeVariants.js +0 -67
- package/bin/keycloakify/generateTheme/generateThemeVariants.js.map +0 -1
- package/bin/keycloakify/generateTheme/index.d.ts +0 -1
- package/bin/keycloakify/generateTheme/index.js +0 -18
- package/bin/keycloakify/generateTheme/index.js.map +0 -1
- package/bin/keycloakify/generateTheme/readExtraPageNames.d.ts +0 -5
- package/bin/keycloakify/generateTheme/readExtraPageNames.js +0 -105
- package/bin/keycloakify/generateTheme/readExtraPageNames.js.map +0 -1
- package/bin/keycloakify/generateTheme/readFieldNameUsage.d.ts +0 -7
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js +0 -141
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +0 -1
- package/bin/keycloakify/index.d.ts +0 -2
- package/bin/keycloakify/index.js +0 -23
- package/bin/keycloakify/index.js.map +0 -1
- package/bin/keycloakify/keycloakify.d.ts +0 -1
- package/bin/keycloakify/keycloakify.js +0 -166
- package/bin/keycloakify/keycloakify.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInCssCode.d.ts +0 -15
- package/bin/keycloakify/replacers/replaceImportsInCssCode.js +0 -88
- package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.d.ts +0 -9
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +0 -38
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/index.d.ts +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js +0 -18
- package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.d.ts +0 -12
- package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js +0 -70
- package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.d.ts +0 -13
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js +0 -95
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js.map +0 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.d.ts +0 -12
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js +0 -103
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js.map +0 -1
- package/bin/promptKeycloakVersion.d.ts +0 -3
- package/bin/promptKeycloakVersion.js +0 -121
- package/bin/promptKeycloakVersion.js.map +0 -1
- package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
- package/bin/tools/OptionalIfCanBeUndefined.js +0 -3
- package/bin/tools/OptionalIfCanBeUndefined.js.map +0 -1
- package/bin/tools/SemVer.d.ts +0 -26
- package/bin/tools/SemVer.js +0 -119
- package/bin/tools/SemVer.js.map +0 -1
- package/bin/tools/String.prototype.replaceAll.d.ts +0 -1
- package/bin/tools/String.prototype.replaceAll.js +0 -29
- package/bin/tools/String.prototype.replaceAll.js.map +0 -1
- package/bin/tools/crawl.d.ts +0 -5
- package/bin/tools/crawl.js +0 -74
- package/bin/tools/crawl.js.map +0 -1
- package/bin/tools/crc32.d.ts +0 -9
- package/bin/tools/crc32.js +0 -64
- package/bin/tools/crc32.js.map +0 -1
- package/bin/tools/deflate.d.ts +0 -24
- package/bin/tools/deflate.js +0 -155
- package/bin/tools/deflate.js.map +0 -1
- package/bin/tools/fetchProxyOptions.d.ts +0 -5
- package/bin/tools/fetchProxyOptions.js +0 -172
- package/bin/tools/fetchProxyOptions.js.map +0 -1
- package/bin/tools/fs.existsAsync.d.ts +0 -1
- package/bin/tools/fs.existsAsync.js +0 -86
- package/bin/tools/fs.existsAsync.js.map +0 -1
- package/bin/tools/fs.rm.d.ts +0 -8
- package/bin/tools/fs.rm.js +0 -151
- package/bin/tools/fs.rm.js.map +0 -1
- package/bin/tools/fs.rmSync.d.ts +0 -8
- package/bin/tools/fs.rmSync.js +0 -58
- package/bin/tools/fs.rmSync.js.map +0 -1
- package/bin/tools/getAbsoluteAndInOsFormatPath.d.ts +0 -4
- package/bin/tools/getAbsoluteAndInOsFormatPath.js +0 -16
- package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +0 -1
- package/bin/tools/getThisCodebaseRootDirPath.d.ts +0 -1
- package/bin/tools/getThisCodebaseRootDirPath.js +0 -43
- package/bin/tools/getThisCodebaseRootDirPath.js.map +0 -1
- package/bin/tools/grant-exec-perms.d.ts +0 -1
- package/bin/tools/grant-exec-perms.js +0 -100
- package/bin/tools/grant-exec-perms.js.map +0 -1
- package/bin/tools/isInside.d.ts +0 -4
- package/bin/tools/isInside.js +0 -10
- package/bin/tools/isInside.js.map +0 -1
- package/bin/tools/kebabCaseToSnakeCase.d.ts +0 -1
- package/bin/tools/kebabCaseToSnakeCase.js +0 -35
- package/bin/tools/kebabCaseToSnakeCase.js.map +0 -1
- package/bin/tools/logger.d.ts +0 -12
- package/bin/tools/logger.js +0 -23
- package/bin/tools/logger.js.map +0 -1
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -14
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +0 -119
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +0 -1
- package/bin/tools/octokit-addons/listTags.d.ts +0 -13
- package/bin/tools/octokit-addons/listTags.js +0 -154
- package/bin/tools/octokit-addons/listTags.js.map +0 -1
- package/bin/tools/partitionPromiseSettledResults.d.ts +0 -2
- package/bin/tools/partitionPromiseSettledResults.js +0 -41
- package/bin/tools/partitionPromiseSettledResults.js.map +0 -1
- package/bin/tools/readThisNpmProjectVersion.d.ts +0 -1
- package/bin/tools/readThisNpmProjectVersion.js +0 -37
- package/bin/tools/readThisNpmProjectVersion.js.map +0 -1
- package/bin/tools/tee.d.ts +0 -3
- package/bin/tools/tee.js +0 -37
- package/bin/tools/tee.js.map +0 -1
- package/bin/tools/transformCodebase.d.ts +0 -20
- package/bin/tools/transformCodebase.js +0 -97
- package/bin/tools/transformCodebase.js.map +0 -1
- package/bin/tools/trimIndent.d.ts +0 -5
- package/bin/tools/trimIndent.js +0 -82
- package/bin/tools/trimIndent.js.map +0 -1
- package/bin/tools/unzip.d.ts +0 -2
- package/bin/tools/unzip.js +0 -274
- package/bin/tools/unzip.js.map +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -2
- package/index.js.map +0 -1
- package/lib/keycloakJsAdapter.d.ts +0 -51
- package/lib/keycloakJsAdapter.js +0 -74
- package/lib/keycloakJsAdapter.js.map +0 -1
- package/src/bin/constants.ts +0 -13
- package/src/bin/download-builtin-keycloak-theme.ts +0 -290
- package/src/bin/downloadAndUnzip.ts +0 -203
- package/src/bin/eject-keycloak-page.ts +0 -64
- package/src/bin/keycloakify/buildOptions/UserProvidedBuildOptions.ts +0 -21
- package/src/bin/keycloakify/buildOptions/buildOptions.ts +0 -189
- package/src/bin/keycloakify/buildOptions/getCacheDirPath.ts +0 -25
- package/src/bin/keycloakify/buildOptions/getNpmWorkspaceRootDirPath.ts +0 -49
- package/src/bin/keycloakify/buildOptions/getReactAppRootDirPath.ts +0 -23
- package/src/bin/keycloakify/buildOptions/index.ts +0 -1
- package/src/bin/keycloakify/buildOptions/parsedPackageJson.ts +0 -32
- package/src/bin/keycloakify/buildOptions/resolvedViteConfig.ts +0 -74
- package/src/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.ts +0 -49
- package/src/bin/keycloakify/generateTheme/generateTheme.ts +0 -44
- package/src/bin/keycloakify/generateTheme/generateThemeVariants.ts +0 -50
- package/src/bin/keycloakify/generateTheme/index.ts +0 -1
- package/src/bin/keycloakify/generateTheme/readFieldNameUsage.ts +0 -55
- package/src/bin/promptKeycloakVersion.ts +0 -49
- package/src/bin/tools/grant-exec-perms.ts +0 -19
- package/src/bin/tools/logger.ts +0 -27
- package/src/bin/tools/unzip.ts +0 -141
- package/src/index.ts +0 -1
- package/src/lib/keycloakJsAdapter.ts +0 -118
- package/vite-plugin/index.js.map +0 -1
- package/vite-plugin/tsconfig.tsbuildinfo +0 -1
- package/vite-plugin/vite-plugin.d.ts +0 -6
- package/vite-plugin/vite-plugin.js +0 -158
- package/vite-plugin/vite-plugin.js.map +0 -1
@@ -0,0 +1,307 @@
|
|
1
|
+
import { parse as urlParse } from "url";
|
2
|
+
import { join as pathJoin } from "path";
|
3
|
+
import { getAbsoluteAndInOsFormatPath } from "../tools/getAbsoluteAndInOsFormatPath";
|
4
|
+
import { getNpmWorkspaceRootDirPath } from "../tools/getNpmWorkspaceRootDirPath";
|
5
|
+
import type { CliCommandOptions } from "../main";
|
6
|
+
import { z } from "zod";
|
7
|
+
import * as fs from "fs";
|
8
|
+
import { assert } from "tsafe";
|
9
|
+
import * as child_process from "child_process";
|
10
|
+
import { vitePluginSubScriptEnvNames } from "./constants";
|
11
|
+
|
12
|
+
/** Consolidated build option gathered form CLI arguments and config in package.json */
|
13
|
+
export type BuildOptions = {
|
14
|
+
bundler: "vite" | "webpack";
|
15
|
+
themeVersion: string;
|
16
|
+
themeNames: string[];
|
17
|
+
extraThemeProperties: string[] | undefined;
|
18
|
+
groupId: string;
|
19
|
+
artifactId: string;
|
20
|
+
loginThemeResourcesFromKeycloakVersion: string;
|
21
|
+
reactAppRootDirPath: string;
|
22
|
+
// TODO: Remove from vite type
|
23
|
+
reactAppBuildDirPath: string;
|
24
|
+
/** Directory that keycloakify outputs to. Defaults to {cwd}/build_keycloak */
|
25
|
+
keycloakifyBuildDirPath: string;
|
26
|
+
publicDirPath: string;
|
27
|
+
cacheDirPath: string;
|
28
|
+
/** If your app is hosted under a subpath, it's the case in CRA if you have "homepage": "https://example.com/my-app" in your package.json
|
29
|
+
* In this case the urlPathname will be "/my-app/" */
|
30
|
+
urlPathname: string | undefined;
|
31
|
+
assetsDirPath: string;
|
32
|
+
npmWorkspaceRootDirPath: string;
|
33
|
+
};
|
34
|
+
|
35
|
+
export type UserProvidedBuildOptions = {
|
36
|
+
extraThemeProperties?: string[];
|
37
|
+
artifactId?: string;
|
38
|
+
groupId?: string;
|
39
|
+
loginThemeResourcesFromKeycloakVersion?: string;
|
40
|
+
keycloakifyBuildDirPath?: string;
|
41
|
+
themeName?: string | string[];
|
42
|
+
};
|
43
|
+
|
44
|
+
export type ResolvedViteConfig = {
|
45
|
+
buildDir: string;
|
46
|
+
publicDir: string;
|
47
|
+
assetsDir: string;
|
48
|
+
urlPathname: string | undefined;
|
49
|
+
userProvidedBuildOptions: UserProvidedBuildOptions;
|
50
|
+
};
|
51
|
+
|
52
|
+
export function readBuildOptions(params: {
|
53
|
+
cliCommandOptions: CliCommandOptions;
|
54
|
+
}): BuildOptions {
|
55
|
+
const { cliCommandOptions } = params;
|
56
|
+
|
57
|
+
const reactAppRootDirPath = (() => {
|
58
|
+
if (cliCommandOptions.reactAppRootDirPath === undefined) {
|
59
|
+
return process.cwd();
|
60
|
+
}
|
61
|
+
|
62
|
+
return getAbsoluteAndInOsFormatPath({
|
63
|
+
pathIsh: cliCommandOptions.reactAppRootDirPath,
|
64
|
+
cwd: process.cwd()
|
65
|
+
});
|
66
|
+
})();
|
67
|
+
|
68
|
+
const { resolvedViteConfig } = (() => {
|
69
|
+
if (
|
70
|
+
fs
|
71
|
+
.readdirSync(reactAppRootDirPath)
|
72
|
+
.find(fileBasename => fileBasename.startsWith("vite.config")) ===
|
73
|
+
undefined
|
74
|
+
) {
|
75
|
+
return { resolvedViteConfig: undefined };
|
76
|
+
}
|
77
|
+
|
78
|
+
const output = child_process
|
79
|
+
.execSync("npx vite", {
|
80
|
+
cwd: reactAppRootDirPath,
|
81
|
+
env: {
|
82
|
+
...process.env,
|
83
|
+
[vitePluginSubScriptEnvNames.resolveViteConfig]: "true"
|
84
|
+
}
|
85
|
+
})
|
86
|
+
.toString("utf8");
|
87
|
+
|
88
|
+
assert(
|
89
|
+
output.includes(vitePluginSubScriptEnvNames.resolveViteConfig),
|
90
|
+
"Seems like the Keycloakify's Vite plugin is not installed."
|
91
|
+
);
|
92
|
+
|
93
|
+
const resolvedViteConfigStr = output
|
94
|
+
.split(vitePluginSubScriptEnvNames.resolveViteConfig)
|
95
|
+
.reverse()[0];
|
96
|
+
|
97
|
+
const resolvedViteConfig: ResolvedViteConfig = JSON.parse(resolvedViteConfigStr);
|
98
|
+
|
99
|
+
return { resolvedViteConfig };
|
100
|
+
})();
|
101
|
+
|
102
|
+
const parsedPackageJson = (() => {
|
103
|
+
type ParsedPackageJson = {
|
104
|
+
name: string;
|
105
|
+
version?: string;
|
106
|
+
homepage?: string;
|
107
|
+
keycloakify?: UserProvidedBuildOptions & {
|
108
|
+
reactAppBuildDirPath?: string;
|
109
|
+
};
|
110
|
+
};
|
111
|
+
|
112
|
+
const zParsedPackageJson = z.object({
|
113
|
+
name: z.string(),
|
114
|
+
version: z.string().optional(),
|
115
|
+
homepage: z.string().optional(),
|
116
|
+
keycloakify: z
|
117
|
+
.object({
|
118
|
+
extraThemeProperties: z.array(z.string()).optional(),
|
119
|
+
artifactId: z.string().optional(),
|
120
|
+
groupId: z.string().optional(),
|
121
|
+
loginThemeResourcesFromKeycloakVersion: z.string().optional(),
|
122
|
+
reactAppBuildDirPath: z.string().optional(),
|
123
|
+
keycloakifyBuildDirPath: z.string().optional(),
|
124
|
+
themeName: z.union([z.string(), z.array(z.string())]).optional()
|
125
|
+
})
|
126
|
+
.optional()
|
127
|
+
});
|
128
|
+
|
129
|
+
{
|
130
|
+
type Got = ReturnType<(typeof zParsedPackageJson)["parse"]>;
|
131
|
+
type Expected = ParsedPackageJson;
|
132
|
+
assert<Got extends Expected ? true : false>();
|
133
|
+
assert<Expected extends Got ? true : false>();
|
134
|
+
}
|
135
|
+
|
136
|
+
return zParsedPackageJson.parse(
|
137
|
+
JSON.parse(
|
138
|
+
fs
|
139
|
+
.readFileSync(pathJoin(reactAppRootDirPath, "package.json"))
|
140
|
+
.toString("utf8")
|
141
|
+
)
|
142
|
+
);
|
143
|
+
})();
|
144
|
+
|
145
|
+
const userProvidedBuildOptions: UserProvidedBuildOptions = {
|
146
|
+
...parsedPackageJson.keycloakify,
|
147
|
+
...resolvedViteConfig?.userProvidedBuildOptions
|
148
|
+
};
|
149
|
+
|
150
|
+
const themeNames = (() => {
|
151
|
+
if (userProvidedBuildOptions.themeName === undefined) {
|
152
|
+
return [
|
153
|
+
parsedPackageJson.name
|
154
|
+
.replace(/^@(.*)/, "$1")
|
155
|
+
.split("/")
|
156
|
+
.join("-")
|
157
|
+
];
|
158
|
+
}
|
159
|
+
|
160
|
+
if (typeof userProvidedBuildOptions.themeName === "string") {
|
161
|
+
return [userProvidedBuildOptions.themeName];
|
162
|
+
}
|
163
|
+
|
164
|
+
return userProvidedBuildOptions.themeName;
|
165
|
+
})();
|
166
|
+
|
167
|
+
const reactAppBuildDirPath = (() => {
|
168
|
+
webpack: {
|
169
|
+
if (resolvedViteConfig !== undefined) {
|
170
|
+
break webpack;
|
171
|
+
}
|
172
|
+
|
173
|
+
if (parsedPackageJson.keycloakify?.reactAppBuildDirPath !== undefined) {
|
174
|
+
return getAbsoluteAndInOsFormatPath({
|
175
|
+
pathIsh: parsedPackageJson.keycloakify.reactAppBuildDirPath,
|
176
|
+
cwd: reactAppRootDirPath
|
177
|
+
});
|
178
|
+
}
|
179
|
+
|
180
|
+
return pathJoin(reactAppRootDirPath, "build");
|
181
|
+
}
|
182
|
+
|
183
|
+
return pathJoin(reactAppRootDirPath, resolvedViteConfig.buildDir);
|
184
|
+
})();
|
185
|
+
|
186
|
+
const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({
|
187
|
+
reactAppRootDirPath,
|
188
|
+
dependencyExpected: "keycloakify"
|
189
|
+
});
|
190
|
+
|
191
|
+
return {
|
192
|
+
bundler: resolvedViteConfig !== undefined ? "vite" : "webpack",
|
193
|
+
themeVersion:
|
194
|
+
process.env.KEYCLOAKIFY_THEME_VERSION ?? parsedPackageJson.version ?? "0.0.0",
|
195
|
+
themeNames,
|
196
|
+
extraThemeProperties: userProvidedBuildOptions.extraThemeProperties,
|
197
|
+
groupId: (() => {
|
198
|
+
const fallbackGroupId = `${themeNames[0]}.keycloak`;
|
199
|
+
|
200
|
+
return (
|
201
|
+
process.env.KEYCLOAKIFY_GROUP_ID ??
|
202
|
+
userProvidedBuildOptions.groupId ??
|
203
|
+
(parsedPackageJson.homepage === undefined
|
204
|
+
? fallbackGroupId
|
205
|
+
: urlParse(parsedPackageJson.homepage)
|
206
|
+
.host?.replace(/:[0-9]+$/, "")
|
207
|
+
?.split(".")
|
208
|
+
.reverse()
|
209
|
+
.join(".") ?? fallbackGroupId) + ".keycloak"
|
210
|
+
);
|
211
|
+
})(),
|
212
|
+
artifactId:
|
213
|
+
process.env.KEYCLOAKIFY_ARTIFACT_ID ??
|
214
|
+
userProvidedBuildOptions.artifactId ??
|
215
|
+
`${themeNames[0]}-keycloak-theme`,
|
216
|
+
loginThemeResourcesFromKeycloakVersion:
|
217
|
+
userProvidedBuildOptions.loginThemeResourcesFromKeycloakVersion ?? "24.0.4",
|
218
|
+
reactAppRootDirPath,
|
219
|
+
reactAppBuildDirPath,
|
220
|
+
keycloakifyBuildDirPath: (() => {
|
221
|
+
if (userProvidedBuildOptions.keycloakifyBuildDirPath !== undefined) {
|
222
|
+
return getAbsoluteAndInOsFormatPath({
|
223
|
+
pathIsh: userProvidedBuildOptions.keycloakifyBuildDirPath,
|
224
|
+
cwd: reactAppRootDirPath
|
225
|
+
});
|
226
|
+
}
|
227
|
+
|
228
|
+
return pathJoin(
|
229
|
+
reactAppRootDirPath,
|
230
|
+
resolvedViteConfig?.buildDir === undefined
|
231
|
+
? "build_keycloak"
|
232
|
+
: `${resolvedViteConfig.buildDir}_keycloak`
|
233
|
+
);
|
234
|
+
})(),
|
235
|
+
publicDirPath: (() => {
|
236
|
+
webpack: {
|
237
|
+
if (resolvedViteConfig !== undefined) {
|
238
|
+
break webpack;
|
239
|
+
}
|
240
|
+
|
241
|
+
if (process.env.PUBLIC_DIR_PATH !== undefined) {
|
242
|
+
return getAbsoluteAndInOsFormatPath({
|
243
|
+
pathIsh: process.env.PUBLIC_DIR_PATH,
|
244
|
+
cwd: reactAppRootDirPath
|
245
|
+
});
|
246
|
+
}
|
247
|
+
|
248
|
+
return pathJoin(reactAppRootDirPath, "public");
|
249
|
+
}
|
250
|
+
|
251
|
+
return pathJoin(reactAppRootDirPath, resolvedViteConfig.publicDir);
|
252
|
+
})(),
|
253
|
+
cacheDirPath: (() => {
|
254
|
+
const cacheDirPath = pathJoin(
|
255
|
+
(() => {
|
256
|
+
if (process.env.XDG_CACHE_HOME !== undefined) {
|
257
|
+
return getAbsoluteAndInOsFormatPath({
|
258
|
+
pathIsh: process.env.XDG_CACHE_HOME,
|
259
|
+
cwd: process.cwd()
|
260
|
+
});
|
261
|
+
}
|
262
|
+
|
263
|
+
return pathJoin(npmWorkspaceRootDirPath, "node_modules", ".cache");
|
264
|
+
})(),
|
265
|
+
"keycloakify"
|
266
|
+
);
|
267
|
+
|
268
|
+
return cacheDirPath;
|
269
|
+
})(),
|
270
|
+
urlPathname: (() => {
|
271
|
+
webpack: {
|
272
|
+
if (resolvedViteConfig !== undefined) {
|
273
|
+
break webpack;
|
274
|
+
}
|
275
|
+
|
276
|
+
const { homepage } = parsedPackageJson;
|
277
|
+
|
278
|
+
let url: URL | undefined = undefined;
|
279
|
+
|
280
|
+
if (homepage !== undefined) {
|
281
|
+
url = new URL(homepage);
|
282
|
+
}
|
283
|
+
|
284
|
+
if (url === undefined) {
|
285
|
+
return undefined;
|
286
|
+
}
|
287
|
+
|
288
|
+
const out = url.pathname.replace(/([^/])$/, "$1/");
|
289
|
+
return out === "/" ? undefined : out;
|
290
|
+
}
|
291
|
+
|
292
|
+
return resolvedViteConfig.urlPathname;
|
293
|
+
})(),
|
294
|
+
assetsDirPath: (() => {
|
295
|
+
webpack: {
|
296
|
+
if (resolvedViteConfig !== undefined) {
|
297
|
+
break webpack;
|
298
|
+
}
|
299
|
+
|
300
|
+
return pathJoin(reactAppBuildDirPath, "static");
|
301
|
+
}
|
302
|
+
|
303
|
+
return pathJoin(reactAppBuildDirPath, resolvedViteConfig.assetsDir);
|
304
|
+
})(),
|
305
|
+
npmWorkspaceRootDirPath
|
306
|
+
};
|
307
|
+
}
|
@@ -1,3 +1,23 @@
|
|
1
|
+
export const nameOfTheGlobal = "kcContext";
|
2
|
+
export const nameOfTheLocalizationRealmOverridesUserProfileProperty =
|
3
|
+
"__localizationRealmOverridesUserProfile";
|
4
|
+
export const keycloak_resources = "keycloak-resources";
|
5
|
+
export const resources_common = "resources-common";
|
6
|
+
export const lastKeycloakVersionWithAccountV1 = "21.1.2";
|
7
|
+
export const basenameOfTheKeycloakifyResourcesDir = "build";
|
8
|
+
|
9
|
+
export const themeTypes = ["login", "account"] as const;
|
10
|
+
export const accountV1ThemeName = "account-v1";
|
11
|
+
|
12
|
+
export type ThemeType = (typeof themeTypes)[number];
|
13
|
+
|
14
|
+
export const vitePluginSubScriptEnvNames = {
|
15
|
+
runPostBuildScript: "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
|
16
|
+
resolveViteConfig: "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
|
17
|
+
} as const;
|
18
|
+
|
19
|
+
export const skipBuildJarsEnvName = "KEYCLOAKIFY_SKIP_BUILD_JAR";
|
20
|
+
|
1
21
|
export const loginThemePageIds = [
|
2
22
|
"login.ftl",
|
3
23
|
"login-username.ftl",
|
@@ -35,7 +55,17 @@ export const loginThemePageIds = [
|
|
35
55
|
"webauthn-error.ftl"
|
36
56
|
] as const;
|
37
57
|
|
38
|
-
export const accountThemePageIds = [
|
58
|
+
export const accountThemePageIds = [
|
59
|
+
"password.ftl",
|
60
|
+
"account.ftl",
|
61
|
+
"sessions.ftl",
|
62
|
+
"totp.ftl",
|
63
|
+
"applications.ftl",
|
64
|
+
"log.ftl",
|
65
|
+
"federatedIdentity.ftl"
|
66
|
+
] as const;
|
39
67
|
|
40
68
|
export type LoginThemePageId = (typeof loginThemePageIds)[number];
|
41
69
|
export type AccountThemePageId = (typeof accountThemePageIds)[number];
|
70
|
+
|
71
|
+
export const containerName = "keycloak-keycloakify";
|
@@ -0,0 +1,104 @@
|
|
1
|
+
import {
|
2
|
+
downloadKeycloakStaticResources,
|
3
|
+
type BuildOptionsLike as BuildOptionsLike_downloadKeycloakStaticResources
|
4
|
+
} from "./downloadKeycloakStaticResources";
|
5
|
+
import { join as pathJoin, relative as pathRelative } from "path";
|
6
|
+
import {
|
7
|
+
themeTypes,
|
8
|
+
keycloak_resources,
|
9
|
+
lastKeycloakVersionWithAccountV1
|
10
|
+
} from "../shared/constants";
|
11
|
+
import { readThisNpmPackageVersion } from "../tools/readThisNpmPackageVersion";
|
12
|
+
import { assert } from "tsafe/assert";
|
13
|
+
import * as fs from "fs";
|
14
|
+
import { rmSync } from "../tools/fs.rmSync";
|
15
|
+
import type { BuildOptions } from "./buildOptions";
|
16
|
+
|
17
|
+
export type BuildOptionsLike = BuildOptionsLike_downloadKeycloakStaticResources & {
|
18
|
+
loginThemeResourcesFromKeycloakVersion: string;
|
19
|
+
publicDirPath: string;
|
20
|
+
};
|
21
|
+
|
22
|
+
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
23
|
+
|
24
|
+
export async function copyKeycloakResourcesToPublic(params: {
|
25
|
+
buildOptions: BuildOptionsLike;
|
26
|
+
}) {
|
27
|
+
const { buildOptions } = params;
|
28
|
+
|
29
|
+
const destDirPath = pathJoin(buildOptions.publicDirPath, keycloak_resources);
|
30
|
+
|
31
|
+
const keycloakifyBuildinfoFilePath = pathJoin(destDirPath, "keycloakify.buildinfo");
|
32
|
+
|
33
|
+
const keycloakifyBuildinfoRaw = JSON.stringify(
|
34
|
+
{
|
35
|
+
destDirPath,
|
36
|
+
keycloakifyVersion: readThisNpmPackageVersion(),
|
37
|
+
buildOptions: {
|
38
|
+
loginThemeResourcesFromKeycloakVersion: readThisNpmPackageVersion(),
|
39
|
+
cacheDirPath: pathRelative(destDirPath, buildOptions.cacheDirPath),
|
40
|
+
npmWorkspaceRootDirPath: pathRelative(
|
41
|
+
destDirPath,
|
42
|
+
buildOptions.npmWorkspaceRootDirPath
|
43
|
+
)
|
44
|
+
}
|
45
|
+
},
|
46
|
+
null,
|
47
|
+
2
|
48
|
+
);
|
49
|
+
|
50
|
+
skip_if_already_done: {
|
51
|
+
if (!fs.existsSync(keycloakifyBuildinfoFilePath)) {
|
52
|
+
break skip_if_already_done;
|
53
|
+
}
|
54
|
+
|
55
|
+
const keycloakifyBuildinfoRaw_previousRun = fs
|
56
|
+
.readFileSync(keycloakifyBuildinfoFilePath)
|
57
|
+
.toString("utf8");
|
58
|
+
|
59
|
+
if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
|
60
|
+
break skip_if_already_done;
|
61
|
+
}
|
62
|
+
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
|
66
|
+
rmSync(destDirPath, { force: true, recursive: true });
|
67
|
+
|
68
|
+
fs.mkdirSync(destDirPath, { recursive: true });
|
69
|
+
|
70
|
+
fs.writeFileSync(pathJoin(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
|
71
|
+
|
72
|
+
for (const themeType of themeTypes) {
|
73
|
+
await downloadKeycloakStaticResources({
|
74
|
+
keycloakVersion: (() => {
|
75
|
+
switch (themeType) {
|
76
|
+
case "login":
|
77
|
+
return buildOptions.loginThemeResourcesFromKeycloakVersion;
|
78
|
+
case "account":
|
79
|
+
return lastKeycloakVersionWithAccountV1;
|
80
|
+
}
|
81
|
+
})(),
|
82
|
+
themeType,
|
83
|
+
themeDirPath: destDirPath,
|
84
|
+
buildOptions
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
fs.writeFileSync(
|
89
|
+
pathJoin(destDirPath, "README.txt"),
|
90
|
+
Buffer.from(
|
91
|
+
// prettier-ignore
|
92
|
+
[
|
93
|
+
"This is just a test folder that helps develop",
|
94
|
+
"the login and register page without having to run a Keycloak container\n",
|
95
|
+
"This directory will be automatically excluded from the final build."
|
96
|
+
].join(" ")
|
97
|
+
)
|
98
|
+
);
|
99
|
+
|
100
|
+
fs.writeFileSync(
|
101
|
+
keycloakifyBuildinfoFilePath,
|
102
|
+
Buffer.from(keycloakifyBuildinfoRaw, "utf8")
|
103
|
+
);
|
104
|
+
}
|
@@ -0,0 +1,207 @@
|
|
1
|
+
import { join as pathJoin, relative as pathRelative } from "path";
|
2
|
+
import { type BuildOptions } from "./buildOptions";
|
3
|
+
import { assert } from "tsafe/assert";
|
4
|
+
import { lastKeycloakVersionWithAccountV1 } from "./constants";
|
5
|
+
import { downloadAndExtractArchive } from "../tools/downloadAndExtractArchive";
|
6
|
+
import { isInside } from "../tools/isInside";
|
7
|
+
|
8
|
+
export type BuildOptionsLike = {
|
9
|
+
cacheDirPath: string;
|
10
|
+
npmWorkspaceRootDirPath: string;
|
11
|
+
};
|
12
|
+
|
13
|
+
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
14
|
+
|
15
|
+
export async function downloadKeycloakDefaultTheme(params: {
|
16
|
+
keycloakVersion: string;
|
17
|
+
buildOptions: BuildOptionsLike;
|
18
|
+
}): Promise<{ defaultThemeDirPath: string }> {
|
19
|
+
const { keycloakVersion, buildOptions } = params;
|
20
|
+
|
21
|
+
const { extractedDirPath } = await downloadAndExtractArchive({
|
22
|
+
url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
|
23
|
+
cacheDirPath: buildOptions.cacheDirPath,
|
24
|
+
npmWorkspaceRootDirPath: buildOptions.npmWorkspaceRootDirPath,
|
25
|
+
uniqueIdOfOnOnArchiveFile: "downloadKeycloakDefaultTheme",
|
26
|
+
onArchiveFile: async params => {
|
27
|
+
if (!isInside({ dirPath: "theme", filePath: params.fileRelativePath })) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
const { readFile, writeFile } = params;
|
32
|
+
|
33
|
+
const fileRelativePath = pathRelative("theme", params.fileRelativePath);
|
34
|
+
|
35
|
+
skip_keycloak_v2: {
|
36
|
+
if (
|
37
|
+
!isInside({
|
38
|
+
dirPath: pathJoin("keycloak.v2"),
|
39
|
+
filePath: fileRelativePath
|
40
|
+
})
|
41
|
+
) {
|
42
|
+
break skip_keycloak_v2;
|
43
|
+
}
|
44
|
+
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
|
48
|
+
last_account_v1_transformations: {
|
49
|
+
if (lastKeycloakVersionWithAccountV1 !== keycloakVersion) {
|
50
|
+
break last_account_v1_transformations;
|
51
|
+
}
|
52
|
+
|
53
|
+
patch_account_css: {
|
54
|
+
if (
|
55
|
+
fileRelativePath !==
|
56
|
+
pathJoin("keycloak", "account", "resources", "css", "account.css")
|
57
|
+
) {
|
58
|
+
break patch_account_css;
|
59
|
+
}
|
60
|
+
|
61
|
+
await writeFile({
|
62
|
+
fileRelativePath,
|
63
|
+
modifiedData: Buffer.from(
|
64
|
+
(await readFile())
|
65
|
+
.toString("utf8")
|
66
|
+
.replace("top: -34px;", "top: -34px !important;"),
|
67
|
+
"utf8"
|
68
|
+
)
|
69
|
+
});
|
70
|
+
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
|
74
|
+
skip_web_modules: {
|
75
|
+
if (
|
76
|
+
!isInside({
|
77
|
+
dirPath: pathJoin(
|
78
|
+
"keycloak",
|
79
|
+
"common",
|
80
|
+
"resources",
|
81
|
+
"web_modules"
|
82
|
+
),
|
83
|
+
filePath: fileRelativePath
|
84
|
+
})
|
85
|
+
) {
|
86
|
+
break skip_web_modules;
|
87
|
+
}
|
88
|
+
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
|
92
|
+
skip_unused_node_modules: {
|
93
|
+
const nodeModulesDirPath = pathJoin(
|
94
|
+
"keycloak",
|
95
|
+
"common",
|
96
|
+
"resources",
|
97
|
+
"node_modules"
|
98
|
+
);
|
99
|
+
|
100
|
+
if (
|
101
|
+
!isInside({
|
102
|
+
dirPath: nodeModulesDirPath,
|
103
|
+
filePath: fileRelativePath
|
104
|
+
})
|
105
|
+
) {
|
106
|
+
break skip_unused_node_modules;
|
107
|
+
}
|
108
|
+
|
109
|
+
const toKeepPrefixes = [
|
110
|
+
...[
|
111
|
+
"patternfly.min.css",
|
112
|
+
"patternfly-additions.min.css",
|
113
|
+
"patternfly-additions.min.css"
|
114
|
+
].map(fileBasename =>
|
115
|
+
pathJoin(
|
116
|
+
nodeModulesDirPath,
|
117
|
+
"patternfly",
|
118
|
+
"dist",
|
119
|
+
"css",
|
120
|
+
fileBasename
|
121
|
+
)
|
122
|
+
),
|
123
|
+
pathJoin(nodeModulesDirPath, "patternfly", "dist", "fonts")
|
124
|
+
];
|
125
|
+
|
126
|
+
if (
|
127
|
+
toKeepPrefixes.find(prefix =>
|
128
|
+
fileRelativePath.startsWith(prefix)
|
129
|
+
) !== undefined
|
130
|
+
) {
|
131
|
+
break skip_unused_node_modules;
|
132
|
+
}
|
133
|
+
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
skip_unused_resources: {
|
139
|
+
if (keycloakVersion !== "24.0.4") {
|
140
|
+
break skip_unused_resources;
|
141
|
+
}
|
142
|
+
|
143
|
+
for (const dirBasename of [
|
144
|
+
"@patternfly-v5",
|
145
|
+
"@rollup",
|
146
|
+
"rollup",
|
147
|
+
"react",
|
148
|
+
"react-dom",
|
149
|
+
"shx",
|
150
|
+
".pnpm"
|
151
|
+
]) {
|
152
|
+
if (
|
153
|
+
isInside({
|
154
|
+
dirPath: pathJoin(
|
155
|
+
"keycloak",
|
156
|
+
"common",
|
157
|
+
"resources",
|
158
|
+
"node_modules",
|
159
|
+
dirBasename
|
160
|
+
),
|
161
|
+
filePath: fileRelativePath
|
162
|
+
})
|
163
|
+
) {
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
for (const dirBasename of ["react", "react-dom"]) {
|
169
|
+
if (
|
170
|
+
isInside({
|
171
|
+
dirPath: pathJoin(
|
172
|
+
"keycloak",
|
173
|
+
"common",
|
174
|
+
"resources",
|
175
|
+
"vendor",
|
176
|
+
dirBasename
|
177
|
+
),
|
178
|
+
filePath: fileRelativePath
|
179
|
+
})
|
180
|
+
) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
if (
|
186
|
+
isInside({
|
187
|
+
dirPath: pathJoin(
|
188
|
+
"keycloak",
|
189
|
+
"common",
|
190
|
+
"resources",
|
191
|
+
"node_modules",
|
192
|
+
"@patternfly",
|
193
|
+
"react-core"
|
194
|
+
),
|
195
|
+
filePath: fileRelativePath
|
196
|
+
})
|
197
|
+
) {
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
await writeFile({ fileRelativePath });
|
203
|
+
}
|
204
|
+
});
|
205
|
+
|
206
|
+
return { defaultThemeDirPath: extractedDirPath };
|
207
|
+
}
|