Move unrelated files out of common resources (#32285)

Closes #24861

Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Jon Koops 2024-08-22 09:57:15 +02:00 committed by GitHub
parent 2cbe476c52
commit 5ac8ffa5b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 113 additions and 60 deletions

View file

@ -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. 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. 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.

View file

@ -482,7 +482,7 @@ importers:
specifier: ^2.0.5 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) 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: dependencies:
'@patternfly-v5/patternfly': '@patternfly-v5/patternfly':
specifier: npm:@patternfly/patternfly@^5.3.1 specifier: npm:@patternfly/patternfly@^5.3.1
@ -490,12 +490,6 @@ importers:
'@patternfly/patternfly': '@patternfly/patternfly':
specifier: ^4.224.5 specifier: ^4.224.5
version: 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: patternfly:
specifier: ^3.59.5 specifier: ^3.59.5
version: 3.59.5 version: 3.59.5
@ -1928,12 +1922,6 @@ packages:
typescript: typescript:
optional: true 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': '@vue/shared@3.4.27':
resolution: {integrity: sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==} resolution: {integrity: sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==}
@ -1992,9 +1980,6 @@ packages:
ajv@8.13.0: ajv@8.13.0:
resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==} resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==}
alpinejs@3.14.1:
resolution: {integrity: sha512-ICar8UsnRZAYvv/fCNfNeKMXNoXGUfwHrjx7LqXd08zIP95G2d9bAOuaL97re+1mgt/HojqHsfdOLo/A5LuWgQ==}
ansi-colors@4.1.3: ansi-colors@4.1.3:
resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -3493,9 +3478,6 @@ packages:
jquery@3.4.1: jquery@3.4.1:
resolution: {integrity: sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==} 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: js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
@ -5980,7 +5962,7 @@ snapshots:
'@rollup/plugin-replace@5.0.7(rollup@4.21.0)': '@rollup/plugin-replace@5.0.7(rollup@4.21.0)':
dependencies: dependencies:
'@rollup/pluginutils': 5.1.0(rollup@4.21.0) '@rollup/pluginutils': 5.1.0(rollup@4.21.0)
magic-string: 0.30.10 magic-string: 0.30.11
optionalDependencies: optionalDependencies:
rollup: 4.21.0 rollup: 4.21.0
@ -6622,12 +6604,6 @@ snapshots:
optionalDependencies: optionalDependencies:
typescript: 5.5.4 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': {} '@vue/shared@3.4.27': {}
abstract-logging@2.0.1: {} abstract-logging@2.0.1: {}
@ -6686,10 +6662,6 @@ snapshots:
require-from-string: 2.0.2 require-from-string: 2.0.2
uri-js: 4.4.1 uri-js: 4.4.1
alpinejs@3.14.1:
dependencies:
'@vue/reactivity': 3.1.5
ansi-colors@4.1.3: {} ansi-colors@4.1.3: {}
ansi-escapes@4.3.2: ansi-escapes@4.3.2:
@ -8375,8 +8347,6 @@ snapshots:
jquery@3.4.1: {} jquery@3.4.1: {}
jquery@3.7.1: {}
js-tokens@4.0.0: {} js-tokens@4.0.0: {}
js-yaml@4.1.0: js-yaml@4.1.0:

View file

