From 5ac8ffa5b58794eaeffbf9cdfd12f837a90a81d4 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Thu, 22 Aug 2024 09:57:15 +0200 Subject: [PATCH] Move unrelated files out of `common` resources (#32285) Closes #24861 Signed-off-by: Jon Koops --- .../topics/changes/changes-26_0_0.adoc | 16 +++ pnpm-lock.yaml | 34 +----- pnpm-workspace.yaml | 2 +- themes/.gitignore | 1 - .../common/resources => }/package.json | 2 - themes/pom.xml | 101 +++++++++++++++--- .../common/resources => }/rollup.config.js | 7 +- .../resources/theme/base/login/template.ftl | 2 +- .../theme/keycloak.v2/login/template.ftl | 2 +- .../theme/keycloak.v2/login/theme.properties | 2 +- .../theme/keycloak/login/theme.properties | 2 +- .../theme/keycloak/welcome/theme.properties | 2 +- 12 files changed, 113 insertions(+), 60 deletions(-) delete mode 100644 themes/.gitignore rename themes/{src/main/resources/theme/keycloak/common/resources => }/package.json (92%) rename themes/{src/main/resources/theme/keycloak/common/resources => }/rollup.config.js (83%) diff --git a/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc b/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc index a37922af554..b91714b2442 100644 --- a/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc +++ b/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc @@ -167,3 +167,19 @@ If the table currently contains more than 300.000 entries, on the console during migration. In this case, the statements must be run manually in the DB after {project_name}'s startup. Also, the `kc.org` and `hideOnLoginPage` configuration attributes were migrated to the identity provider itself, to allow for more efficient queries when searching for providers. As such, API clients should use the `getOrganizationId/setOrganizationId` and `isHideOnLogin/setHideOnLogin` methods in the `IdentityProviderRepresentation`, and avoid setting these properties using the legacy config attributes that are now deprecated. + += Paths for `common` theme resources have changed + +Some of the paths for the `common` resources of the `keycloak` theme have changed, specifically the resources for third-party libraries. Make sure to update your custom themes accordingly: + +- `node_modules/patternfly/dist` is now `vendor/patternfly-v3` +- `node_modules/@patternfly/patternfly` is now `vendor/patternfly-v4` +- `node_modules/@patternfly-v5/patternfly` is now `vendor/patternfly-v5` +- `node_modules/rfc4648/lib` is now `vendor/rfc4648` + +Additionally, the following resources have been removed from the `common` theme: + +- `node_modules/alpinejs` +- `node_modules/jquery` + +If you previously used any of the removed resources in your theme, make sure to add them to your own theme resources instead. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 71cfa700d24..6d01be7061a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -482,7 +482,7 @@ importers: specifier: ^2.0.5 version: 2.0.5(@types/node@22.4.1)(jsdom@24.1.1)(lightningcss@1.26.0)(terser@5.31.3) - themes/src/main/resources/theme/keycloak/common/resources: + themes: dependencies: '@patternfly-v5/patternfly': specifier: npm:@patternfly/patternfly@^5.3.1 @@ -490,12 +490,6 @@ importers: '@patternfly/patternfly': specifier: ^4.224.5 version: 4.224.5 - alpinejs: - specifier: ^3.14.1 - version: 3.14.1 - jquery: - specifier: ^3.7.1 - version: 3.7.1 patternfly: specifier: ^3.59.5 version: 3.59.5 @@ -1928,12 +1922,6 @@ packages: typescript: optional: true - '@vue/reactivity@3.1.5': - resolution: {integrity: sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==} - - '@vue/shared@3.1.5': - resolution: {integrity: sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==} - '@vue/shared@3.4.27': resolution: {integrity: sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==} @@ -1992,9 +1980,6 @@ packages: ajv@8.13.0: resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==} - alpinejs@3.14.1: - resolution: {integrity: sha512-ICar8UsnRZAYvv/fCNfNeKMXNoXGUfwHrjx7LqXd08zIP95G2d9bAOuaL97re+1mgt/HojqHsfdOLo/A5LuWgQ==} - ansi-colors@4.1.3: resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} engines: {node: '>=6'} @@ -3493,9 +3478,6 @@ packages: jquery@3.4.1: resolution: {integrity: sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==} - jquery@3.7.1: - resolution: {integrity: sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==} - js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -5980,7 +5962,7 @@ snapshots: '@rollup/plugin-replace@5.0.7(rollup@4.21.0)': dependencies: '@rollup/pluginutils': 5.1.0(rollup@4.21.0) - magic-string: 0.30.10 + magic-string: 0.30.11 optionalDependencies: rollup: 4.21.0 @@ -6622,12 +6604,6 @@ snapshots: optionalDependencies: typescript: 5.5.4 - '@vue/reactivity@3.1.5': - dependencies: - '@vue/shared': 3.1.5 - - '@vue/shared@3.1.5': {} - '@vue/shared@3.4.27': {} abstract-logging@2.0.1: {} @@ -6686,10 +6662,6 @@ snapshots: require-from-string: 2.0.2 uri-js: 4.4.1 - alpinejs@3.14.1: - dependencies: - '@vue/reactivity': 3.1.5 - ansi-colors@4.1.3: {} ansi-escapes@4.3.2: @@ -8375,8 +8347,6 @@ snapshots: jquery@3.4.1: {} - jquery@3.7.1: {} - js-tokens@4.0.0: {} js-yaml@4.1.0: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7d52f42c03d..6042f9e345d 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,4 @@ packages: - js/apps/* - js/libs/* - - themes/src/main/resources/theme/keycloak/common/resources + - themes diff --git a/themes/.gitignore b/themes/.gitignore deleted file mode 100644 index 22d0d82f809..00000000000 --- a/themes/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor diff --git a/themes/src/main/resources/theme/keycloak/common/resources/package.json b/themes/package.json similarity index 92% rename from themes/src/main/resources/theme/keycloak/common/resources/package.json rename to themes/package.json index fbadb246cd0..78cc25da98a 100644 --- a/themes/src/main/resources/theme/keycloak/common/resources/package.json +++ b/themes/package.json @@ -9,8 +9,6 @@ "dependencies": { "@patternfly-v5/patternfly": "npm:@patternfly/patternfly@^5.3.1", "@patternfly/patternfly": "^4.224.5", - "alpinejs": "^3.14.1", - "jquery": "^3.7.1", "patternfly": "^3.59.5", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/themes/pom.xml b/themes/pom.xml index e93927b98ec..1ff3c9eaed6 100755 --- a/themes/pom.xml +++ b/themes/pom.xml @@ -13,12 +13,7 @@ jar - src/main/resources/theme/keycloak/common/resources - - src/main/resources/theme/keycloak/common/resources/node_modules - src/main/resources/theme/keycloak/common/resources/vendor - src/main/resources/theme/keycloak.v2/welcome/node_modules - src/main/resources/theme/keycloak.v2/welcome/resources/vendor + theme/keycloak/common/resources/vendor @@ -40,20 +35,92 @@ - - maven-source-plugin - - - **/node_modules/** - - - com.github.eirslett frontend-maven-plugin - - src/main/resources/theme/keycloak/common/resources - + + + maven-resources-plugin + + + copy-rfc4648 + generate-resources + + copy-resources + + + ${project.build.outputDirectory}/${dir.vendor}/rfc4648 + + + node_modules/rfc4648/lib + + rfc4648.js + + + + + + + copy-patternfly-v3 + generate-resources + + copy-resources + + + ${project.build.outputDirectory}/${dir.vendor}/patternfly-v3 + + + node_modules/patternfly/dist + + css/patternfly.min.css + css/patternfly-additions.min.css + fonts/** + img/** + + + + + + + copy-patternfly-v4 + generate-resources + + copy-resources + + + ${project.build.outputDirectory}/${dir.vendor}/patternfly-v4 + + + node_modules/@patternfly/patternfly + + patternfly.min.css + assets/** + + + + + + + copy-patternfly-v5 + generate-resources + + copy-resources + + + ${project.build.outputDirectory}/${dir.vendor}/patternfly-v5 + + + node_modules/@patternfly-v5/patternfly + + patternfly.min.css + patternfly-addons.css + assets/** + + + + + + diff --git a/themes/src/main/resources/theme/keycloak/common/resources/rollup.config.js b/themes/rollup.config.js similarity index 83% rename from themes/src/main/resources/theme/keycloak/common/resources/rollup.config.js rename to themes/rollup.config.js index d50b94b80b7..7cc197f5193 100644 --- a/themes/src/main/resources/theme/keycloak/common/resources/rollup.config.js +++ b/themes/rollup.config.js @@ -3,6 +3,7 @@ import { nodeResolve } from "@rollup/plugin-node-resolve"; import commonjs from "@rollup/plugin-commonjs"; import replace from "@rollup/plugin-replace"; import terser from "@rollup/plugin-terser"; +import path from "node:path"; const plugins = [ nodeResolve(), @@ -16,6 +17,8 @@ const plugins = [ terser(), ]; +const targetDir = "target/classes/theme/keycloak/common/resources/vendor"; + export default defineConfig([ { input: [ @@ -23,7 +26,7 @@ export default defineConfig([ "node_modules/react/cjs/react-jsx-runtime.production.min.js", ], output: { - dir: "vendor/react", + dir: path.join(targetDir, "react"), format: "es", }, plugins, @@ -31,7 +34,7 @@ export default defineConfig([ { input: "node_modules/react-dom/cjs/react-dom.production.min.js", output: { - dir: "vendor/react-dom", + dir: path.join(targetDir, "react-dom"), format: "es", }, external: ["react"], diff --git a/themes/src/main/resources/theme/base/login/template.ftl b/themes/src/main/resources/theme/base/login/template.ftl index f7ba320dfad..f82c7bbdb19 100644 --- a/themes/src/main/resources/theme/base/login/template.ftl +++ b/themes/src/main/resources/theme/base/login/template.ftl @@ -33,7 +33,7 @@ diff --git a/themes/src/main/resources/theme/keycloak.v2/login/template.ftl b/themes/src/main/resources/theme/keycloak.v2/login/template.ftl index e0e4a7040bc..c3d3544d6be 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/template.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/template.ftl @@ -28,7 +28,7 @@ diff --git a/themes/src/main/resources/theme/keycloak.v2/login/theme.properties b/themes/src/main/resources/theme/keycloak.v2/login/theme.properties index c684fcc4bd2..c5a86ee6926 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/theme.properties +++ b/themes/src/main/resources/theme/keycloak.v2/login/theme.properties @@ -2,7 +2,7 @@ parent=keycloak import=common/keycloak styles=css/styles.css -stylesCommon=node_modules/@patternfly-v5/patternfly/patternfly.min.css node_modules/@patternfly-v5/patternfly/patternfly-addons.css +stylesCommon=vendor/patternfly-v5/patternfly.min.css vendor/patternfly-v5/patternfly-addons.css kcFormGroupClass=pf-v5-c-form__group kcLabelClass=pf-v5-c-form__label diff --git a/themes/src/main/resources/theme/keycloak/login/theme.properties b/themes/src/main/resources/theme/keycloak/login/theme.properties index f3555bc833b..d7b2721489b 100644 --- a/themes/src/main/resources/theme/keycloak/login/theme.properties +++ b/themes/src/main/resources/theme/keycloak/login/theme.properties @@ -2,7 +2,7 @@ parent=base import=common/keycloak styles=css/login.css -stylesCommon=node_modules/@patternfly/patternfly/patternfly.min.css node_modules/patternfly/dist/css/patternfly.min.css node_modules/patternfly/dist/css/patternfly-additions.min.css lib/pficon/pficon.css +stylesCommon=vendor/patternfly-v4/patternfly.min.css vendor/patternfly-v3/css/patternfly.min.css vendor/patternfly-v3/css/patternfly-additions.min.css lib/pficon/pficon.css meta=viewport==width=device-width,initial-scale=1 diff --git a/themes/src/main/resources/theme/keycloak/welcome/theme.properties b/themes/src/main/resources/theme/keycloak/welcome/theme.properties index fe106f84e81..17f7fb42180 100644 --- a/themes/src/main/resources/theme/keycloak/welcome/theme.properties +++ b/themes/src/main/resources/theme/keycloak/welcome/theme.properties @@ -1,6 +1,6 @@ import=common/keycloak -stylesCommon=node_modules/@patternfly-v5/patternfly/patternfly.min.css node_modules/@patternfly-v5/patternfly/patternfly-addons.css +stylesCommon=vendor/patternfly-v5/patternfly.min.css vendor/patternfly-v5/patternfly-addons.css styles=css/welcome.css # When set to true, the user will be redirected to the Administration Console if an administrative users already exists.