Rename build option, update readme

This commit is contained in:
garronej 2023-09-03 21:02:51 +02:00
parent 39ff7913d6
commit 21d6d27435
5 changed files with 18 additions and 71 deletions

View File

@ -127,6 +127,15 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
# Changelog highlights # Changelog highlights
## v9.0
Restore support for Keycloak 22.1 and up! Huge thanks to @xgp without whom this wouldn't have been possible.
Big thanks also to @ssilvert from the Keycloak team for being so open to discussion and merging [@xgp's PR](https://github.com/keycloak/keycloak/pull/22317).
### Breaking changes
Very few. Check them out [here](https://docs.keycloakify.dev/migration-guides/v8-greater-than-v9).
## 8.0 ## 8.0
- Much smaller .jar size. 70.2 MB -> 7.8 MB. - Much smaller .jar size. 70.2 MB -> 7.8 MB.
@ -135,58 +144,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
### Breaking changes ### Breaking changes
There are very few breaking changes in this major version. There are very few breaking changes in this major version. [Check them out](https://docs.keycloakify.dev/migration-guides/v7-greater-than-v8).
- The [`--external-assets` build option has been removed](https://docs.keycloakify.dev/v/v7/build-options#external-assets-deprecated) it was a performance optimization that is no longer relevant now that
we have lazy loading.
- `kcContext.usernameEditDisabled` is now `kcContext.usernameHidden`, the type was lying, it has been updated to reflect what's actually on the `kcContext` at runtime.
If you want to see in detail what should be updated [see issue](https://github.com/keycloakify/keycloakify/pull/399), or you can search and replace `usernameEditDisabled` -> `usernameHidden` it'll do the trick.
- The `usePrepareTemplate` prototype has been changed, you can search and replace:
`src/keycloak-theme/login/Template.tsx`
```ts
url,
"stylesCommon": [
"node_modules/patternfly/dist/css/patternfly.min.css",
"node_modules/patternfly/dist/css/patternfly-additions.min.css",
"lib/zocial/zocial.css"
],
"styles": ["css/login.css"],
```
by
```ts
"styles": [
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css`,
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly-additions.min.css`,
`${url.resourcesCommonPath}/lib/zocial/zocial.css`,
`${url.resourcesPath}/css/login.css`
],
```
and
`src/keycloak-theme/account/Template.css`
```ts
url,
"stylesCommon": ["node_modules/patternfly/dist/css/patternfly.min.css", "node_modules/patternfly/dist/css/patternfly-additions.min.css"],
"styles": ["css/account.css"],
```
by
```ts
"styles": [
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css`,
`${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly-additions.min.css`,
`${url.resourcesPath}/css/account.css`
],
```
## 7.15 ## 7.15

View File

@ -38,7 +38,7 @@ import * as fs from "fs";
"keycloakVersion": (() => { "keycloakVersion": (() => {
switch (themeType) { switch (themeType) {
case "login": case "login":
return buildOptions.loginThemeDefaultResourcesFromKeycloakVersion; return buildOptions.loginThemeResourcesFromKeycloakVersion;
case "account": case "account":
return lastKeycloakVersionWithAccountV1; return lastKeycloakVersionWithAccountV1;
} }

View File

@ -17,7 +17,7 @@ export type BuildOptions = {
groupId: string; groupId: string;
artifactId: string; artifactId: string;
bundler: Bundler; bundler: Bundler;
loginThemeDefaultResourcesFromKeycloakVersion: string; loginThemeResourcesFromKeycloakVersion: string;
/** Directory of your built react project. Defaults to {cwd}/build */ /** Directory of your built react project. Defaults to {cwd}/build */
reactAppBuildDirPath: string; reactAppBuildDirPath: string;
/** Directory that keycloakify outputs to. Defaults to {cwd}/build_keycloak */ /** Directory that keycloakify outputs to. Defaults to {cwd}/build_keycloak */
@ -42,15 +42,7 @@ export function readBuildOptions(params: { projectDirPath: string; processArgv:
const { name, keycloakify = {}, version, homepage } = parsedPackageJson; const { name, keycloakify = {}, version, homepage } = parsedPackageJson;
const { const { extraThemeProperties, groupId, artifactId, bundler, loginThemeResourcesFromKeycloakVersion, extraThemeNames = [] } = keycloakify ?? {};
extraThemeProperties,
groupId,
artifactId,
bundler,
keycloakVersionDefaultAssets,
loginThemeDefaultResourcesFromKeycloakVersion,
extraThemeNames = []
} = keycloakify ?? {};
const themeName = const themeName =
keycloakify.themeName ?? keycloakify.themeName ??
@ -91,7 +83,7 @@ export function readBuildOptions(params: { projectDirPath: string; processArgv:
"themeVersion": process.env.KEYCLOAKIFY_THEME_VERSION ?? process.env.KEYCLOAKIFY_VERSION ?? version ?? "0.0.0", "themeVersion": process.env.KEYCLOAKIFY_THEME_VERSION ?? process.env.KEYCLOAKIFY_VERSION ?? version ?? "0.0.0",
extraThemeProperties, extraThemeProperties,
"isSilent": isSilentCliParamProvided, "isSilent": isSilentCliParamProvided,
"loginThemeDefaultResourcesFromKeycloakVersion": loginThemeDefaultResourcesFromKeycloakVersion ?? keycloakVersionDefaultAssets ?? "11.0.3", "loginThemeResourcesFromKeycloakVersion": loginThemeResourcesFromKeycloakVersion ?? "11.0.3",
"reactAppBuildDirPath": (() => { "reactAppBuildDirPath": (() => {
let { reactAppBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {}; let { reactAppBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};

View File

@ -18,7 +18,7 @@ export type BuildOptionsLike = {
themeName: string; themeName: string;
extraThemeProperties: string[] | undefined; extraThemeProperties: string[] | undefined;
themeVersion: string; themeVersion: string;
loginThemeDefaultResourcesFromKeycloakVersion: string; loginThemeResourcesFromKeycloakVersion: string;
urlPathname: string | undefined; urlPathname: string | undefined;
}; };
@ -167,7 +167,7 @@ export async function generateTheme(params: {
case "account": case "account":
return lastKeycloakVersionWithAccountV1; return lastKeycloakVersionWithAccountV1;
case "login": case "login":
return buildOptions.loginThemeDefaultResourcesFromKeycloakVersion; return buildOptions.loginThemeResourcesFromKeycloakVersion;
} }
})(), })(),
themeDirPath, themeDirPath,

View File

@ -16,9 +16,7 @@ export type ParsedPackageJson = {
artifactId?: string; artifactId?: string;
groupId?: string; groupId?: string;
bundler?: Bundler; bundler?: Bundler;
/** @deprecated: Use loginThemeDefaultResourcesFromKeycloakVersion instead */ loginThemeResourcesFromKeycloakVersion?: string;
keycloakVersionDefaultAssets?: string;
loginThemeDefaultResourcesFromKeycloakVersion?: string;
reactAppBuildDirPath?: string; reactAppBuildDirPath?: string;
keycloakifyBuildDirPath?: string; keycloakifyBuildDirPath?: string;
themeName?: string; themeName?: string;
@ -37,8 +35,7 @@ export const zParsedPackageJson = z.object({
"artifactId": z.string().optional(), "artifactId": z.string().optional(),
"groupId": z.string().optional(), "groupId": z.string().optional(),
"bundler": z.enum(bundlers).optional(), "bundler": z.enum(bundlers).optional(),
"keycloakVersionDefaultAssets": z.string().optional(), "loginThemeResourcesFromKeycloakVersion": z.string().optional(),
"loginThemeDefaultResourcesFromKeycloakVersion": z.string().optional(),
"reactAppBuildDirPath": z.string().optional(), "reactAppBuildDirPath": z.string().optional(),
"keycloakifyBuildDirPath": z.string().optional(), "keycloakifyBuildDirPath": z.string().optional(),
"themeName": z.string().optional(), "themeName": z.string().optional(),