@ -1,4 +1,4 @@
packages: packages:
- js/apps/* - js/apps/*
- js/libs/* - js/libs/*
- themes/src/main/resources/theme/keycloak/common/resources - themes

1
themes/.gitignore vendored
View file

@ -1 +0,0 @@
vendor

View file

@ -9,8 +9,6 @@
"dependencies": { "dependencies": {
"@patternfly-v5/patternfly": "npm:@patternfly/patternfly@^5.3.1", "@patternfly-v5/patternfly": "npm:@patternfly/patternfly@^5.3.1",
"@patternfly/patternfly": "^4.224.5", "@patternfly/patternfly": "^4.224.5",
"alpinejs": "^3.14.1",
"jquery": "^3.7.1",
"patternfly": "^3.59.5", "patternfly": "^3.59.5",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",

View file

@ -13,12 +13,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<dir.common>src/main/resources/theme/keycloak/common/resources</dir.common> <dir.vendor>theme/keycloak/common/resources/vendor</dir.vendor>
<!-- ignore folders for incremental builds by the maven build cache plugin -->
<maven.build.cache.exclude.value.1>src/main/resources/theme/keycloak/common/resources/node_modules</maven.build.cache.exclude.value.1>
<maven.build.cache.exclude.value.2>src/main/resources/theme/keycloak/common/resources/vendor</maven.build.cache.exclude.value.2>
<maven.build.cache.exclude.value.3>src/main/resources/theme/keycloak.v2/welcome/node_modules</maven.build.cache.exclude.value.3>
<maven.build.cache.exclude.value.4>src/main/resources/theme/keycloak.v2/welcome/resources/vendor</maven.build.cache.exclude.value.4>
</properties> </properties>
<dependencies> <dependencies>
@ -40,20 +35,92 @@
</resources> </resources>
<plugins> <plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/node_modules/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>com.github.eirslett</groupId> <groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId> <artifactId>frontend-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-rfc4648</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration> <configuration>
<workingDirectory>src/main/resources/theme/keycloak/common/resources</workingDirectory> <outputDirectory>${project.build.outputDirectory}/${dir.vendor}/rfc4648</outputDirectory>
<resources>
<resource>
<directory>node_modules/rfc4648/lib</directory>
<includes>
<include>rfc4648.js</include>
</includes>
</resource>
</resources>
</configuration> </configuration>
</execution>
<execution>
<id>copy-patternfly-v3</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/${dir.vendor}/patternfly-v3</outputDirectory>
<resources>
<resource>
<directory>node_modules/patternfly/dist</directory>
<includes>
<include>css/patternfly.min.css</include>
<include>css/patternfly-additions.min.css</include>
<include>fonts/**</include>
<include>img/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-patternfly-v4</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/${dir.vendor}/patternfly-v4</outputDirectory>
<resources>
<resource>
<directory>node_modules/@patternfly/patternfly</directory>
<includes>
<include>patternfly.min.css</include>
<include>assets/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-patternfly-v5</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/${dir.vendor}/patternfly-v5</outputDirectory>
<resources>
<resource>
<directory>node_modules/@patternfly-v5/patternfly</directory>
<includes>
<include>patternfly.min.css</include>
<include>patternfly-addons.css</include>
<include>assets/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View file

@ -3,6 +3,7 @@ import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs"; import commonjs from "@rollup/plugin-commonjs";
import replace from "@rollup/plugin-replace"; import replace from "@rollup/plugin-replace";
import terser from "@rollup/plugin-terser"; import terser from "@rollup/plugin-terser";
import path from "node:path";
const plugins = [ const plugins = [
nodeResolve(), nodeResolve(),
@ -16,6 +17,8 @@ const plugins = [
terser(), terser(),
]; ];
const targetDir = "target/classes/theme/keycloak/common/resources/vendor";
export default defineConfig([ export default defineConfig([
{ {
input: [ input: [
@ -23,7 +26,7 @@ export default defineConfig([
"node_modules/react/cjs/react-jsx-runtime.production.min.js", "node_modules/react/cjs/react-jsx-runtime.production.min.js",
], ],
output: { output: {
dir: "vendor/react", dir: path.join(targetDir, "react"),
format: "es", format: "es",
}, },
plugins, plugins,
@ -31,7 +34,7 @@ export default defineConfig([
{ {
input: "node_modules/react-dom/cjs/react-dom.production.min.js", input: "node_modules/react-dom/cjs/react-dom.production.min.js",
output: { output: {
dir: "vendor/react-dom", dir: path.join(targetDir, "react-dom"),
format: "es", format: "es",
}, },
external: ["react"], external: ["react"],

View file

@ -33,7 +33,7 @@
<script type="importmap"> <script type="importmap">
{ {
"imports": { "imports": {
"rfc4648": "${url.resourcesCommonPath}/node_modules/rfc4648/lib/rfc4648.js" "rfc4648": "${url.resourcesCommonPath}/vendor/rfc4648/rfc4648.js"
} }
} }
</script> </script>

View file

@ -28,7 +28,7 @@
<script type="importmap"> <script type="importmap">
{ {
"imports": { "imports": {
"rfc4648": "${url.resourcesCommonPath}/node_modules/rfc4648/lib/rfc4648.js" "rfc4648": "${url.resourcesCommonPath}/vendor/rfc4648/rfc4648.js"
} }
} }
</script> </script>

View file

@ -2,7 +2,7 @@ parent=keycloak
import=common/keycloak import=common/keycloak
styles=css/styles.css 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 kcFormGroupClass=pf-v5-c-form__group
kcLabelClass=pf-v5-c-form__label kcLabelClass=pf-v5-c-form__label

View file

@ -2,7 +2,7 @@ parent=base
import=common/keycloak import=common/keycloak
styles=css/login.css 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 meta=viewport==width=device-width,initial-scale=1

View file

@ -1,6 +1,6 @@
import=common/keycloak 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 styles=css/welcome.css
# When set to true, the user will be redirected to the Administration Console if an administrative users already exists. # When set to true, the user will be redirected to the Administration Console if an administrative users already exists.