diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9970c3214980..16704cd6fcc8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -46,12 +46,6 @@ # UI (@keycloak/ui-maintainers) ################################################################################################### -/eslint.config.js @keycloak/ui-maintainers -/package.json @keycloak/ui-maintainers -/pnpm-lock.yaml @keycloak/ui-maintainers -/pnpm-workspace.yaml @keycloak/ui-maintainers -/tsconfig.eslint.json @keycloak/ui-maintainers -/tsconfig.json @keycloak/ui-maintainers /themes/ @keycloak/ui-maintainers @keycloak/maintainers /js/ @keycloak/ui-maintainers /js/**/maven-resources-community/**/messages_*.properties @keycloak/ui-maintainers @keycloak/maintainers diff --git a/.github/actions/conditional/conditions b/.github/actions/conditional/conditions index 8ff1d0260cf4..a75129ca99fc 100644 --- a/.github/actions/conditional/conditions +++ b/.github/actions/conditional/conditions @@ -32,12 +32,6 @@ operator/ operator docs/guides/ guides docs/documentation/ documentation -eslint.config.js js -package.json js -pnpm-lock.yaml js -pnpm-workspace.yaml js -tsconfig.eslint.json js -tsconfig.json js js/ js rest/admin-ui-ext/ js services/ js diff --git a/.github/actions/node-cache/action.yml b/.github/actions/node-cache/action.yml index 8f93edaf377b..583a9a62c214 100644 --- a/.github/actions/node-cache/action.yml +++ b/.github/actions/node-cache/action.yml @@ -8,8 +8,8 @@ runs: id: tooling-versions shell: bash run: | - echo "node=$(cat pom.xml | grep '' | cut -d '>' -f 2 | cut -d '<' -f 1 | cut -c 2-)" >> $GITHUB_OUTPUT - echo "pnpm=$(cat pom.xml | grep '' | cut -d '>' -f 2 | cut -d '<' -f 1 | cut -c 1-)" >> $GITHUB_OUTPUT + echo "node=$(cat js/pom.xml | grep '' | cut -d '>' -f 2 | cut -d '<' -f 1 | cut -c 2-)" >> $GITHUB_OUTPUT + echo "pnpm=$(cat js/pom.xml | grep '' | cut -d '>' -f 2 | cut -d '<' -f 1 | cut -c 1-)" >> $GITHUB_OUTPUT # Downloading Node.js often fails due to network issues, therefore we cache the artifacts downloaded by the frontend plugin. - uses: actions/cache@v4 diff --git a/.github/actions/pnpm-setup/action.yml b/.github/actions/pnpm-setup/action.yml index a92ff86c9291..350298a91390 100644 --- a/.github/actions/pnpm-setup/action.yml +++ b/.github/actions/pnpm-setup/action.yml @@ -29,6 +29,7 @@ runs: - name: Install dependencies shell: bash run: pnpm install --prefer-offline --frozen-lockfile + working-directory: js # This step is only needed to ensure that the Cypress binary is installed. # If the binary was retrieved from the cache, this step is a no-op. diff --git a/.github/workflows/js-ci.yml b/.github/workflows/js-ci.yml index b24eabca52be..9753fe779a2a 100644 --- a/.github/workflows/js-ci.yml +++ b/.github/workflows/js-ci.yml @@ -69,8 +69,10 @@ jobs: - uses: ./.github/actions/pnpm-setup - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} lint + working-directory: js - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} build + working-directory: js ui-shared: name: UI Shared @@ -85,8 +87,10 @@ jobs: - uses: ./.github/actions/pnpm-setup - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} lint + working-directory: js - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} build + working-directory: js account-ui: name: Account UI @@ -101,8 +105,10 @@ jobs: - uses: ./.github/actions/pnpm-setup - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} lint + working-directory: js - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} build + working-directory: js admin-ui: name: Admin UI @@ -117,12 +123,16 @@ jobs: - uses: ./.github/actions/pnpm-setup - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} lint + working-directory: js - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} test + working-directory: js - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} build + working-directory: js - run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} cy:check-types + working-directory: js account-ui-e2e: name: Account UI E2E @@ -156,9 +166,11 @@ jobs: - name: Install Playwright browsers run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} exec playwright install --with-deps + working-directory: js - name: Run Playwright tests run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} test + working-directory: js - name: Upload Playwright report uses: actions/upload-artifact@v4 @@ -228,6 +240,7 @@ jobs: - name: Compile Admin Client run: pnpm --fail-if-no-match --filter @keycloak/keycloak-admin-client build + working-directory: js - name: Download Keycloak server uses: actions/download-artifact@v4 @@ -249,6 +262,7 @@ jobs: - name: Start LDAP server run: pnpm --fail-if-no-match --filter ${{ env.WORKSPACE }} cy:ldap-server & + working-directory: js - name: Run Cypress uses: cypress-io/github-action@v6 diff --git a/.gitignore b/.gitignore index 5b390beb8947..750fb42afd14 100644 --- a/.gitignore +++ b/.gitignore @@ -86,24 +86,9 @@ quarkus/data/*.db # Git ephemeral files *.versionsBackup -# frontend-maven-plugin -node - -# Wireit -.wireit - -# Vite -dist - !/quarkus/dist !/quarkus/**/src/**/dist -# ESLint -.eslintcache - -# NPM -node_modules - # SDKMAM environment file .sdkmanrc diff --git a/js/.gitignore b/js/.gitignore new file mode 100644 index 000000000000..bdf4c1adb6dc --- /dev/null +++ b/js/.gitignore @@ -0,0 +1,14 @@ +# frontend-maven-plugin +node + +# Wireit +.wireit + +# Vite +dist + +# ESLint +.eslintcache + +# NPM +node_modules diff --git a/js/.husky/pre-commit b/js/.husky/pre-commit index 794e85077a1d..b9731090b30e 100755 --- a/js/.husky/pre-commit +++ b/js/.husky/pre-commit @@ -7,6 +7,9 @@ if [ ! -f "$FILE" ]; then exit 0; fi +# Change to the js directory. +cd js + # Exit if dependencies are not installed. if [ ! -d "node_modules" ]; then exit 0; diff --git a/js/apps/account-ui/tsconfig.json b/js/apps/account-ui/tsconfig.json index eeda960f6e27..e4350713ea82 100644 --- a/js/apps/account-ui/tsconfig.json +++ b/js/apps/account-ui/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.json", + "extends": "../../tsconfig.json", "include": ["src"], "exclude": ["**/*.test.ts", "**/*.test.tsx"] } diff --git a/js/apps/admin-ui/src/groups/MembershipsModal.tsx b/js/apps/admin-ui/src/groups/MembershipsModal.tsx index 829394d17445..3faa0d8bda19 100644 --- a/js/apps/admin-ui/src/groups/MembershipsModal.tsx +++ b/js/apps/admin-ui/src/groups/MembershipsModal.tsx @@ -1,5 +1,5 @@ import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/groupRepresentation"; -import UserRepresentation from "js/libs/keycloak-admin-client/lib/defs/userRepresentation"; +import UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation"; import { Modal, ModalVariant } from "@patternfly/react-core"; import { Button, diff --git a/js/apps/admin-ui/tsconfig.json b/js/apps/admin-ui/tsconfig.json index 56c74b912040..63f9e2b653fe 100644 --- a/js/apps/admin-ui/tsconfig.json +++ b/js/apps/admin-ui/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.json", + "extends": "../../tsconfig.json", "include": ["src"], "exclude": ["**/*.test.ts", "**/*.test.tsx"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/eslint.config.js b/js/eslint.config.js similarity index 97% rename from eslint.config.js rename to js/eslint.config.js index 4506dd2cb4a1..2aa0fdcf6977 100644 --- a/eslint.config.js +++ b/js/eslint.config.js @@ -161,16 +161,16 @@ export default tseslint.config( }, { ...playwright.configs["flat/recommended"], - files: ["js/apps/account-ui/test/**"], + files: ["apps/account-ui/test/**"], }, { - files: ["js/libs/keycloak-admin-client/test/**"], + files: ["libs/keycloak-admin-client/test/**"], rules: { "@typescript-eslint/no-unused-expressions": "off", }, }, { - files: ["js/libs/keycloak-admin-client/src/**"], + files: ["libs/keycloak-admin-client/src/**"], rules: { "@typescript-eslint/no-empty-object-type": "off", }, diff --git a/js/libs/keycloak-admin-client/tsconfig.json b/js/libs/keycloak-admin-client/tsconfig.json index c0932d4c75b9..f32b18cb6718 100644 --- a/js/libs/keycloak-admin-client/tsconfig.json +++ b/js/libs/keycloak-admin-client/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.json", + "extends": "../../tsconfig.json", "include": ["src"], "compilerOptions": { "module": "Node16", diff --git a/js/libs/ui-shared/tsconfig.json b/js/libs/ui-shared/tsconfig.json index eeda960f6e27..e4350713ea82 100644 --- a/js/libs/ui-shared/tsconfig.json +++ b/js/libs/ui-shared/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.json", + "extends": "../../tsconfig.json", "include": ["src"], "exclude": ["**/*.test.ts", "**/*.test.tsx"] } diff --git a/package.json b/js/package.json similarity index 97% rename from package.json rename to js/package.json index f7e4294757a6..ad2372061d0e 100644 --- a/package.json +++ b/js/package.json @@ -4,7 +4,7 @@ "type": "module", "packageManager": "pnpm@9.14.4+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab", "scripts": { - "prepare": "husky js/.husky" + "prepare": "cd .. && husky js/.husky" }, "devDependencies": { "@eslint/compat": "^1.2.3", diff --git a/pnpm-lock.yaml b/js/pnpm-lock.yaml similarity index 99% rename from pnpm-lock.yaml rename to js/pnpm-lock.yaml index 5d73bdee1bca..75f22ff0179e 100644 --- a/pnpm-lock.yaml +++ b/js/pnpm-lock.yaml @@ -72,7 +72,7 @@ importers: specifier: ^0.14.9 version: 0.14.9 - js/apps/account-ui: + apps/account-ui: dependencies: '@keycloak/keycloak-ui-shared': specifier: workspace:* @@ -148,7 +148,7 @@ importers: specifier: ^4.3.0 version: 4.3.0(@types/node@22.10.1)(rollup@4.27.4)(typescript@5.7.2)(vite@6.0.1(@types/node@22.10.1)(lightningcss@1.28.2)(terser@5.36.0)(tsx@4.19.2)(yaml@2.5.1)) - js/apps/admin-ui: + apps/admin-ui: dependencies: '@keycloak/keycloak-admin-client': specifier: workspace:* @@ -176,7 +176,7 @@ importers: version: 5.4.11(react-dom@18.3.1(react@18.3.1))(react@18.3.1) admin-ui: specifier: 'file:' - version: '@keycloak/keycloak-admin-ui@file:js/apps/admin-ui(@types/react@18.3.12)(typescript@5.7.2)' + version: '@keycloak/keycloak-admin-ui@file:apps/admin-ui(@types/react@18.3.12)(typescript@5.7.2)' dagre: specifier: ^0.8.5 version: 0.8.5 @@ -299,7 +299,7 @@ importers: specifier: ^2.1.6 version: 2.1.6(@types/node@22.10.1)(jsdom@25.0.1)(lightningcss@1.28.2)(terser@5.36.0)(tsx@4.19.2)(yaml@2.5.1) - js/apps/create-keycloak-theme: + apps/create-keycloak-theme: dependencies: chalk: specifier: ^5.3.0 @@ -317,7 +317,7 @@ importers: specifier: ^3.27.0 version: 3.27.0 - js/apps/keycloak-server: + apps/keycloak-server: dependencies: '@octokit/rest': specifier: ^21.0.2 @@ -335,7 +335,7 @@ importers: specifier: ^3.0.6 version: 3.0.6 - js/libs/keycloak-admin-client: + libs/keycloak-admin-client: dependencies: camelize-ts: specifier: ^3.0.0 @@ -375,9 +375,9 @@ importers: specifier: ^10.9.2 version: 10.9.2(@swc/core@1.9.3)(@types/node@22.10.1)(typescript@5.7.2) - js/libs/keycloak-js: {} + libs/keycloak-js: {} - js/libs/ui-shared: + libs/ui-shared: dependencies: '@keycloak/keycloak-admin-client': specifier: workspace:* @@ -447,7 +447,7 @@ importers: specifier: ^2.1.6 version: 2.1.6(@types/node@22.10.1)(jsdom@25.0.1)(lightningcss@1.28.2)(terser@5.36.0)(tsx@4.19.2)(yaml@2.5.1) - js/themes-vendor: + themes-vendor: dependencies: '@noble/hashes': specifier: ^1.6.1 @@ -1081,8 +1081,8 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@keycloak/keycloak-admin-ui@file:js/apps/admin-ui': - resolution: {directory: js/apps/admin-ui, type: directory} + '@keycloak/keycloak-admin-ui@file:apps/admin-ui': + resolution: {directory: apps/admin-ui, type: directory} '@kwsites/file-exists@1.1.1': resolution: {integrity: sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==} @@ -5509,10 +5509,10 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@keycloak/keycloak-admin-ui@file:js/apps/admin-ui(@types/react@18.3.12)(typescript@5.7.2)': + '@keycloak/keycloak-admin-ui@file:apps/admin-ui(@types/react@18.3.12)(typescript@5.7.2)': dependencies: - '@keycloak/keycloak-admin-client': link:js/libs/keycloak-admin-client - '@keycloak/keycloak-ui-shared': link:js/libs/ui-shared + '@keycloak/keycloak-admin-client': link:libs/keycloak-admin-client + '@keycloak/keycloak-ui-shared': link:libs/ui-shared '@patternfly/patternfly': 5.4.2 '@patternfly/react-code-editor': 5.4.13(monaco-editor@0.52.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@patternfly/react-core': 5.4.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -5524,7 +5524,7 @@ snapshots: flat: 6.0.1 i18next: 24.0.2(typescript@5.7.2) i18next-http-backend: 3.0.1 - keycloak-js: link:js/libs/keycloak-js + keycloak-js: link:libs/keycloak-js lodash-es: 4.17.21 monaco-editor: 0.52.0 p-debounce: 4.0.0 diff --git a/js/pnpm-workspace.yaml b/js/pnpm-workspace.yaml new file mode 100644 index 000000000000..dcccecca4adc --- /dev/null +++ b/js/pnpm-workspace.yaml @@ -0,0 +1,4 @@ +packages: + - apps/* + - libs/* + - themes-vendor diff --git a/js/pom.xml b/js/pom.xml index 20ca52aecabf..2d0f247b30e5 100644 --- a/js/pom.xml +++ b/js/pom.xml @@ -25,7 +25,94 @@ + v22.11.0 + 9.14.4 + + false src + + + + + + com.github.eirslett + frontend-maven-plugin + ${frontend.plugin.version} + + + + install-node-and-pnpm + + + + pnpm-install + + pnpm + + + install --prefer-offline --frozen-lockfile --ignore-scripts + ${maven.multiModuleProjectDirectory}/js + + + + pnpm-build + + pnpm + + + build + + + + + ${node.version} + ${pnpm.version} + ${maven.multiModuleProjectDirectory}/js + false + + + + org.apache.maven.plugins + maven-clean-plugin + + false + + ${js.skip.clean} + + + ${basedir} + + **/.wireit/** + **/node_modules/** + + + + + js/apps/keycloak-server + + server/** + + + + + + + + + + + + clean-when-not-on-windows + + + windows + + + + true + + + diff --git a/tsconfig.eslint.json b/js/tsconfig.eslint.json similarity index 100% rename from tsconfig.eslint.json rename to js/tsconfig.eslint.json diff --git a/tsconfig.json b/js/tsconfig.json similarity index 100% rename from tsconfig.json rename to js/tsconfig.json diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml deleted file mode 100644 index bc2eff8a6bf8..000000000000 --- a/pnpm-workspace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -packages: - - js/apps/* - - js/libs/* - - js/themes-vendor diff --git a/pom.xml b/pom.xml index b66b09217f2b..9c96c60d06a6 100644 --- a/pom.xml +++ b/pom.xml @@ -232,13 +232,6 @@ ${project.version} - - v22.11.0 - 9.14.4 - install --prefer-offline --frozen-lockfile --ignore-scripts - - false - false false @@ -1461,68 +1454,6 @@ target/verifier/verifications.xml - - org.apache.maven.plugins - maven-clean-plugin - - false - - ${js.skip.clean} - - - ${basedir} - - **/.wireit/** - **/node_modules/** - - - - - js/apps/keycloak-server - - server/** - - - - - - - com.github.eirslett - frontend-maven-plugin - ${frontend.plugin.version} - - - - install-node-and-pnpm - - - - pnpm-install - - pnpm - - - ${pnpm.args.install} - ${maven.multiModuleProjectDirectory} - - - - pnpm-build - - pnpm - - - build - - - - - ${node.version} - ${pnpm.version} - ${maven.multiModuleProjectDirectory} - false - - org.keycloak keycloak-distribution-licenses-maven-plugin @@ -1741,17 +1672,5 @@ keycloak-crypto-fips1402 - - - clean-when-not-on-windows - - - windows - - - - true - -