keycloakify 10.0.0-rc.4 → 10.0.0-rc.6
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 +1 -1
- package/account/Template.js.map +1 -1
- package/account/i18n/baseMessages/index.js.map +1 -1
- package/account/i18n/i18n.js +1 -1
- package/account/i18n/i18n.js.map +1 -1
- package/account/index.d.ts +1 -1
- package/account/kcContext/KcContext.d.ts +62 -44
- package/account/kcContext/KcContext.js.map +1 -1
- package/account/kcContext/createGetKcContext.d.ts +3 -3
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/getKcContextFromWindow.js +1 -1
- package/account/kcContext/getKcContextFromWindow.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +22 -14
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/account/pages/Account.js +1 -1
- 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 +4 -6
- 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 +2 -2
- package/account/pages/Totp.js.map +1 -1
- package/bin/copy-keycloak-resources-to-public.d.ts +3 -13
- package/bin/copy-keycloak-resources-to-public.js +22 -166
- package/bin/copy-keycloak-resources-to-public.js.map +1 -1
- package/bin/download-builtin-keycloak-theme.d.ts +3 -9
- package/bin/download-builtin-keycloak-theme.js +15 -291
- package/bin/download-builtin-keycloak-theme.js.map +1 -1
- package/bin/eject-keycloak-page.d.ts +4 -1
- package/bin/eject-keycloak-page.js +126 -56
- package/bin/eject-keycloak-page.js.map +1 -1
- package/bin/initialize-email-theme.d.ts +4 -2
- package/bin/initialize-email-theme.js +17 -19
- package/bin/initialize-email-theme.js.map +1 -1
- package/bin/keycloakify/buildJars/buildJar.d.ts +1 -0
- package/bin/keycloakify/buildJars/buildJar.js +14 -25
- package/bin/keycloakify/buildJars/buildJar.js.map +1 -1
- package/bin/keycloakify/buildJars/buildJars.d.ts +1 -4
- package/bin/keycloakify/buildJars/buildJars.js +17 -8
- package/bin/keycloakify/buildJars/buildJars.js.map +1 -1
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +2 -1
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +39 -17
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.d.ts +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.js +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
- package/bin/keycloakify/generateFtl/index.d.ts +0 -1
- package/bin/keycloakify/generateFtl/index.js +0 -1
- package/bin/keycloakify/generateFtl/index.js.map +1 -1
- package/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.d.ts +1 -1
- package/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.js +7 -7
- package/bin/keycloakify/generateSrcMainResources/bringInAccountV1.js.map +1 -0
- package/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.d.ts +1 -1
- package/bin/keycloakify/generateSrcMainResources/generateMessageProperties.js.map +1 -0
- package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.d.ts +7 -0
- package/bin/keycloakify/{generateTheme/generateTheme.js → generateSrcMainResources/generateSrcMainResources.js} +13 -19
- package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.js.map +1 -0
- package/bin/keycloakify/{generateTheme/generateSrcMainResources.d.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.d.ts} +4 -8
- package/bin/keycloakify/{generateTheme/generateSrcMainResources.js → generateSrcMainResources/generateSrcMainResourcesForMainTheme.js} +54 -52
- package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.js.map +1 -0
- package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.d.ts +8 -0
- package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js +47 -0
- package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js.map +1 -0
- package/bin/keycloakify/generateSrcMainResources/index.d.ts +1 -0
- package/bin/keycloakify/{buildOptions → generateSrcMainResources}/index.js +1 -1
- package/bin/keycloakify/generateSrcMainResources/index.js.map +1 -0
- package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.d.ts +1 -1
- package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.js +3 -3
- package/bin/keycloakify/generateSrcMainResources/readExtraPageNames.js.map +1 -0
- package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.d.ts +1 -2
- package/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.js +3 -2
- package/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.js.map +1 -0
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js +1 -1
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
- package/bin/keycloakify/index.d.ts +0 -1
- package/bin/keycloakify/index.js +0 -5
- package/bin/keycloakify/index.js.map +1 -1
- package/bin/keycloakify/keycloakify.d.ts +4 -1
- package/bin/keycloakify/keycloakify.js +15 -61
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/bin/keycloakify/replacers/replaceImportsInCssCode.js +1 -1
- package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +1 -1
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +1 -1
- package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +1 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js.map +1 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js +1 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js.map +1 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js +1 -1
- package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js.map +1 -1
- package/bin/main.d.ts +5 -0
- package/bin/main.js +285 -0
- package/bin/main.js.map +1 -0
- package/bin/shared/KeycloakVersionRange.d.ts +5 -0
- package/bin/shared/KeycloakVersionRange.js +3 -0
- package/bin/shared/KeycloakVersionRange.js.map +1 -0
- package/bin/{keycloakify/buildOptions → shared}/buildOptions.d.ts +17 -1
- package/bin/{keycloakify/buildOptions → shared}/buildOptions.js +72 -35
- package/bin/shared/buildOptions.js.map +1 -0
- package/bin/{constants.d.ts → shared/constants.d.ts} +4 -2
- package/bin/shared/constants.js +15 -0
- package/bin/shared/constants.js.map +1 -0
- package/bin/shared/copyKeycloakResourcesToPublic.d.ts +8 -0
- package/bin/shared/copyKeycloakResourcesToPublic.js +175 -0
- package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -0
- package/bin/{downloadAndUnzip.js → shared/downloadAndUnzip.js} +11 -11
- package/bin/shared/downloadAndUnzip.js.map +1 -0
- package/bin/shared/downloadBuiltinKeycloakTheme.d.ts +9 -0
- package/bin/shared/downloadBuiltinKeycloakTheme.js +316 -0
- package/bin/shared/downloadBuiltinKeycloakTheme.js.map +1 -0
- package/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.d.ts +1 -1
- package/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.js +7 -7
- package/bin/shared/downloadKeycloakStaticResources.js.map +1 -0
- package/bin/shared/getJarFileBasename.d.ts +6 -0
- package/bin/shared/getJarFileBasename.js +10 -0
- package/bin/shared/getJarFileBasename.js.map +1 -0
- package/bin/{getThemeSrcDirPath.js → shared/getThemeSrcDirPath.js} +1 -1
- package/bin/shared/getThemeSrcDirPath.js.map +1 -0
- package/bin/shared/metaInfKeycloakThemes.d.ts +17 -0
- package/bin/shared/metaInfKeycloakThemes.js +51 -0
- package/bin/shared/metaInfKeycloakThemes.js.map +1 -0
- package/bin/{keycloakify/generateFtl/pageId.d.ts → shared/pageIds.d.ts} +1 -1
- package/bin/{keycloakify/generateFtl/pageId.js → shared/pageIds.js} +10 -2
- package/bin/shared/pageIds.js.map +1 -0
- package/bin/shared/promptKeycloakVersion.d.ts +5 -0
- package/bin/{promptKeycloakVersion.js → shared/promptKeycloakVersion.js} +32 -48
- package/bin/shared/promptKeycloakVersion.js.map +1 -0
- package/bin/start-keycloak-container.d.ts +4 -0
- package/bin/start-keycloak-container.js +209 -0
- package/bin/start-keycloak-container.js.map +1 -0
- package/bin/tools/SemVer.js +1 -1
- package/bin/tools/SemVer.js.map +1 -1
- package/bin/tools/String.prototype.replaceAll.js.map +1 -1
- package/bin/tools/crawl.js.map +1 -1
- package/bin/tools/crc32.js.map +1 -1
- package/bin/tools/deflate.js +10 -1
- package/bin/tools/deflate.js.map +1 -1
- package/bin/tools/fetchProxyOptions.js +9 -9
- package/bin/tools/fetchProxyOptions.js.map +1 -1
- package/bin/tools/fs.rm.js.map +1 -1
- package/bin/tools/fs.rmSync.js +4 -4
- package/bin/tools/fs.rmSync.js.map +1 -1
- package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +1 -1
- package/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.js +1 -13
- package/bin/tools/getNpmWorkspaceRootDirPath.js.map +1 -0
- package/bin/tools/getThisCodebaseRootDirPath.js.map +1 -1
- package/bin/tools/logger.d.ts +1 -1
- package/bin/tools/logger.js.map +1 -1
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +21 -24
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +1 -1
- package/bin/tools/octokit-addons/listTags.js +3 -2
- package/bin/tools/octokit-addons/listTags.js.map +1 -1
- package/bin/tools/transformCodebase.js.map +1 -1
- package/bin/tools/trimIndent.js.map +1 -1
- package/bin/tools/unzip.js.map +1 -1
- package/lib/BASE_URL.js.map +1 -1
- package/lib/keycloakJsAdapter.js.map +1 -1
- package/login/Fallback.js.map +1 -1
- package/login/Template.js +3 -3
- package/login/Template.js.map +1 -1
- package/login/UserProfileFormFields.js +17 -17
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/baseMessages/index.js.map +1 -1
- package/login/i18n/i18n.js +1 -1
- package/login/i18n/i18n.js.map +1 -1
- package/login/index.d.ts +1 -1
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.d.ts +3 -3
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/getKcContextFromWindow.js +1 -1
- package/login/kcContext/getKcContextFromWindow.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +1 -1
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/lib/useDownloadTerms.js.map +1 -1
- 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 +1 -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 +3 -3
- 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 +6 -6
- 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 +3 -3
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +129 -121
- package/src/PUBLIC_URL.ts +1 -1
- package/src/account/Fallback.tsx +3 -0
- package/src/account/index.ts +1 -1
- package/src/account/kcContext/KcContext.ts +73 -47
- package/src/account/kcContext/getKcContextFromWindow.ts +1 -1
- package/src/account/kcContext/kcContextMocks.ts +21 -15
- 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/Sessions.tsx +0 -3
- package/src/account/pages/Totp.tsx +20 -21
- package/src/bin/copy-keycloak-resources-to-public.ts +10 -106
- package/src/bin/download-builtin-keycloak-theme.ts +13 -273
- package/src/bin/eject-keycloak-page.ts +75 -19
- package/src/bin/initialize-email-theme.ts +16 -17
- package/src/bin/keycloakify/buildJars/buildJar.ts +13 -17
- package/src/bin/keycloakify/buildJars/buildJars.ts +14 -15
- package/src/bin/keycloakify/buildJars/generatePom.ts +1 -1
- package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +45 -18
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +2 -2
- package/src/bin/keycloakify/generateFtl/index.ts +0 -1
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/bringInAccountV1.ts +8 -7
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.ts +1 -1
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +32 -0
- package/src/bin/keycloakify/{generateTheme/generateSrcMainResources.ts → generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts} +38 -45
- package/src/bin/keycloakify/{generateTheme/generateThemeVariants.ts → generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts} +18 -12
- package/src/bin/keycloakify/generateSrcMainResources/index.ts +1 -0
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.ts +2 -2
- package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.ts +5 -4
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +2 -2
- package/src/bin/keycloakify/index.ts +0 -7
- package/src/bin/keycloakify/keycloakify.ts +16 -64
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +1 -1
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +2 -2
- package/src/bin/main.ts +151 -0
- package/src/bin/shared/KeycloakVersionRange.ts +7 -0
- package/src/bin/{keycloakify/buildOptions → shared}/buildOptions.ts +114 -24
- package/src/bin/{constants.ts → shared/constants.ts} +4 -2
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +87 -0
- package/src/bin/{downloadAndUnzip.ts → shared/downloadAndUnzip.ts} +6 -6
- package/src/bin/shared/downloadBuiltinKeycloakTheme.ts +264 -0
- package/src/bin/{keycloakify/generateTheme → shared}/downloadKeycloakStaticResources.ts +8 -8
- package/src/bin/shared/getJarFileBasename.ts +9 -0
- package/src/bin/{getThemeSrcDirPath.ts → shared/getThemeSrcDirPath.ts} +1 -1
- package/src/bin/shared/metaInfKeycloakThemes.ts +34 -0
- package/src/bin/{keycloakify/generateFtl/pageId.ts → shared/pageIds.ts} +9 -1
- package/src/bin/shared/promptKeycloakVersion.ts +69 -0
- package/src/bin/start-keycloak-container.ts +141 -0
- package/src/bin/tools/fs.rmSync.ts +4 -4
- package/src/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.ts +1 -23
- package/src/login/index.ts +1 -1
- package/src/login/kcContext/KcContext.ts +2 -2
- package/src/login/kcContext/getKcContextFromWindow.ts +1 -1
- package/src/login/kcContext/kcContextMocks.ts +2 -2
- package/src/vite-plugin/vite-plugin.ts +30 -41
- package/tools/Array.prototype.every.js.map +1 -1
- package/tools/HTMLElement.prototype.prepend.js.map +1 -1
- package/tools/clsx.js.map +1 -1
- 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/useInsertLinkTags.js.map +1 -1
- package/tools/useInsertScriptTags.js.map +1 -1
- package/tools/useSetClassName.js.map +1 -1
- package/vite-plugin/tsconfig.tsbuildinfo +1 -1
- package/vite-plugin/vite-plugin.d.ts +1 -2
- package/vite-plugin/vite-plugin.js +31 -51
- package/vite-plugin/vite-plugin.js.map +1 -1
- package/bin/constants.js +0 -13
- package/bin/constants.js.map +0 -1
- package/bin/downloadAndUnzip.js.map +0 -1
- package/bin/getThemeSrcDirPath.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.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.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.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/pageId.js.map +0 -1
- package/bin/keycloakify/generateTheme/bringInAccountV1.js.map +0 -1
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateMessageProperties.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateSrcMainResources.js.map +0 -1
- package/bin/keycloakify/generateTheme/generateTheme.d.ts +0 -13
- 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.js.map +0 -1
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +0 -1
- package/bin/promptKeycloakVersion.d.ts +0 -3
- package/bin/promptKeycloakVersion.js.map +0 -1
- package/src/bin/keycloakify/buildOptions/UserProvidedBuildOptions.ts +0 -21
- package/src/bin/keycloakify/buildOptions/getCacheDirPath.ts +0 -25
- 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/generateTheme.ts +0 -44
- package/src/bin/keycloakify/generateTheme/index.ts +0 -1
- package/src/bin/promptKeycloakVersion.ts +0 -49
- /package/bin/keycloakify/{generateTheme → generateSrcMainResources}/generateMessageProperties.js +0 -0
- /package/bin/{downloadAndUnzip.d.ts → shared/downloadAndUnzip.d.ts} +0 -0
- /package/bin/{getThemeSrcDirPath.d.ts → shared/getThemeSrcDirPath.d.ts} +0 -0
- /package/bin/{keycloakify/buildOptions → tools}/getNpmWorkspaceRootDirPath.d.ts +0 -0
@@ -1,12 +1,19 @@
|
|
1
1
|
import { join as pathJoin, extname as pathExtname, sep as pathSep } from "path";
|
2
2
|
import { transformCodebase } from "../../tools/transformCodebase";
|
3
|
+
import type { BuildOptions } from "../../shared/buildOptions";
|
4
|
+
import { readMetaInfKeycloakThemes, writeMetaInfKeycloakThemes } from "../../shared/metaInfKeycloakThemes";
|
3
5
|
import { assert } from "tsafe/assert";
|
4
|
-
import * as fs from "fs";
|
5
6
|
|
6
|
-
export
|
7
|
-
|
7
|
+
export type BuildOptionsLike = {
|
8
|
+
keycloakifyBuildDirPath: string;
|
9
|
+
};
|
8
10
|
|
9
|
-
|
11
|
+
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
12
|
+
|
13
|
+
export function generateSrcMainResourcesForThemeVariant(params: { themeName: string; themeVariantName: string; buildOptions: BuildOptionsLike }) {
|
14
|
+
const { themeName, themeVariantName, buildOptions } = params;
|
15
|
+
|
16
|
+
const mainThemeDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme", themeName);
|
10
17
|
|
11
18
|
transformCodebase({
|
12
19
|
"srcDirPath": mainThemeDirPath,
|
@@ -30,21 +37,20 @@ export function generateThemeVariations(params: { themeName: string; themeVarian
|
|
30
37
|
});
|
31
38
|
|
32
39
|
{
|
33
|
-
const
|
40
|
+
const updatedMetaInfKeycloakThemes = readMetaInfKeycloakThemes({ "keycloakifyBuildDirPath": buildOptions.keycloakifyBuildDirPath });
|
34
41
|
|
35
|
-
|
36
|
-
themes: { name: string; types: string[] }[];
|
37
|
-
};
|
38
|
-
|
39
|
-
modifiedParsedJson.themes.push({
|
42
|
+
updatedMetaInfKeycloakThemes.themes.push({
|
40
43
|
"name": themeVariantName,
|
41
44
|
"types": (() => {
|
42
|
-
const theme =
|
45
|
+
const theme = updatedMetaInfKeycloakThemes.themes.find(({ name }) => name === themeName);
|
43
46
|
assert(theme !== undefined);
|
44
47
|
return theme.types;
|
45
48
|
})()
|
46
49
|
});
|
47
50
|
|
48
|
-
|
51
|
+
writeMetaInfKeycloakThemes({
|
52
|
+
"keycloakifyBuildDirPath": buildOptions.keycloakifyBuildDirPath,
|
53
|
+
"metaInfKeycloakThemes": updatedMetaInfKeycloakThemes
|
54
|
+
});
|
49
55
|
}
|
50
56
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./generateSrcMainResources";
|
package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readExtraPageNames.ts
RENAMED
@@ -1,10 +1,10 @@
|
|
1
1
|
import { crawl } from "../../tools/crawl";
|
2
|
-
import { accountThemePageIds, loginThemePageIds } from "
|
2
|
+
import { accountThemePageIds, loginThemePageIds } from "../../shared/pageIds";
|
3
3
|
import { id } from "tsafe/id";
|
4
4
|
import { removeDuplicates } from "evt/tools/reducers/removeDuplicates";
|
5
5
|
import * as fs from "fs";
|
6
6
|
import { join as pathJoin } from "path";
|
7
|
-
import type { ThemeType } from "../../constants";
|
7
|
+
import type { ThemeType } from "../../shared/constants";
|
8
8
|
|
9
9
|
export function readExtraPagesNames(params: { themeSrcDirPath: string; themeType: ThemeType }): string[] {
|
10
10
|
const { themeSrcDirPath, themeType } = params;
|
package/src/bin/keycloakify/{generateTheme → generateSrcMainResources}/readFieldNameUsage.ts
RENAMED
@@ -1,15 +1,16 @@
|
|
1
1
|
import { crawl } from "../../tools/crawl";
|
2
2
|
import { join as pathJoin } from "path";
|
3
3
|
import * as fs from "fs";
|
4
|
-
import type { ThemeType } from "../../constants";
|
4
|
+
import type { ThemeType } from "../../shared/constants";
|
5
|
+
import { getThisCodebaseRootDirPath } from "../../tools/getThisCodebaseRootDirPath";
|
5
6
|
|
6
7
|
/** Assumes the theme type exists */
|
7
|
-
export function readFieldNameUsage(params: {
|
8
|
-
const {
|
8
|
+
export function readFieldNameUsage(params: { themeSrcDirPath: string; themeType: ThemeType }): string[] {
|
9
|
+
const { themeSrcDirPath, themeType } = params;
|
9
10
|
|
10
11
|
const fieldNames = new Set<string>();
|
11
12
|
|
12
|
-
for (const srcDirPath of [pathJoin(
|
13
|
+
for (const srcDirPath of [pathJoin(getThisCodebaseRootDirPath(), "src", themeType), pathJoin(themeSrcDirPath, themeType)]) {
|
13
14
|
const filePaths = crawl({ "dirPath": srcDirPath, "returnedPathsType": "absolute" }).filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath));
|
14
15
|
|
15
16
|
for (const filePath of filePaths) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as fs from "fs";
|
2
2
|
import { join as pathJoin, relative as pathRelative, basename as pathBasename } from "path";
|
3
3
|
import { assert } from "tsafe/assert";
|
4
|
-
import type { BuildOptions } from "
|
5
|
-
import { accountV1ThemeName } from "../constants";
|
4
|
+
import type { BuildOptions } from "../shared/buildOptions";
|
5
|
+
import { accountV1ThemeName } from "../shared/constants";
|
6
6
|
|
7
7
|
export type BuildOptionsLike = {
|
8
8
|
keycloakifyBuildDirPath: string;
|
@@ -1,25 +1,21 @@
|
|
1
|
-
import {
|
1
|
+
import { generateSrcMainResources } from "./generateSrcMainResources";
|
2
2
|
import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
|
3
3
|
import * as child_process from "child_process";
|
4
|
-
import { generateStartKeycloakTestingContainer } from "./generateStartKeycloakTestingContainer";
|
5
4
|
import * as fs from "fs";
|
6
|
-
import { readBuildOptions } from "
|
5
|
+
import { readBuildOptions } from "../shared/buildOptions";
|
7
6
|
import { getLogger } from "../tools/logger";
|
8
|
-
import {
|
9
|
-
import { getThisCodebaseRootDirPath } from "../tools/getThisCodebaseRootDirPath";
|
10
|
-
import { readThisNpmProjectVersion } from "../tools/readThisNpmProjectVersion";
|
11
|
-
import { keycloakifyBuildOptionsForPostPostBuildScriptEnvName } from "../constants";
|
7
|
+
import { vitePluginSubScriptEnvNames } from "../shared/constants";
|
12
8
|
import { buildJars } from "./buildJars";
|
9
|
+
import type { CliCommandOptions } from "../main";
|
13
10
|
|
14
|
-
export async function
|
15
|
-
const
|
16
|
-
|
17
|
-
});
|
11
|
+
export async function command(params: { cliCommandOptions: CliCommandOptions }) {
|
12
|
+
const { cliCommandOptions } = params;
|
13
|
+
|
14
|
+
const buildOptions = readBuildOptions({ cliCommandOptions });
|
18
15
|
|
19
16
|
const logger = getLogger({ "isSilent": buildOptions.isSilent });
|
20
|
-
logger.log("🔏 Building the keycloak theme...⌚");
|
21
17
|
|
22
|
-
|
18
|
+
logger.log("🔏 Building the keycloak theme...⌚");
|
23
19
|
|
24
20
|
{
|
25
21
|
if (!fs.existsSync(buildOptions.keycloakifyBuildDirPath)) {
|
@@ -29,12 +25,7 @@ export async function main() {
|
|
29
25
|
fs.writeFileSync(pathJoin(buildOptions.keycloakifyBuildDirPath, ".gitignore"), Buffer.from("*", "utf8"));
|
30
26
|
}
|
31
27
|
|
32
|
-
|
33
|
-
themeSrcDirPath,
|
34
|
-
"keycloakifySrcDirPath": pathJoin(getThisCodebaseRootDirPath(), "src"),
|
35
|
-
"keycloakifyVersion": readThisNpmProjectVersion(),
|
36
|
-
buildOptions
|
37
|
-
});
|
28
|
+
await generateSrcMainResources({ buildOptions });
|
38
29
|
|
39
30
|
run_post_build_script: {
|
40
31
|
if (buildOptions.bundler !== "vite") {
|
@@ -45,56 +36,17 @@ export async function main() {
|
|
45
36
|
"cwd": buildOptions.reactAppRootDirPath,
|
46
37
|
"env": {
|
47
38
|
...process.env,
|
48
|
-
[
|
39
|
+
[vitePluginSubScriptEnvNames.runPostBuildScript]: JSON.stringify(buildOptions)
|
49
40
|
}
|
50
41
|
});
|
51
42
|
}
|
52
43
|
|
53
|
-
|
54
|
-
doesImplementAccountTheme,
|
55
|
-
buildOptions
|
56
|
-
});
|
57
|
-
|
58
|
-
generateStartKeycloakTestingContainer({
|
59
|
-
"jarFilePath": pathJoin(buildOptions.keycloakifyBuildDirPath, lastJarFileBasename),
|
60
|
-
doesImplementAccountTheme,
|
61
|
-
buildOptions
|
62
|
-
});
|
44
|
+
await buildJars({ buildOptions });
|
63
45
|
|
64
46
|
logger.log(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
)}`,
|
70
|
-
"",
|
71
|
-
`To test your theme locally you can spin up a Keycloak container image with the theme pre loaded by running:`,
|
72
|
-
"",
|
73
|
-
`👉 $ .${pathSep}${pathRelative(
|
74
|
-
buildOptions.reactAppRootDirPath,
|
75
|
-
pathJoin(buildOptions.keycloakifyBuildDirPath, generateStartKeycloakTestingContainer.basename)
|
76
|
-
)} 👈`,
|
77
|
-
``,
|
78
|
-
`Once your container is up and running: `,
|
79
|
-
"- Log into the admin console 👉 http://localhost:8080/admin username: admin, password: admin 👈",
|
80
|
-
`- Create a realm: Master -> AddRealm -> Name: myrealm`,
|
81
|
-
`- Enable registration: Realm settings -> Login tab -> User registration: on`,
|
82
|
-
`- Enable the Account theme (optional): Realm settings -> Themes tab -> Account theme: ${buildOptions.themeNames[0]}`,
|
83
|
-
` Clients -> account -> Login theme: ${buildOptions.themeNames[0]}`,
|
84
|
-
`- Enable the email theme (optional): Realm settings -> Themes tab -> Email theme: ${buildOptions.themeNames[0]} (option will appear only if you have ran npx initialize-email-theme)`,
|
85
|
-
`- Create a client Clients -> Create -> Client ID: myclient`,
|
86
|
-
` Root URL: https://www.keycloak.org/app/`,
|
87
|
-
` Valid redirect URIs: https://www.keycloak.org/app* http://localhost* (localhost is optional)`,
|
88
|
-
` Valid post logout redirect URIs: https://www.keycloak.org/app* http://localhost*`,
|
89
|
-
` Web origins: *`,
|
90
|
-
` Login Theme: ${buildOptions.themeNames[0]}`,
|
91
|
-
` Save (button at the bottom of the page)`,
|
92
|
-
``,
|
93
|
-
`- Go to 👉 https://www.keycloak.org/app/ 👈 Click "Save" then "Sign in". You should see your login page`,
|
94
|
-
`- Got to 👉 http://localhost:8080/realms/myrealm/account 👈 to see your account theme`,
|
95
|
-
``,
|
96
|
-
`Video tutorial: https://youtu.be/WMyGZNHQkjU`,
|
97
|
-
``
|
98
|
-
].join("\n")
|
47
|
+
`✅ Your keycloak theme has been generated and bundled into .${pathSep}${pathJoin(
|
48
|
+
pathRelative(process.cwd(), buildOptions.keycloakifyBuildDirPath),
|
49
|
+
"keycloak-theme-for-kc-*.jar"
|
50
|
+
)}`
|
99
51
|
);
|
100
52
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as crypto from "crypto";
|
2
|
-
import type { BuildOptions } from "
|
2
|
+
import type { BuildOptions } from "../../shared/buildOptions";
|
3
3
|
import { assert } from "tsafe/assert";
|
4
|
-
import { basenameOfTheKeycloakifyResourcesDir } from "../../constants";
|
4
|
+
import { basenameOfTheKeycloakifyResourcesDir } from "../../shared/constants";
|
5
5
|
|
6
6
|
export type BuildOptionsLike = {
|
7
7
|
urlPathname: string | undefined;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { BuildOptions } from "
|
1
|
+
import type { BuildOptions } from "../../shared/buildOptions";
|
2
2
|
import { assert } from "tsafe/assert";
|
3
|
-
import { basenameOfTheKeycloakifyResourcesDir } from "../../constants";
|
3
|
+
import { basenameOfTheKeycloakifyResourcesDir } from "../../shared/constants";
|
4
4
|
|
5
5
|
export type BuildOptionsLike = {
|
6
6
|
urlPathname: string | undefined;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { assert } from "tsafe/assert";
|
2
|
-
import type { BuildOptions } from "
|
2
|
+
import type { BuildOptions } from "../../../shared/buildOptions";
|
3
3
|
import { replaceImportsInJsCode_vite } from "./vite";
|
4
4
|
import { replaceImportsInJsCode_webpack } from "./webpack";
|
5
5
|
import * as fs from "fs";
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "../../../constants";
|
1
|
+
import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "../../../shared/constants";
|
2
2
|
import { assert } from "tsafe/assert";
|
3
|
-
import type { BuildOptions } from "
|
3
|
+
import type { BuildOptions } from "../../../shared/buildOptions";
|
4
4
|
import * as nodePath from "path";
|
5
5
|
import { replaceAll } from "../../../tools/String.prototype.replaceAll";
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "../../../constants";
|
1
|
+
import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "../../../shared/constants";
|
2
2
|
import { assert } from "tsafe/assert";
|
3
|
-
import type { BuildOptions } from "
|
3
|
+
import type { BuildOptions } from "../../../shared/buildOptions";
|
4
4
|
import * as nodePath from "path";
|
5
5
|
import { replaceAll } from "../../../tools/String.prototype.replaceAll";
|
6
6
|
|
package/src/bin/main.ts
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
import { termost } from "termost";
|
4
|
+
import * as child_process from "child_process";
|
5
|
+
|
6
|
+
export type CliCommandOptions = {
|
7
|
+
isSilent: boolean;
|
8
|
+
reactAppRootDirPath: string | undefined;
|
9
|
+
};
|
10
|
+
|
11
|
+
const program = termost<CliCommandOptions>("Keycloak theme builder");
|
12
|
+
|
13
|
+
const optionsKeys: string[] = [];
|
14
|
+
|
15
|
+
program
|
16
|
+
.option({
|
17
|
+
"key": "reactAppRootDirPath",
|
18
|
+
"name": (() => {
|
19
|
+
const long = "project";
|
20
|
+
const short = "p";
|
21
|
+
|
22
|
+
optionsKeys.push(long, short);
|
23
|
+
|
24
|
+
return { long, short };
|
25
|
+
})(),
|
26
|
+
"description": "https://docs.keycloakify.dev/build-options#project-or-p-cli-option",
|
27
|
+
"defaultValue": undefined
|
28
|
+
})
|
29
|
+
.option({
|
30
|
+
"key": "isSilent",
|
31
|
+
"name": (() => {
|
32
|
+
const name = "silent";
|
33
|
+
|
34
|
+
optionsKeys.push(name);
|
35
|
+
|
36
|
+
return name;
|
37
|
+
})(),
|
38
|
+
"description": "https://docs.keycloakify.dev/build-options#silent",
|
39
|
+
"defaultValue": false
|
40
|
+
});
|
41
|
+
|
42
|
+
function skip(_context: any, argv: { options: Record<string, unknown> }) {
|
43
|
+
const unrecognizedOptionKey = Object.keys(argv.options).find(key => !optionsKeys.includes(key));
|
44
|
+
|
45
|
+
if (unrecognizedOptionKey !== undefined) {
|
46
|
+
console.error(`keycloakify: Unrecognized option: ${unrecognizedOptionKey.length === 1 ? "-" : "--"}${unrecognizedOptionKey}`);
|
47
|
+
process.exit(1);
|
48
|
+
}
|
49
|
+
|
50
|
+
return false;
|
51
|
+
}
|
52
|
+
|
53
|
+
async function runAndLogErrors(fn: () => Promise<void>) {
|
54
|
+
try {
|
55
|
+
await fn();
|
56
|
+
} catch (error) {
|
57
|
+
console.error(error);
|
58
|
+
process.exit(1);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
program
|
63
|
+
.command({
|
64
|
+
"name": "build",
|
65
|
+
"description": "Build the theme (default subcommand)."
|
66
|
+
})
|
67
|
+
.task({
|
68
|
+
skip,
|
69
|
+
"handler": async cliCommandOptions => {
|
70
|
+
const { command } = await import("./keycloakify");
|
71
|
+
await runAndLogErrors(() => command({ cliCommandOptions }));
|
72
|
+
}
|
73
|
+
});
|
74
|
+
|
75
|
+
program
|
76
|
+
.command({
|
77
|
+
"name": "download-builtin-keycloak-theme",
|
78
|
+
"description": "Download the built-in Keycloak theme."
|
79
|
+
})
|
80
|
+
.task({
|
81
|
+
skip,
|
82
|
+
"handler": async cliCommandOptions => {
|
83
|
+
const { command } = await import("./download-builtin-keycloak-theme");
|
84
|
+
await runAndLogErrors(() => command({ cliCommandOptions }));
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
program
|
89
|
+
.command({
|
90
|
+
"name": "eject-keycloak-page",
|
91
|
+
"description": "Eject a Keycloak page."
|
92
|
+
})
|
93
|
+
.task({
|
94
|
+
skip,
|
95
|
+
"handler": async cliCommandOptions => {
|
96
|
+
const { command } = await import("./eject-keycloak-page");
|
97
|
+
await runAndLogErrors(() => command({ cliCommandOptions }));
|
98
|
+
}
|
99
|
+
});
|
100
|
+
|
101
|
+
program
|
102
|
+
.command({
|
103
|
+
"name": "initialize-email-theme",
|
104
|
+
"description": "Initialize an email theme."
|
105
|
+
})
|
106
|
+
.task({
|
107
|
+
skip,
|
108
|
+
"handler": async cliCommandOptions => {
|
109
|
+
const { command } = await import("./initialize-email-theme");
|
110
|
+
await runAndLogErrors(() => command({ cliCommandOptions }));
|
111
|
+
}
|
112
|
+
});
|
113
|
+
|
114
|
+
program
|
115
|
+
.command({
|
116
|
+
"name": "start-keycloak-container",
|
117
|
+
"description": "Spin up a Keycloak container with the theme preloaded and the realm pre configured."
|
118
|
+
})
|
119
|
+
.task({
|
120
|
+
skip,
|
121
|
+
"handler": async cliCommandOptions => {
|
122
|
+
const { command } = await import("./start-keycloak-container");
|
123
|
+
await runAndLogErrors(() => command({ cliCommandOptions }));
|
124
|
+
}
|
125
|
+
});
|
126
|
+
|
127
|
+
program
|
128
|
+
.command({
|
129
|
+
"name": "copy-keycloak-resources-to-public",
|
130
|
+
"description": "(Webpack/Create-React-App only) Copy Keycloak default theme resources to the public directory."
|
131
|
+
})
|
132
|
+
.task({
|
133
|
+
skip,
|
134
|
+
"handler": async cliCommandOptions => {
|
135
|
+
const { command } = await import("./copy-keycloak-resources-to-public");
|
136
|
+
await runAndLogErrors(() => command({ cliCommandOptions }));
|
137
|
+
}
|
138
|
+
});
|
139
|
+
|
140
|
+
// Fallback to build command if no command is provided
|
141
|
+
{
|
142
|
+
const [, , ...rest] = process.argv;
|
143
|
+
|
144
|
+
if (rest.length === 0 || (rest[0].startsWith("-") && rest[0] !== "--help" && rest[0] !== "-h")) {
|
145
|
+
const { status } = child_process.spawnSync("npx", ["keycloakify", "build", ...rest], {
|
146
|
+
"stdio": "inherit"
|
147
|
+
});
|
148
|
+
|
149
|
+
process.exit(status ?? 1);
|
150
|
+
}
|
151
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export type KeycloakVersionRange = KeycloakVersionRange.WithAccountTheme | KeycloakVersionRange.WithoutAccountTheme;
|
2
|
+
|
3
|
+
export namespace KeycloakVersionRange {
|
4
|
+
export type WithoutAccountTheme = "21-and-below" | "22-and-above";
|
5
|
+
|
6
|
+
export type WithAccountTheme = "21-and-below" | "23" | "24-and-above";
|
7
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { parse as urlParse } from "url";
|
2
|
-
import { readParsedPackageJson } from "./parsedPackageJson";
|
3
2
|
import { join as pathJoin } from "path";
|
4
|
-
import
|
5
|
-
import {
|
6
|
-
import {
|
3
|
+
import { getAbsoluteAndInOsFormatPath } from "../tools/getAbsoluteAndInOsFormatPath";
|
4
|
+
import { getNpmWorkspaceRootDirPath } from "../tools/getNpmWorkspaceRootDirPath";
|
5
|
+
import type { CliCommandOptions } from "../main";
|
6
|
+
import { z } from "zod";
|
7
7
|
import * as fs from "fs";
|
8
|
-
import {
|
9
|
-
import
|
10
|
-
import {
|
8
|
+
import { assert } from "tsafe";
|
9
|
+
import * as child_process from "child_process";
|
10
|
+
import { vitePluginSubScriptEnvNames } from "./constants";
|
11
11
|
|
12
12
|
/** Consolidated build option gathered form CLI arguments and config in package.json */
|
13
13
|
export type BuildOptions = {
|
@@ -20,6 +20,7 @@ export type BuildOptions = {
|
|
20
20
|
artifactId: string;
|
21
21
|
loginThemeResourcesFromKeycloakVersion: string;
|
22
22
|
reactAppRootDirPath: string;
|
23
|
+
// TODO: Remove from vite type
|
23
24
|
reactAppBuildDirPath: string;
|
24
25
|
/** Directory that keycloakify outputs to. Defaults to {cwd}/build_keycloak */
|
25
26
|
keycloakifyBuildDirPath: string;
|
@@ -32,23 +33,98 @@ export type BuildOptions = {
|
|
32
33
|
npmWorkspaceRootDirPath: string;
|
33
34
|
};
|
34
35
|
|
35
|
-
export
|
36
|
-
|
36
|
+
export type UserProvidedBuildOptions = {
|
37
|
+
extraThemeProperties?: string[];
|
38
|
+
artifactId?: string;
|
39
|
+
groupId?: string;
|
40
|
+
loginThemeResourcesFromKeycloakVersion?: string;
|
41
|
+
keycloakifyBuildDirPath?: string;
|
42
|
+
themeName?: string | string[];
|
43
|
+
};
|
44
|
+
|
45
|
+
export type ResolvedViteConfig = {
|
46
|
+
buildDir: string;
|
47
|
+
publicDir: string;
|
48
|
+
assetsDir: string;
|
49
|
+
urlPathname: string | undefined;
|
50
|
+
userProvidedBuildOptions: UserProvidedBuildOptions;
|
51
|
+
};
|
52
|
+
|
53
|
+
export function readBuildOptions(params: { cliCommandOptions: CliCommandOptions }): BuildOptions {
|
54
|
+
const { cliCommandOptions } = params;
|
55
|
+
|
56
|
+
const reactAppRootDirPath = (() => {
|
57
|
+
if (cliCommandOptions.reactAppRootDirPath === undefined) {
|
58
|
+
return process.cwd();
|
59
|
+
}
|
60
|
+
|
61
|
+
return getAbsoluteAndInOsFormatPath({
|
62
|
+
"pathIsh": cliCommandOptions.reactAppRootDirPath,
|
63
|
+
"cwd": process.cwd()
|
64
|
+
});
|
65
|
+
})();
|
66
|
+
|
67
|
+
const { resolvedViteConfig } = (() => {
|
68
|
+
if (fs.readdirSync(reactAppRootDirPath).find(fileBasename => fileBasename.startsWith("vite.config")) === undefined) {
|
69
|
+
return { "resolvedViteConfig": undefined };
|
70
|
+
}
|
71
|
+
|
72
|
+
const output = child_process
|
73
|
+
.execSync("npx vite", {
|
74
|
+
"cwd": reactAppRootDirPath,
|
75
|
+
"env": {
|
76
|
+
...process.env,
|
77
|
+
[vitePluginSubScriptEnvNames.resolveViteConfig]: "true"
|
78
|
+
}
|
79
|
+
})
|
80
|
+
.toString("utf8");
|
81
|
+
|
82
|
+
assert(output.includes(vitePluginSubScriptEnvNames.resolveViteConfig), "Seems like the Keycloakify's Vite plugin is not installed.");
|
83
|
+
|
84
|
+
const resolvedViteConfigStr = output.split(vitePluginSubScriptEnvNames.resolveViteConfig).reverse()[0];
|
37
85
|
|
38
|
-
|
86
|
+
const resolvedViteConfig: ResolvedViteConfig = JSON.parse(resolvedViteConfigStr);
|
39
87
|
|
40
|
-
|
88
|
+
return { resolvedViteConfig };
|
89
|
+
})();
|
90
|
+
|
91
|
+
const parsedPackageJson = (() => {
|
92
|
+
type ParsedPackageJson = {
|
93
|
+
name: string;
|
94
|
+
version?: string;
|
95
|
+
homepage?: string;
|
96
|
+
keycloakify?: UserProvidedBuildOptions & { reactAppBuildDirPath?: string };
|
97
|
+
};
|
41
98
|
|
42
|
-
|
99
|
+
const zParsedPackageJson = z.object({
|
100
|
+
"name": z.string(),
|
101
|
+
"version": z.string().optional(),
|
102
|
+
"homepage": z.string().optional(),
|
103
|
+
"keycloakify": z
|
104
|
+
.object({
|
105
|
+
"extraThemeProperties": z.array(z.string()).optional(),
|
106
|
+
"artifactId": z.string().optional(),
|
107
|
+
"groupId": z.string().optional(),
|
108
|
+
"loginThemeResourcesFromKeycloakVersion": z.string().optional(),
|
109
|
+
"reactAppBuildDirPath": z.string().optional(),
|
110
|
+
"keycloakifyBuildDirPath": z.string().optional(),
|
111
|
+
"themeName": z.union([z.string(), z.array(z.string())]).optional()
|
112
|
+
})
|
113
|
+
.optional()
|
114
|
+
});
|
43
115
|
|
44
|
-
|
45
|
-
|
46
|
-
|
116
|
+
{
|
117
|
+
type Got = ReturnType<(typeof zParsedPackageJson)["parse"]>;
|
118
|
+
type Expected = ParsedPackageJson;
|
119
|
+
assert<Got extends Expected ? true : false>();
|
120
|
+
assert<Expected extends Got ? true : false>();
|
121
|
+
}
|
47
122
|
|
48
|
-
|
123
|
+
return zParsedPackageJson.parse(JSON.parse(fs.readFileSync(pathJoin(reactAppRootDirPath, "package.json")).toString("utf8")));
|
124
|
+
})();
|
49
125
|
|
50
|
-
const userProvidedBuildOptions = {
|
51
|
-
...
|
126
|
+
const userProvidedBuildOptions: UserProvidedBuildOptions = {
|
127
|
+
...parsedPackageJson.keycloakify,
|
52
128
|
...resolvedViteConfig?.userProvidedBuildOptions
|
53
129
|
};
|
54
130
|
|
@@ -75,9 +151,9 @@ export function readBuildOptions(params: { processArgv: string[] }): BuildOption
|
|
75
151
|
break webpack;
|
76
152
|
}
|
77
153
|
|
78
|
-
if (
|
154
|
+
if (parsedPackageJson.keycloakify?.reactAppBuildDirPath !== undefined) {
|
79
155
|
return getAbsoluteAndInOsFormatPath({
|
80
|
-
"pathIsh":
|
156
|
+
"pathIsh": parsedPackageJson.keycloakify.reactAppBuildDirPath,
|
81
157
|
"cwd": reactAppRootDirPath
|
82
158
|
});
|
83
159
|
}
|
@@ -88,13 +164,11 @@ export function readBuildOptions(params: { processArgv: string[] }): BuildOption
|
|
88
164
|
return pathJoin(reactAppRootDirPath, resolvedViteConfig.buildDir);
|
89
165
|
})();
|
90
166
|
|
91
|
-
const argv = parseArgv(processArgv);
|
92
|
-
|
93
167
|
const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({ reactAppRootDirPath });
|
94
168
|
|
95
169
|
return {
|
96
170
|
"bundler": resolvedViteConfig !== undefined ? "vite" : "webpack",
|
97
|
-
"isSilent":
|
171
|
+
"isSilent": cliCommandOptions.isSilent,
|
98
172
|
"themeVersion": process.env.KEYCLOAKIFY_THEME_VERSION ?? parsedPackageJson.version ?? "0.0.0",
|
99
173
|
themeNames,
|
100
174
|
"extraThemeProperties": userProvidedBuildOptions.extraThemeProperties,
|
@@ -148,7 +222,23 @@ export function readBuildOptions(params: { processArgv: string[] }): BuildOption
|
|
148
222
|
|
149
223
|
return pathJoin(reactAppRootDirPath, resolvedViteConfig.publicDir);
|
150
224
|
})(),
|
151
|
-
cacheDirPath
|
225
|
+
"cacheDirPath": (() => {
|
226
|
+
const cacheDirPath = pathJoin(
|
227
|
+
(() => {
|
228
|
+
if (process.env.XDG_CACHE_HOME !== undefined) {
|
229
|
+
return getAbsoluteAndInOsFormatPath({
|
230
|
+
"pathIsh": process.env.XDG_CACHE_HOME,
|
231
|
+
"cwd": reactAppRootDirPath
|
232
|
+
});
|
233
|
+
}
|
234
|
+
|
235
|
+
return pathJoin(npmWorkspaceRootDirPath, "node_modules", ".cache");
|
236
|
+
})(),
|
237
|
+
"keycloakify"
|
238
|
+
);
|
239
|
+
|
240
|
+
return cacheDirPath;
|
241
|
+
})(),
|
152
242
|
"urlPathname": (() => {
|
153
243
|
webpack: {
|
154
244
|
if (resolvedViteConfig !== undefined) {
|
@@ -2,7 +2,6 @@ export const nameOfTheGlobal = "kcContext";
|
|
2
2
|
export const keycloak_resources = "keycloak-resources";
|
3
3
|
export const resources_common = "resources-common";
|
4
4
|
export const lastKeycloakVersionWithAccountV1 = "21.1.2";
|
5
|
-
export const resolvedViteConfigJsonBasename = "vite.json";
|
6
5
|
export const basenameOfTheKeycloakifyResourcesDir = "build";
|
7
6
|
|
8
7
|
export const themeTypes = ["login", "account"] as const;
|
@@ -10,4 +9,7 @@ export const accountV1ThemeName = "account-v1";
|
|
10
9
|
|
11
10
|
export type ThemeType = (typeof themeTypes)[number];
|
12
11
|
|
13
|
-
export const
|
12
|
+
export const vitePluginSubScriptEnvNames = {
|
13
|
+
"runPostBuildScript": "KEYCLOAKIFY_RUN_POST_BUILD_SCRIPT",
|
14
|
+
"resolveViteConfig": "KEYCLOAKIFY_RESOLVE_VITE_CONFIG"
|
15
|
+
} as const;
|