From 7dec6c7ebebad3a477d7bb5bbf56538eb4cba1b7 Mon Sep 17 00:00:00 2001 From: ts_ci Date: Tue, 2 Mar 2021 11:20:31 +0000 Subject: [PATCH] Enabling shorter import paths [automatic] --- .github/workflows/ci.yaml | 88 - .github/workflows/publish.yaml | 116 - .../ftlValuesGlobalName.d.ts | 1 + .../ftlValuesGlobalName.js | 5 + .../ftlValuesGlobalName.js.map | 1 + .../generateDebugFiles/index.d.ts | 6 + .../generateDebugFiles/index.js | 68 + .../generateDebugFiles/index.js.map | 1 + .../generateDebugFiles/standalone-ha.xml | 666 +++ .../generateFtl/ftl2js.ftl | 113 + .../generateFtl/index.d.ts | 11 + bin/build-keycloak-theme/generateFtl/index.js | 115 + .../generateFtl/index.js.map | 1 + .../generateJavaStackFiles.d.ts | 11 + .../generateJavaStackFiles.js | 73 + .../generateJavaStackFiles.js.map | 1 + .../generateKeycloakThemeResources.d.ts | 5 + .../generateKeycloakThemeResources.js | 92 + .../generateKeycloakThemeResources.js.map | 1 + bin/build-keycloak-theme/index.d.ts | 2 + bin/build-keycloak-theme/index.js | 86 + bin/build-keycloak-theme/index.js.map | 1 + .../replaceImportFromStatic.d.ts | 17 + .../replaceImportFromStatic.js | 94 + .../replaceImportFromStatic.js.map | 1 + bin/download-sample-keycloak-themes.d.ts | 2 + bin/download-sample-keycloak-themes.js | 15 + bin/download-sample-keycloak-themes.js.map | 1 + bin/generate-i18n-messages.d.ts | 1 + bin/generate-i18n-messages.js | 81 + bin/generate-i18n-messages.js.map | 1 + bin/tools/crawl.d.ts | 2 + bin/tools/crawl.js | 65 + bin/tools/crawl.js.map | 1 + bin/tools/downloadAndUnzip.d.ts | 4 + bin/tools/downloadAndUnzip.js | 40 + bin/tools/downloadAndUnzip.js.map | 1 + bin/tools/getProjectRoot.d.ts | 1 + bin/tools/getProjectRoot.js | 39 + bin/tools/getProjectRoot.js.map | 1 + bin/tools/grant-exec-perms.d.ts | 1 + bin/tools/grant-exec-perms.js | 30 + bin/tools/grant-exec-perms.js.map | 1 + bin/tools/transformCodebase.d.ts | 13 + bin/tools/transformCodebase.js | 66 + bin/tools/transformCodebase.js.map | 1 + lib/LoginPage.d.ts | 1 + lib/LoginPage.js | 31 + lib/LoginPage.js.map | 1 + lib/Template.d.ts | 23 + lib/Template.js | 111 + lib/Template.js.map | 1 + lib/i18n/generated_messages/account.d.ts | 3059 ++++++++++++ lib/i18n/generated_messages/account.js | 3067 ++++++++++++ lib/i18n/generated_messages/account.js.map | 1 + lib/i18n/generated_messages/admin.d.ts | 239 + lib/i18n/generated_messages/admin.js | 247 + lib/i18n/generated_messages/admin.js.map | 1 + lib/i18n/generated_messages/email.d.ts | 633 +++ lib/i18n/generated_messages/email.js | 641 +++ lib/i18n/generated_messages/email.js.map | 1 + lib/i18n/generated_messages/login.d.ts | 4359 ++++++++++++++++ lib/i18n/generated_messages/login.js | 4367 +++++++++++++++++ lib/i18n/generated_messages/login.js.map | 1 + lib/i18n/getLanguageLabel.d.ts | 3 + lib/i18n/getLanguageLabel.js | 32 + lib/i18n/getLanguageLabel.js.map | 1 + lib/i18n/useKeycloakLanguage.d.ts | 11 + lib/i18n/useKeycloakLanguage.js | 32 + lib/i18n/useKeycloakLanguage.js.map | 1 + lib/i18n/useKeycloakTranslation.d.ts | 6 + lib/i18n/useKeycloakTranslation.js | 28 + lib/i18n/useKeycloakTranslation.js.map | 1 + lib/index.d.ts | 4 + lib/index.js | 17 + lib/index.js.map | 1 + lib/keycloakFtlValues.d.ts | 35 + lib/keycloakFtlValues.js | 9 + lib/keycloakFtlValues.js.map | 1 + lib/tools/appendLinkInHead.d.ts | 3 + lib/tools/appendLinkInHead.js | 16 + lib/tools/appendLinkInHead.js.map | 1 + lib/tools/appendScriptInHead.d.ts | 3 + lib/tools/appendScriptInHead.js | 14 + lib/tools/appendScriptInHead.js.map | 1 + package.json | 135 +- test/build-keycloak-theme.d.ts | 1 + test/build-keycloak-theme.js | 29 + test/build-keycloak-theme.js.map | 1 + test/download-sample-keycloak-themes.d.ts | 1 + test/download-sample-keycloak-themes.js | 28 + test/download-sample-keycloak-themes.js.map | 1 + test/generateKeycloakThemeResources.d.ts | 1 + test/generateKeycloakThemeResources.js | 12 + test/generateKeycloakThemeResources.js.map | 1 + test/replaceImportFromStatic.d.ts | 1 + test/replaceImportFromStatic.js | 15 + test/replaceImportFromStatic.js.map | 1 + test/setupSampleReactProject.d.ts | 2 + test/setupSampleReactProject.js | 57 + test/setupSampleReactProject.js.map | 1 + tsconfig.tsbuildinfo | 1701 +++++++ 102 files changed, 20712 insertions(+), 223 deletions(-) delete mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/publish.yaml create mode 100644 bin/build-keycloak-theme/ftlValuesGlobalName.d.ts create mode 100644 bin/build-keycloak-theme/ftlValuesGlobalName.js create mode 100644 bin/build-keycloak-theme/ftlValuesGlobalName.js.map create mode 100644 bin/build-keycloak-theme/generateDebugFiles/index.d.ts create mode 100644 bin/build-keycloak-theme/generateDebugFiles/index.js create mode 100644 bin/build-keycloak-theme/generateDebugFiles/index.js.map create mode 100644 bin/build-keycloak-theme/generateDebugFiles/standalone-ha.xml create mode 100644 bin/build-keycloak-theme/generateFtl/ftl2js.ftl create mode 100644 bin/build-keycloak-theme/generateFtl/index.d.ts create mode 100644 bin/build-keycloak-theme/generateFtl/index.js create mode 100644 bin/build-keycloak-theme/generateFtl/index.js.map create mode 100644 bin/build-keycloak-theme/generateJavaStackFiles.d.ts create mode 100644 bin/build-keycloak-theme/generateJavaStackFiles.js create mode 100644 bin/build-keycloak-theme/generateJavaStackFiles.js.map create mode 100644 bin/build-keycloak-theme/generateKeycloakThemeResources.d.ts create mode 100644 bin/build-keycloak-theme/generateKeycloakThemeResources.js create mode 100644 bin/build-keycloak-theme/generateKeycloakThemeResources.js.map create mode 100644 bin/build-keycloak-theme/index.d.ts create mode 100755 bin/build-keycloak-theme/index.js create mode 100644 bin/build-keycloak-theme/index.js.map create mode 100644 bin/build-keycloak-theme/replaceImportFromStatic.d.ts create mode 100644 bin/build-keycloak-theme/replaceImportFromStatic.js create mode 100644 bin/build-keycloak-theme/replaceImportFromStatic.js.map create mode 100644 bin/download-sample-keycloak-themes.d.ts create mode 100755 bin/download-sample-keycloak-themes.js create mode 100644 bin/download-sample-keycloak-themes.js.map create mode 100644 bin/generate-i18n-messages.d.ts create mode 100644 bin/generate-i18n-messages.js create mode 100644 bin/generate-i18n-messages.js.map create mode 100644 bin/tools/crawl.d.ts create mode 100644 bin/tools/crawl.js create mode 100644 bin/tools/crawl.js.map create mode 100644 bin/tools/downloadAndUnzip.d.ts create mode 100644 bin/tools/downloadAndUnzip.js create mode 100644 bin/tools/downloadAndUnzip.js.map create mode 100644 bin/tools/getProjectRoot.d.ts create mode 100644 bin/tools/getProjectRoot.js create mode 100644 bin/tools/getProjectRoot.js.map create mode 100644 bin/tools/grant-exec-perms.d.ts create mode 100644 bin/tools/grant-exec-perms.js create mode 100644 bin/tools/grant-exec-perms.js.map create mode 100644 bin/tools/transformCodebase.d.ts create mode 100644 bin/tools/transformCodebase.js create mode 100644 bin/tools/transformCodebase.js.map create mode 100644 lib/LoginPage.d.ts create mode 100644 lib/LoginPage.js create mode 100644 lib/LoginPage.js.map create mode 100644 lib/Template.d.ts create mode 100644 lib/Template.js create mode 100644 lib/Template.js.map create mode 100644 lib/i18n/generated_messages/account.d.ts create mode 100644 lib/i18n/generated_messages/account.js create mode 100644 lib/i18n/generated_messages/account.js.map create mode 100644 lib/i18n/generated_messages/admin.d.ts create mode 100644 lib/i18n/generated_messages/admin.js create mode 100644 lib/i18n/generated_messages/admin.js.map create mode 100644 lib/i18n/generated_messages/email.d.ts create mode 100644 lib/i18n/generated_messages/email.js create mode 100644 lib/i18n/generated_messages/email.js.map create mode 100644 lib/i18n/generated_messages/login.d.ts create mode 100644 lib/i18n/generated_messages/login.js create mode 100644 lib/i18n/generated_messages/login.js.map create mode 100644 lib/i18n/getLanguageLabel.d.ts create mode 100644 lib/i18n/getLanguageLabel.js create mode 100644 lib/i18n/getLanguageLabel.js.map create mode 100644 lib/i18n/useKeycloakLanguage.d.ts create mode 100644 lib/i18n/useKeycloakLanguage.js create mode 100644 lib/i18n/useKeycloakLanguage.js.map create mode 100644 lib/i18n/useKeycloakTranslation.d.ts create mode 100644 lib/i18n/useKeycloakTranslation.js create mode 100644 lib/i18n/useKeycloakTranslation.js.map create mode 100644 lib/index.d.ts create mode 100644 lib/index.js create mode 100644 lib/index.js.map create mode 100644 lib/keycloakFtlValues.d.ts create mode 100644 lib/keycloakFtlValues.js create mode 100644 lib/keycloakFtlValues.js.map create mode 100644 lib/tools/appendLinkInHead.d.ts create mode 100644 lib/tools/appendLinkInHead.js create mode 100644 lib/tools/appendLinkInHead.js.map create mode 100644 lib/tools/appendScriptInHead.d.ts create mode 100644 lib/tools/appendScriptInHead.js create mode 100644 lib/tools/appendScriptInHead.js.map create mode 100644 test/build-keycloak-theme.d.ts create mode 100644 test/build-keycloak-theme.js create mode 100644 test/build-keycloak-theme.js.map create mode 100644 test/download-sample-keycloak-themes.d.ts create mode 100644 test/download-sample-keycloak-themes.js create mode 100644 test/download-sample-keycloak-themes.js.map create mode 100644 test/generateKeycloakThemeResources.d.ts create mode 100644 test/generateKeycloakThemeResources.js create mode 100644 test/generateKeycloakThemeResources.js.map create mode 100644 test/replaceImportFromStatic.d.ts create mode 100644 test/replaceImportFromStatic.js create mode 100644 test/replaceImportFromStatic.js.map create mode 100644 test/setupSampleReactProject.d.ts create mode 100644 test/setupSampleReactProject.js create mode 100644 test/setupSampleReactProject.js.map create mode 100644 tsconfig.tsbuildinfo diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 9154c7e3..00000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,88 +0,0 @@ -name: ci -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -jobs: - - test_node: - runs-on: ubuntu-latest - strategy: - matrix: - node: [ '14', '13', '12' ] - name: Test with Node v${{ matrix.node }} - steps: - - name: Tell if project is using npm or yarn - id: _1 - uses: garronej/github_actions_toolkit@v1.11 - with: - action_name: tell_if_project_uses_npm_or_yarn - owner: ${{github.repository_owner}} - repo: ${{github.event.repository.name}} - branch: ${{github.ref}} - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - if: steps._1.outputs.npm_or_yarn == 'yarn' - run: | - yarn install --frozen-lockfile - yarn run build - yarn run test - - if: steps._1.outputs.npm_or_yarn == 'npm' - run: | - npm ci - npm run build - npm run test - trigger_publish: - name: Trigger publish.yaml workflow if package.json version updated ( and secrets.PAT is set ). - runs-on: ubuntu-latest - env: - PAT: ${{secrets.PAT}} - if: github.event_name == 'push' && github.event.head_commit.author.name != 'ts_ci' - needs: test_node - steps: - - - name: Get version on latest - id: v_latest - uses: garronej/github_actions_toolkit@v1.11 - with: - action_name: get_package_json_version - owner: ${{github.repository_owner}} - repo: ${{github.event.repository.name}} - branch: latest - compare_to_version: '0.0.0' - - - name: Get version on develop - id: v_develop - uses: garronej/github_actions_toolkit@v1.11 - with: - action_name: get_package_json_version - owner: ${{github.repository_owner}} - repo: ${{github.event.repository.name}} - branch: ${{ github.sha }} - compare_to_version: ${{steps.v_latest.outputs.version || '0.0.0'}} - - - name: 'Trigger the ''publish'' workflow' - if: ${{ !!env.PAT && steps.v_develop.outputs.compare_result == '1' }} - uses: garronej/github_actions_toolkit@v1.11 - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - with: - action_name: dispatch_event - owner: ${{github.repository_owner}} - repo: ${{github.event.repository.name}} - event_type: publish - client_payload_json: | - ${{ - format( - '{{"from_version":"{0}","to_version":"{1}","repo":"{2}"}}', - steps.v_latest.outputs.version, - steps.v_develop.outputs.version, - github.event.repository.name - ) - }} \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index f973285f..00000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,116 +0,0 @@ -on: - repository_dispatch: - types: publish - -jobs: - update_changelog_and_sync_package_lock_version: - name: Update CHANGELOG.md and make sure package.json and package-lock.json versions matches. - runs-on: ubuntu-latest - steps: - - name: Synchronize package.json and package-lock.json version if needed. - uses: garronej/github_actions_toolkit@v1.11 - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - with: - action_name: sync_package_and_package_lock_version - owner: ${{github.repository_owner}} - repo: ${{github.event.client_payload.repo}} - branch: develop - commit_author_email: ts_ci@github.com - - name: Update CHANGELOG.md - if: ${{ !!github.event.client_payload.from_version }} - uses: garronej/github_actions_toolkit@v1.11 - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - with: - action_name: update_changelog - owner: ${{github.repository_owner}} - repo: ${{github.event.client_payload.repo}} - branch_behind: latest - branch_ahead: develop - commit_author_email: ts_ci@github.com - exclude_commit_from_author_names_json: '["ts_ci"]' - - publish: - runs-on: ubuntu-latest - needs: update_changelog_and_sync_package_lock_version - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: develop - - name: Remove .github directory, useless on 'latest' branch - run: rm -r .github - - name: Remove branch 'latest' - continue-on-error: true - run: | - git branch -d latest || true - git push origin :latest - - name: Create the new 'latest' branch - run: | - git branch latest - git checkout latest - - uses: actions/setup-node@v1 - - run: | - if [ -f "./yarn.lock" ]; then - yarn install --frozen-lockfile - else - npm ci - fi - - run: | - PACKAGE_MANAGER=npm - if [ -f "./yarn.lock" ]; then - PACKAGE_MANAGER=yarn - fi - $PACKAGE_MANAGER run enable_short_import_path - env: - DRY_RUN: "0" - - name: (DEBUG) Show how the files have been moved to enable short import - run: ls -lR - - name: Publishing on NPM - run: | - if [ "$(npm show . version)" = "$VERSION" ]; then - echo "This version is already published" - exit 0 - fi - if [ "$NPM_TOKEN" = "" ]; then - echo "Can't publish on NPM, You must first create a secret called NPM_TOKEN that contains your NPM auth token. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets" - false - fi - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc - npm publish - rm .npmrc - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - VERSION: ${{ github.event.client_payload.to_version }} - - name: Commit changes - run: | - git config --local user.email "ts_ci@github.com" - git config --local user.name "ts_ci" - git add -A - git commit -am "Enabling shorter import paths [automatic]" - - run: git push origin latest - - name: Release body - id: id_rb - run: | - if [ "$FROM_VERSION" = "" ]; then - echo "::set-output name=body::🚀" - else - echo "::set-output name=body::📋 [CHANGELOG](https://github.com/$OWNER/$REPO/blob/$REF/CHANGELOG.md)" - fi - env: - FROM_VERSION: ${{ github.event.client_payload.from_version }} - OWNER: ${{github.repository_owner}} - REPO: ${{github.event.client_payload.repo}} - REF: v${{github.event.client_payload.to_version}} - - name: Create Release - uses: garronej/create-release@master - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - with: - tag_name: v${{ github.event.client_payload.to_version }} - release_name: Release v${{ github.event.client_payload.to_version }} - branch: latest - draft: false - prerelease: false - body: ${{ steps.id_rb.outputs.body }} \ No newline at end of file diff --git a/bin/build-keycloak-theme/ftlValuesGlobalName.d.ts b/bin/build-keycloak-theme/ftlValuesGlobalName.d.ts new file mode 100644 index 00000000..8f34a276 --- /dev/null +++ b/bin/build-keycloak-theme/ftlValuesGlobalName.d.ts @@ -0,0 +1 @@ +export declare const ftlValuesGlobalName = "keycloakPagesContext"; diff --git a/bin/build-keycloak-theme/ftlValuesGlobalName.js b/bin/build-keycloak-theme/ftlValuesGlobalName.js new file mode 100644 index 00000000..50ada8a6 --- /dev/null +++ b/bin/build-keycloak-theme/ftlValuesGlobalName.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ftlValuesGlobalName = void 0; +exports.ftlValuesGlobalName = "keycloakPagesContext"; +//# sourceMappingURL=ftlValuesGlobalName.js.map \ No newline at end of file diff --git a/bin/build-keycloak-theme/ftlValuesGlobalName.js.map b/bin/build-keycloak-theme/ftlValuesGlobalName.js.map new file mode 100644 index 00000000..d6b0c558 --- /dev/null +++ b/bin/build-keycloak-theme/ftlValuesGlobalName.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ftlValuesGlobalName.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/ftlValuesGlobalName.ts"],"names":[],"mappings":";;;AACa,QAAA,mBAAmB,GAAG,sBAAsB,CAAC"} \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateDebugFiles/index.d.ts b/bin/build-keycloak-theme/generateDebugFiles/index.d.ts new file mode 100644 index 00000000..edd8e11e --- /dev/null +++ b/bin/build-keycloak-theme/generateDebugFiles/index.d.ts @@ -0,0 +1,6 @@ +export declare const containerLaunchScriptBasename = "start_keycloak_testing_container.sh"; +/** Files for being able to run a hot reload keycloak container */ +export declare function generateDebugFiles(params: { + packageJsonName: string; + keycloakThemeBuildingDirPath: string; +}): void; diff --git a/bin/build-keycloak-theme/generateDebugFiles/index.js b/bin/build-keycloak-theme/generateDebugFiles/index.js new file mode 100644 index 00000000..a145fda5 --- /dev/null +++ b/bin/build-keycloak-theme/generateDebugFiles/index.js @@ -0,0 +1,68 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateDebugFiles = exports.containerLaunchScriptBasename = void 0; +var fs = __importStar(require("fs")); +var path_1 = require("path"); +exports.containerLaunchScriptBasename = "start_keycloak_testing_container.sh"; +/** Files for being able to run a hot reload keycloak container */ +function generateDebugFiles(params) { + var packageJsonName = params.packageJsonName, keycloakThemeBuildingDirPath = params.keycloakThemeBuildingDirPath; + fs.writeFileSync(path_1.join(keycloakThemeBuildingDirPath, "Dockerfile"), Buffer.from([ + "FROM jboss/keycloak:11.0.3", + "", + "USER root", + "", + "WORKDIR /", + "", + "ADD configuration /opt/jboss/keycloak/standalone/configuration/", + "", + 'ENTRYPOINT [ "/opt/jboss/tools/docker-entrypoint.sh" ]', + ].join("\n"), "utf8")); + var dockerImage = packageJsonName + "/keycloak-hot-reload"; + var containerName = "keycloak-testing-container"; + fs.writeFileSync(path_1.join(keycloakThemeBuildingDirPath, exports.containerLaunchScriptBasename), Buffer.from([ + "#!/bin/bash", + "", + "cd " + keycloakThemeBuildingDirPath, + "", + "docker rm " + containerName + " || true", + "", + "docker build . -t " + dockerImage, + "", + "docker run \\", + " -p 8080:8080 \\", + "\t--name " + containerName + " \\", + " -e KEYCLOAK_USER=admin \\", + " -e KEYCLOAK_PASSWORD=admin \\", + "\t-v " + path_1.join(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", packageJsonName) + ":/opt/jboss/keycloak/themes/" + packageJsonName + ":rw \\", + "\t-it " + dockerImage + ":latest", + "" + ].join("\n"), "utf8"), { "mode": 493 }); + var standaloneHaFilePath = path_1.join(keycloakThemeBuildingDirPath, "configuration", "standalone-ha.xml"); + try { + fs.mkdirSync(path_1.dirname(standaloneHaFilePath)); + } + catch (_a) { } + fs.writeFileSync(standaloneHaFilePath, fs.readFileSync(path_1.join(__dirname, path_1.basename(standaloneHaFilePath)))); +} +exports.generateDebugFiles = generateDebugFiles; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateDebugFiles/index.js.map b/bin/build-keycloak-theme/generateDebugFiles/index.js.map new file mode 100644 index 00000000..5a2888ca --- /dev/null +++ b/bin/build-keycloak-theme/generateDebugFiles/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/build-keycloak-theme/generateDebugFiles/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,qCAAyB;AACzB,6BAA0F;AAE7E,QAAA,6BAA6B,GAAG,qCAAqC,CAAC;AAEnF,kEAAkE;AAClE,SAAgB,kBAAkB,CAC9B,MAGC;IAGO,IAAA,eAAe,GAAmC,MAAM,gBAAzC,EAAE,4BAA4B,GAAK,MAAM,6BAAX,CAAY;IAEjE,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,4BAA4B,EAAE,YAAY,CAAC,EACpD,MAAM,CAAC,IAAI,CACP;QACI,4BAA4B;QAC5B,EAAE;QACF,WAAW;QACX,EAAE;QACF,WAAW;QACX,EAAE;QACF,iEAAiE;QACjE,EAAE;QACF,wDAAwD;KAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ,MAAM,CACT,CACJ,CAAC;IAEF,IAAM,WAAW,GAAM,eAAe,yBAAsB,CAAC;IAC7D,IAAM,aAAa,GAAG,4BAA4B,CAAC;IAEnD,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,4BAA4B,EAAE,qCAA6B,CAAC,EACrE,MAAM,CAAC,IAAI,CACP;QACI,aAAa;QACb,EAAE;QACF,QAAM,4BAA8B;QACpC,EAAE;QACF,eAAa,aAAa,aAAU;QACpC,EAAE;QACF,uBAAqB,WAAa;QAClC,EAAE;QACF,eAAe;QACf,kBAAkB;QAClB,cAAW,aAAa,QAAK;QAC7B,4BAA4B;QAC5B,gCAAgC;QAChC,UAAO,WAAQ,CAAC,4BAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,CAAC,oCACpE,eAAe,WAAQ;QACtD,WAAQ,WAAW,YAAS;QAC5B,EAAE;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ,MAAM,CACT,EACD,EAAE,MAAM,EAAE,GAAK,EAAE,CACpB,CAAC;IAEF,IAAM,oBAAoB,GAAG,WAAQ,CAAC,4BAA4B,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAC;IAE1G,IAAI;QAAE,EAAE,CAAC,SAAS,CAAC,cAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC;KAAE;IAAC,WAAM,GAAG;IAElE,EAAE,CAAC,aAAa,CACZ,oBAAoB,EACpB,EAAE,CAAC,YAAY,CAAC,WAAQ,CAAC,SAAS,EAAE,eAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAC3E,CAAC;AAEN,CAAC;AAlED,gDAkEC"} \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateDebugFiles/standalone-ha.xml b/bin/build-keycloak-theme/generateDebugFiles/standalone-ha.xml new file mode 100644 index 00000000..19ca86ec --- /dev/null +++ b/bin/build-keycloak-theme/generateDebugFiles/standalone-ha.xml @@ -0,0 +1,666 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE + h2 + + 100 + + + sa + sa + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auth + + + classpath:${jboss.home.dir}/providers/* + + + master + 900 + + -1 + false + false + ${env.KEYCLOAK_WELCOME_THEME:keycloak} + ${env.KEYCLOAK_DEFAULT_THEME:keycloak} + ${jboss.home.dir}/themes + + + + + + + + + + + + + jpa + + + basic + + + + + + + + + + + + + + + + + + + default + + + + + + + + ${keycloak.jta.lookup.provider:jboss} + + + + + + + + + + + ${keycloak.x509cert.lookup.provider:default} + + + + ${keycloak.hostname.provider:default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateFtl/ftl2js.ftl b/bin/build-keycloak-theme/generateFtl/ftl2js.ftl new file mode 100644 index 00000000..54486631 --- /dev/null +++ b/bin/build-keycloak-theme/generateFtl/ftl2js.ftl @@ -0,0 +1,113 @@ + \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateFtl/index.d.ts b/bin/build-keycloak-theme/generateFtl/index.d.ts new file mode 100644 index 00000000..8e66a701 --- /dev/null +++ b/bin/build-keycloak-theme/generateFtl/index.d.ts @@ -0,0 +1,11 @@ +export declare function generateFtlFilesCodeFactory(params: { + ftlValuesGlobalName: string; + cssGlobalsToDefine: Record; + indexHtmlCode: string; +}): { + generateFtlFilesCode: (params: { + pageBasename: "login.ftl" | "register.ftl"; + }) => { + ftlCode: string; + }; +}; diff --git a/bin/build-keycloak-theme/generateFtl/index.js b/bin/build-keycloak-theme/generateFtl/index.js new file mode 100644 index 00000000..fc60b5f6 --- /dev/null +++ b/bin/build-keycloak-theme/generateFtl/index.js @@ -0,0 +1,115 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateFtlFilesCodeFactory = void 0; +var cheerio_1 = __importDefault(require("cheerio")); +var replaceImportFromStatic_1 = require("../replaceImportFromStatic"); +var fs_1 = __importDefault(require("fs")); +var path_1 = require("path"); +var objectKeys_1 = require("evt/tools/typeSafety/objectKeys"); +function generateFtlFilesCodeFactory(params) { + var ftlValuesGlobalName = params.ftlValuesGlobalName, cssGlobalsToDefine = params.cssGlobalsToDefine, indexHtmlCode = params.indexHtmlCode; + var $ = cheerio_1.default.load(indexHtmlCode); + $("script:not([src])").each(function () { + var _a = []; + for (var _i = 0; _i < arguments.length; _i++) { + _a[_i] = arguments[_i]; + } + var _b = __read(_a, 2), element = _b[1]; + var fixedJsCode = replaceImportFromStatic_1.replaceImportFromStaticInJsCode({ + ftlValuesGlobalName: ftlValuesGlobalName, + "jsCode": $(element).html() + }).fixedJsCode; + $(element).text(fixedJsCode); + }); + [ + ["link", "href"], + ["script", "src"], + ].forEach(function (_a) { + var _b = __read(_a, 2), selector = _b[0], attrName = _b[1]; + return $(selector).each(function () { + var _a = []; + for (var _i = 0; _i < arguments.length; _i++) { + _a[_i] = arguments[_i]; + } + var _b = __read(_a, 2), element = _b[1]; + var href = $(element).attr(attrName); + if (!(href === null || href === void 0 ? void 0 : href.startsWith("/"))) { + return; + } + $(element).attr(attrName, "${url.resourcesPath}/build" + href); + }); + }); + //FTL is no valid html, we can't insert with cheerio, we put placeholder for injecting later. + var ftlPlaceholders = { + '{ "x": "xIdLqMeOed9sdLdIdOxdK0d" }': fs_1.default.readFileSync(path_1.join(__dirname, "ftl2js.ftl")) + .toString("utf8") + .match(/^', + ' ', + '', + ].join("\n") + }; + $("head").prepend(__spreadArray(__spreadArray([], __read((Object.keys(cssGlobalsToDefine).length === 0 ? [] : [ + '', + '', + '' + ]))), [ + '', + '', + objectKeys_1.objectKeys(ftlPlaceholders)[1], + '' + ]).join("\n")); + var partiallyFixedIndexHtmlCode = $.html(); + function generateFtlFilesCode(params) { + var pageBasename = params.pageBasename; + var $ = cheerio_1.default.load(partiallyFixedIndexHtmlCode); + $("head").prepend([ + '', + '', + '' + ].join("\n")); + var ftlCode = $.html(); + objectKeys_1.objectKeys(ftlPlaceholders) + .forEach(function (id) { return ftlCode = ftlCode.replace(id, ftlPlaceholders[id]); }); + return { ftlCode: ftlCode }; + } + return { generateFtlFilesCode: generateFtlFilesCode }; +} +exports.generateFtlFilesCodeFactory = generateFtlFilesCodeFactory; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateFtl/index.js.map b/bin/build-keycloak-theme/generateFtl/index.js.map new file mode 100644 index 00000000..4d811f79 --- /dev/null +++ b/bin/build-keycloak-theme/generateFtl/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/build-keycloak-theme/generateFtl/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oDAA8B;AAC9B,sEAGoC;AACpC,0CAAoB;AACpB,6BAAwC;AACxC,8DAA6D;AAE7D,SAAgB,2BAA2B,CACvC,MAIC;IAGO,IAAA,mBAAmB,GAAwC,MAAM,oBAA9C,EAAE,kBAAkB,GAAoB,MAAM,mBAA1B,EAAE,aAAa,GAAK,MAAM,cAAX,CAAY;IAE1E,IAAM,CAAC,GAAG,iBAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEtC,CAAC,CAAC,mBAAmB,CAAC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O,CAAC,OAAO,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,EAAlD,CAAkD,CAAC,CAAC;QAEvE,OAAO,EAAE,OAAO,SAAA,EAAE,CAAC;IAEvB,CAAC;IAED,OAAO,EAAE,oBAAoB,sBAAA,EAAE,CAAC;AAGpC,CAAC;AAnHD,kEAmHC"} \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateJavaStackFiles.d.ts b/bin/build-keycloak-theme/generateJavaStackFiles.d.ts new file mode 100644 index 00000000..2b260c84 --- /dev/null +++ b/bin/build-keycloak-theme/generateJavaStackFiles.d.ts @@ -0,0 +1,11 @@ +export declare type ParsedPackageJson = { + name: string; + version: string; + homepage?: string; +}; +export declare function generateJavaStackFiles(params: { + parsedPackageJson: ParsedPackageJson; + keycloakThemeBuildingDirPath: string; +}): { + jarFilePath: string; +}; diff --git a/bin/build-keycloak-theme/generateJavaStackFiles.js b/bin/build-keycloak-theme/generateJavaStackFiles.js new file mode 100644 index 00000000..a7b7c63b --- /dev/null +++ b/bin/build-keycloak-theme/generateJavaStackFiles.js @@ -0,0 +1,73 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateJavaStackFiles = void 0; +var url = __importStar(require("url")); +var fs = __importStar(require("fs")); +var path_1 = require("path"); +function generateJavaStackFiles(params) { + var _a = params.parsedPackageJson, name = _a.name, version = _a.version, homepage = _a.homepage, keycloakThemeBuildingDirPath = params.keycloakThemeBuildingDirPath; + { + var pomFileCode = (function generatePomFileCode() { + var groupId = (function () { + var _a, _b; + var fallbackGroupId = "there.was.no.homepage.field.in.the.package.json." + name; + return (!homepage ? + fallbackGroupId : + (_b = (_a = url.parse(homepage).host) === null || _a === void 0 ? void 0 : _a.split(".").reverse().join(".")) !== null && _b !== void 0 ? _b : fallbackGroupId) + ".keycloak"; + })(); + var artefactId = name + "-keycloak-theme"; + var pomFileCode = [ + "", + "", + "\t4.0.0", + "\t" + groupId + "", + "\t" + artefactId + "", + "\t" + version + "", + "\t" + artefactId + "", + "\t", + "" + ].join("\n"); + return { pomFileCode: pomFileCode }; + })().pomFileCode; + fs.writeFileSync(path_1.join(keycloakThemeBuildingDirPath, "pom.xml"), Buffer.from(pomFileCode, "utf8")); + } + { + var themeManifestFilePath = path_1.join(keycloakThemeBuildingDirPath, "src", "main", "resources", "META-INF", "keycloak-themes.json"); + try { + fs.mkdirSync(path_1.dirname(themeManifestFilePath)); + } + catch (_b) { } + fs.writeFileSync(themeManifestFilePath, Buffer.from(JSON.stringify({ + "themes": [ + { + "name": name, + "types": ["login"] + } + ] + }, null, 2), "utf8")); + } + return { "jarFilePath": path_1.join(keycloakThemeBuildingDirPath, "target", name + "-" + version + ".jar") }; +} +exports.generateJavaStackFiles = generateJavaStackFiles; +//# sourceMappingURL=generateJavaStackFiles.js.map \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateJavaStackFiles.js.map b/bin/build-keycloak-theme/generateJavaStackFiles.js.map new file mode 100644 index 00000000..ceaf0c67 --- /dev/null +++ b/bin/build-keycloak-theme/generateJavaStackFiles.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generateJavaStackFiles.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/generateJavaStackFiles.ts"],"names":[],"mappings":";;;;;;;;;;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AE,KAAK,EAAE,MAAM,EAC3C,WAAW,EAAE,UAAU,EAAE,sBAAsB,CAClD,CAAC;QAEF,IAAI;YAEA,EAAE,CAAC,SAAS,CAAC,cAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC;SAEpD;QAAC,WAAM,GAAG;QAEX,EAAE,CAAC,aAAa,CACZ,qBAAqB,EACrB,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,SAAS,CAAC;YACX,QAAQ,EAAE;gBACN;oBACI,MAAM,EAAE,IAAI;oBACZ,OAAO,EAAE,CAAC,OAAO,CAAC;iBACrB;aACJ;SACJ,EAAE,IAAI,EAAE,CAAC,CAAC,EACX,MAAM,CACT,CACJ,CAAC;KAEL;IAED,OAAO,EAAE,aAAa,EAAE,WAAQ,CAAC,4BAA4B,EAAE,QAAQ,EAAK,IAAI,SAAI,OAAO,SAAM,CAAC,EAAE,CAAC;AAEzG,CAAC;AAvFD,wDAuFC"} \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateKeycloakThemeResources.d.ts b/bin/build-keycloak-theme/generateKeycloakThemeResources.d.ts new file mode 100644 index 00000000..26fd33ec --- /dev/null +++ b/bin/build-keycloak-theme/generateKeycloakThemeResources.d.ts @@ -0,0 +1,5 @@ +export declare function generateKeycloakThemeResources(params: { + themeName: string; + reactAppBuildDirPath: string; + keycloakThemeBuildingDirPath: string; +}): void; diff --git a/bin/build-keycloak-theme/generateKeycloakThemeResources.js b/bin/build-keycloak-theme/generateKeycloakThemeResources.js new file mode 100644 index 00000000..dc5b72de --- /dev/null +++ b/bin/build-keycloak-theme/generateKeycloakThemeResources.js @@ -0,0 +1,92 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateKeycloakThemeResources = void 0; +var transformCodebase_1 = require("../tools/transformCodebase"); +var fs = __importStar(require("fs")); +var path_1 = require("path"); +var replaceImportFromStatic_1 = require("./replaceImportFromStatic"); +var generateFtl_1 = require("./generateFtl"); +var download_sample_keycloak_themes_1 = require("../download-sample-keycloak-themes"); +var downloadAndUnzip_1 = require("../tools/downloadAndUnzip"); +var child_process = __importStar(require("child_process")); +var ftlValuesGlobalName_1 = require("./ftlValuesGlobalName"); +function generateKeycloakThemeResources(params) { + var themeName = params.themeName, reactAppBuildDirPath = params.reactAppBuildDirPath, keycloakThemeBuildingDirPath = params.keycloakThemeBuildingDirPath; + var themeDirPath = path_1.join(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", themeName, "login"); + var allCssGlobalsToDefine = {}; + transformCodebase_1.transformCodebase({ + "destDirPath": path_1.join(themeDirPath, "resources", "build"), + "srcDirPath": reactAppBuildDirPath, + "transformSourceCodeString": function (_a) { + var filePath = _a.filePath, sourceCode = _a.sourceCode; + if (/\.css?$/i.test(filePath)) { + var _b = replaceImportFromStatic_1.replaceImportFromStaticInCssCode({ "cssCode": sourceCode.toString("utf8") }), cssGlobalsToDefine = _b.cssGlobalsToDefine, fixedCssCode = _b.fixedCssCode; + allCssGlobalsToDefine = __assign(__assign({}, allCssGlobalsToDefine), cssGlobalsToDefine); + return { "modifiedSourceCode": Buffer.from(fixedCssCode, "utf8") }; + } + if (/\.js?$/i.test(filePath)) { + var fixedJsCode = replaceImportFromStatic_1.replaceImportFromStaticInJsCode({ + "jsCode": sourceCode.toString("utf8"), + ftlValuesGlobalName: ftlValuesGlobalName_1.ftlValuesGlobalName + }).fixedJsCode; + return { "modifiedSourceCode": Buffer.from(fixedJsCode, "utf8") }; + } + return { "modifiedSourceCode": sourceCode }; + } + }); + var generateFtlFilesCode = generateFtl_1.generateFtlFilesCodeFactory({ + "cssGlobalsToDefine": allCssGlobalsToDefine, + ftlValuesGlobalName: ftlValuesGlobalName_1.ftlValuesGlobalName, + "indexHtmlCode": fs.readFileSync(path_1.join(reactAppBuildDirPath, "index.html")).toString("utf8") + }).generateFtlFilesCode; + ["login.ftl", "register.ftl"].forEach(function (pageBasename) { + var ftlCode = generateFtlFilesCode({ pageBasename: pageBasename }).ftlCode; + fs.writeFileSync(path_1.join(themeDirPath, pageBasename), Buffer.from(ftlCode, "utf8")); + }); + { + var destDirPath = path_1.join(themeDirPath, "..", "tmp_xxKdLpdIdLd"); + downloadAndUnzip_1.downloadAndUnzip({ + "url": download_sample_keycloak_themes_1.keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl, + destDirPath: destDirPath + }); + child_process.execSync([ + "mv", + path_1.join("keycloak", "common"), + path_1.join("..", "common") + ].join(" "), { "cwd": destDirPath }); + child_process.execSync("rm -r " + destDirPath); + } + fs.writeFileSync(path_1.join(themeDirPath, "theme.properties"), Buffer.from("import=common/" + themeName + "\n", "utf8")); +} +exports.generateKeycloakThemeResources = generateKeycloakThemeResources; +//# sourceMappingURL=generateKeycloakThemeResources.js.map \ No newline at end of file diff --git a/bin/build-keycloak-theme/generateKeycloakThemeResources.js.map b/bin/build-keycloak-theme/generateKeycloakThemeResources.js.map new file mode 100644 index 00000000..67c7f9b2 --- /dev/null +++ b/bin/build-keycloak-theme/generateKeycloakThemeResources.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generateKeycloakThemeResources.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAA+D;AAC/D,qCAAyB;AACzB,6BAAwC;AACxC,qEAGmC;AACnC,6CAA4D;AAC5D,sFAAwG;AACxG,8DAA6D;AAC7D,2DAA+C;AAC/C,6DAA4D;AAE5D,SAAgB,8BAA8B,CAC1C,MAIC;IAGO,IAAA,SAAS,GAAyD,MAAM,UAA/D,EAAE,oBAAoB,GAAmC,MAAM,qBAAzC,EAAE,4BAA4B,GAAK,MAAM,6BAAX,CAAY;IAEjF,IAAM,YAAY,GAAG,WAAQ,CAAC,4BAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAErH,IAAI,qBAAqB,GAA2B,EAAE,CAAC;IAEvD,qCAAiB,CAAC;QACd,aAAa,EAAE,WAAQ,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC;QAC3D,YAAY,EAAE,oBAAoB;QAClC,2BAA2B,EAAE,UAAC,EAAwB;gBAAtB,QAAQ,cAAA,EAAE,UAAU,gBAAA;YAEhD,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAErB,IAAA,KAAuC,0DAAgC,CACzE,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAC7C,EAFO,kBAAkB,wBAAA,EAAE,YAAY,kBAEvC,CAAC;gBAEF,qBAAqB,yBACd,qBAAqB,GACrB,kBAAkB,CACxB,CAAC;gBAEF,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC;aAEtE;YAED,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAElB,I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E,WAAW,EAAE,CACzB,CAAC;QAEF,aAAa,CAAC,QAAQ,CAAC,WAAS,WAAa,CAAC,CAAC;KAElD;IAED,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC1C,MAAM,CAAC,IAAI,CAAC,mBAAiB,SAAS,OAAI,EAAE,MAAM,CAAC,CACtD,CAAC;AAEN,CAAC;AAhGD,wEAgGC"} \ No newline at end of file diff --git a/bin/build-keycloak-theme/index.d.ts b/bin/build-keycloak-theme/index.d.ts new file mode 100644 index 00000000..5e74aba1 --- /dev/null +++ b/bin/build-keycloak-theme/index.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export declare const keycloakThemeBuildingDirPath: string; diff --git a/bin/build-keycloak-theme/index.js b/bin/build-keycloak-theme/index.js new file mode 100755 index 00000000..7e6a53e2 --- /dev/null +++ b/bin/build-keycloak-theme/index.js @@ -0,0 +1,86 @@ +#!/usr/bin/env node +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.keycloakThemeBuildingDirPath = void 0; +var generateKeycloakThemeResources_1 = require("./generateKeycloakThemeResources"); +var generateJavaStackFiles_1 = require("./generateJavaStackFiles"); +var path_1 = require("path"); +var child_process = __importStar(require("child_process")); +var generateDebugFiles_1 = require("./generateDebugFiles"); +var reactProjectDirPath = process.cwd(); +var parsedPackageJson = require(path_1.join(reactProjectDirPath, "package.json")); +exports.keycloakThemeBuildingDirPath = path_1.join(reactProjectDirPath, "build_keycloak"); +if (require.main === module) { + console.log("🔏 Building the keycloak theme...⌚"); + generateKeycloakThemeResources_1.generateKeycloakThemeResources({ + keycloakThemeBuildingDirPath: exports.keycloakThemeBuildingDirPath, + "reactAppBuildDirPath": path_1.join(reactProjectDirPath, "build"), + "themeName": parsedPackageJson.name + }); + var jarFilePath = generateJavaStackFiles_1.generateJavaStackFiles({ + parsedPackageJson: parsedPackageJson, + keycloakThemeBuildingDirPath: exports.keycloakThemeBuildingDirPath + }).jarFilePath; + child_process.execSync("mvn package", { "cwd": exports.keycloakThemeBuildingDirPath }); + generateDebugFiles_1.generateDebugFiles({ + keycloakThemeBuildingDirPath: exports.keycloakThemeBuildingDirPath, + "packageJsonName": parsedPackageJson.name + }); + console.log([ + '', + "\u2705 Your keycloak theme has been generated and bundled into ./" + path_1.relative(reactProjectDirPath, jarFilePath) + " \uD83D\uDE80", + "It is to be placed in \"/opt/jboss/keycloak/standalone/deployments\" in the container running a jboss/keycloak Docker image. (Tested with 11.0.3)", + '', + 'Using Helm (https://github.com/codecentric/helm-charts), edit to reflect:', + '', + 'value.yaml: ', + ' extraInitContainers: |', + ' - name: realm-ext-provider', + ' image: curlimages/curl', + ' imagePullPolicy: IfNotPresent', + ' command:', + ' - sh', + ' args:', + ' - -c', + " - curl -L -f -S -o /extensions/" + path_1.basename(jarFilePath) + " https://AN.URL.FOR/" + path_1.basename(jarFilePath), + ' volumeMounts:', + ' - name: extensions', + ' mountPath: /extensions', + ' ', + ' extraVolumeMounts: |', + ' - name: extensions', + ' mountPath: /opt/jboss/keycloak/standalone/deployments', + '', + '', + 'To test your theme locally, with hot reloading, you can spin up a Keycloak container image with the theme loaded by running:', + '', + "\uD83D\uDC49 $ ./" + path_1.relative(reactProjectDirPath, path_1.join(exports.keycloakThemeBuildingDirPath, generateDebugFiles_1.containerLaunchScriptBasename)) + " \uD83D\uDC48", + '', + 'To enable the theme within keycloak log into the admin console ( 👉 http://localhost:8080 username: admin, password: admin 👈), create a realm (called "myrealm" for example),', + "go to your realm settings, click on the theme tab then select " + parsedPackageJson.name + ".", + "More details: https://www.keycloak.org/getting-started/getting-started-docker", + '', + 'Once your container is up and configured 👉 http://localhost:8080/auth/realms/myrealm/account 👈', + '', + ].join("\n")); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/bin/build-keycloak-theme/index.js.map b/bin/build-keycloak-theme/index.js.map new file mode 100644 index 00000000..442c57f1 --- /dev/null +++ b/bin/build-keycloak-theme/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,mFAAkF;AAClF,mEAAkE;AAElE,6BAA4F;AAC5F,2DAA+C;AAC/C,2DAAyF;AAGzF,IAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE1C,IAAM,iBAAiB,GAAsB,OAAO,CAAC,WAAQ,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC,CAAC;AAEvF,QAAA,4BAA4B,GAAG,WAAQ,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAG5F,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAEzB,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAElD,+DAA8B,CAAC;QAC3B,4BAA4B,sCAAA;QAC5B,sBAAsB,EAAE,WAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;QAC9D,WAAW,EAAE,iBAAiB,CAAC,IAAI;KACtC,CAAC,CAAC;IAEK,IAAA,WAAW,GAAK,+CAAsB,CAAC;QAC3C,iBAAiB,mBAAA;QACjB,4BAA4B,sCAAA;KAC/B,CAAC,YAHiB,CAGhB;IAEH,aAAa,CAAC,QAAQ,CAClB,aAAa,EACb,EAAE,KAAK,EAAE,oCAA4B,EAAE,CAC1C,CAAC;IAEF,uCAAkB,CAAC;QACf,4BAA4B,sCAAA;QAC5B,iBAAiB,EAAE,iBAAiB,CAAC,IAAI;KAC5C,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC;QACR,EAAE;QACF,sEAA+D,eAAY,CAAC,mBAAmB,EAAE,WAAW,CAAC,kBAAK;QAClH,mJAAiJ;QACjJ,EAAE;QACF,2EAA2E;QAC3E,EAAE;QACF,cAAc;QACd,4BAA4B;QAC5B,oCAAoC;QACpC,kCAAkC;QAClC,yCAAyC;QACzC,oBAAoB;QACpB,kBAAkB;QAClB,iBAAiB;QACjB,kBAAkB;QAClB,gDAA8C,eAAY,CAAC,WAAW,CAAC,4BAAuB,eAAY,CAAC,WAAW,CAAG;QACzH,yBAAyB;QACzB,gCAAgC;QAChC,sCAAsC;QACtC,UAAU;QACV,8BAA8B;QAC9B,gCAAgC;QAChC,qEAAqE;QACrE,EAAE;QACF,EAAE;QACF,8HAA8H;QAC9H,EAAE;QACF,sBAAU,eAAY,CAAC,mBAAmB,EAAE,WAAQ,CAAC,oCAA4B,EAAE,kDAA6B,CAAC,CAAC,kBAAK;QACvH,EAAE;QACF,gLAAgL;QAChL,mEAAiE,iBAAiB,CAAC,IAAI,MAAG;QAC1F,+EAA+E;QAC/E,EAAE;QACF,kGAAkG;QAClG,EAAE;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;CAEjB"} \ No newline at end of file diff --git a/bin/build-keycloak-theme/replaceImportFromStatic.d.ts b/bin/build-keycloak-theme/replaceImportFromStatic.d.ts new file mode 100644 index 00000000..3d55feef --- /dev/null +++ b/bin/build-keycloak-theme/replaceImportFromStatic.d.ts @@ -0,0 +1,17 @@ +export declare function replaceImportFromStaticInJsCode(params: { + ftlValuesGlobalName: string; + jsCode: string; +}): { + fixedJsCode: string; +}; +export declare function replaceImportFromStaticInCssCode(params: { + cssCode: string; +}): { + fixedCssCode: string; + cssGlobalsToDefine: Record; +}; +export declare function generateCssCodeToDefineGlobals(params: { + cssGlobalsToDefine: Record; +}): { + cssCodeToPrependInHead: string; +}; diff --git a/bin/build-keycloak-theme/replaceImportFromStatic.js b/bin/build-keycloak-theme/replaceImportFromStatic.js new file mode 100644 index 00000000..a81accd3 --- /dev/null +++ b/bin/build-keycloak-theme/replaceImportFromStatic.js @@ -0,0 +1,94 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateCssCodeToDefineGlobals = exports.replaceImportFromStaticInCssCode = exports.replaceImportFromStaticInJsCode = void 0; +var crypto = __importStar(require("crypto")); +function replaceImportFromStaticInJsCode(params) { + var jsCode = params.jsCode, ftlValuesGlobalName = params.ftlValuesGlobalName; + var fixedJsCode = jsCode.replace(/"static\//g, "window." + ftlValuesGlobalName + ".url.resourcesPath.replace(/^\\//,\"\") + \"/build/static/"); + return { fixedJsCode: fixedJsCode }; +} +exports.replaceImportFromStaticInJsCode = replaceImportFromStaticInJsCode; +function replaceImportFromStaticInCssCode(params) { + var _a; + var cssCode = params.cssCode; + var cssGlobalsToDefine = {}; + new Set((_a = cssCode.match(/(url\(\/[^)]+\))/g)) !== null && _a !== void 0 ? _a : []) + .forEach(function (match) { + return cssGlobalsToDefine["url" + crypto + .createHash("sha256") + .update(match) + .digest("hex") + .substring(0, 15)] = match; + }); + var fixedCssCode = cssCode; + Object.keys(cssGlobalsToDefine).forEach(function (cssVariableName) { + //NOTE: split/join pattern ~ replace all + return fixedCssCode = + fixedCssCode.split(cssGlobalsToDefine[cssVariableName]) + .join("var(--" + cssVariableName + ")"); + }); + return { fixedCssCode: fixedCssCode, cssGlobalsToDefine: cssGlobalsToDefine }; +} +exports.replaceImportFromStaticInCssCode = replaceImportFromStaticInCssCode; +function generateCssCodeToDefineGlobals(params) { + var cssGlobalsToDefine = params.cssGlobalsToDefine; + return { + "cssCodeToPrependInHead": __spreadArray(__spreadArray([ + ":root {" + ], __read(Object.keys(cssGlobalsToDefine) + .map(function (cssVariableName) { return [ + "--" + cssVariableName + ":", + [ + "url(", + "${url.resourcesPath}/build" + + cssGlobalsToDefine[cssVariableName].match(/^url\(([^)]+)\)$/)[1], + ")" + ].join("") + ].join(" "); }) + .map(function (line) { return " " + line + ";"; }))), [ + "}" + ]).join("\n") + }; +} +exports.generateCssCodeToDefineGlobals = generateCssCodeToDefineGlobals; +//# sourceMappingURL=replaceImportFromStatic.js.map \ No newline at end of file diff --git a/bin/build-keycloak-theme/replaceImportFromStatic.js.map b/bin/build-keycloak-theme/replaceImportFromStatic.js.map new file mode 100644 index 00000000..f79024ea --- /dev/null +++ b/bin/build-keycloak-theme/replaceImportFromStatic.js.map @@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AAA,EAAE,CAAC;AAEhD,CAAC;AApCD,4EAoCC;AAED,SAAgB,8BAA8B,CAC1C,MAEC;IAKO,IAAA,kBAAkB,GAAK,MAAM,mBAAX,CAAY;IAEtC,OAAO;QACH,wBAAwB,EAAE;YACtB,SAAS;kBACN,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC;aAC7B,GAAG,CAAC,UAAA,eAAe,IAAI,OAAA;YACpB,OAAK,eAAe,MAAG;YACvB;gBACI,MAAM;gBACN,4BAA4B;oBAC5B,kBAAkB,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAE,CAAC,CAAC,CAAC;gBACjE,GAAG;aACN,CAAC,IAAI,CAAC,EAAE,CAAC;SACb,CAAC,IAAI,CAAC,GAAG,CAAC,EARa,CAQb,CAAC;aACX,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,SAAO,IAAI,MAAG,EAAd,CAAc,CAAC;YAChC,GAAG;WACL,IAAI,CAAC,IAAI,CAAC;KACf,CAAC;AAEN,CAAC;AA5BD,wEA4BC"} \ No newline at end of file diff --git a/bin/download-sample-keycloak-themes.d.ts b/bin/download-sample-keycloak-themes.d.ts new file mode 100644 index 00000000..8220c751 --- /dev/null +++ b/bin/download-sample-keycloak-themes.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export declare const keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl = "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/other_keycloak_thems.zip"; diff --git a/bin/download-sample-keycloak-themes.js b/bin/download-sample-keycloak-themes.js new file mode 100755 index 00000000..42749bc1 --- /dev/null +++ b/bin/download-sample-keycloak-themes.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl = void 0; +var build_keycloak_theme_1 = require("./build-keycloak-theme"); +var downloadAndUnzip_1 = require("./tools/downloadAndUnzip"); +var path_1 = require("path"); +exports.keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl = "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/other_keycloak_thems.zip"; +if (require.main === module) { + downloadAndUnzip_1.downloadAndUnzip({ + "url": exports.keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl, + "destDirPath": path_1.join(build_keycloak_theme_1.keycloakThemeBuildingDirPath, "src", "main", "resources", "theme") + }); +} +//# sourceMappingURL=download-sample-keycloak-themes.js.map \ No newline at end of file diff --git a/bin/download-sample-keycloak-themes.js.map b/bin/download-sample-keycloak-themes.js.map new file mode 100644 index 00000000..bb812f77 --- /dev/null +++ b/bin/download-sample-keycloak-themes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"download-sample-keycloak-themes.js","sourceRoot":"","sources":["../src/bin/download-sample-keycloak-themes.ts"],"names":[],"mappings":";;;;AAEA,+DAAsE;AACtE,6DAA4D;AAC5D,6BAAwC;AAE3B,QAAA,kDAAkD,GAC3D,sGAAsG,CAAC;AAE3G,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAEzB,mCAAgB,CAAC;QACb,KAAK,EAAE,0DAAkD;QACzD,aAAa,EAAE,WAAQ,CAAC,mDAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC;KAC7F,CAAC,CAAC;CAEN"} \ No newline at end of file diff --git a/bin/generate-i18n-messages.d.ts b/bin/generate-i18n-messages.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/bin/generate-i18n-messages.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/bin/generate-i18n-messages.js b/bin/generate-i18n-messages.js new file mode 100644 index 00000000..d6d39df6 --- /dev/null +++ b/bin/generate-i18n-messages.js @@ -0,0 +1,81 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var fs = __importStar(require("fs")); +var path_1 = require("path"); +var crawl_1 = require("./tools/crawl"); +var downloadAndUnzip_1 = require("./tools/downloadAndUnzip"); +var download_sample_keycloak_themes_1 = require("./download-sample-keycloak-themes"); +var getProjectRoot_1 = require("./tools/getProjectRoot"); +var child_process = __importStar(require("child_process")); +//@ts-ignore +var propertiesParser = require("properties-parser"); +var tmpDirPath = path_1.join(getProjectRoot_1.getProjectRoot(), "tmp_xImOef9dOd44"); +child_process.execSync("rm -rf " + tmpDirPath); +downloadAndUnzip_1.downloadAndUnzip({ + "destDirPath": tmpDirPath, + "url": download_sample_keycloak_themes_1.keycloakBuiltinThemesAndThirdPartyExamplesThemsUrl +}); +var record = {}; +process.chdir(path_1.join(tmpDirPath, "base")); +crawl_1.crawl(".").forEach(function (filePath) { + var _a; + var match = filePath.match(/^([^/]+)\/messages\/messages_([^.]+)\.properties$/); + if (match === null) { + return; + } + var _b = __read(match, 3), typeOfPage = _b[1], language = _b[2]; + ((_a = record[typeOfPage]) !== null && _a !== void 0 ? _a : (record[typeOfPage] = {}))[language] = + propertiesParser.parse(fs.readFileSync(filePath) + .toString("utf8")); +}); +child_process.execSync("rm -r " + tmpDirPath); +var targetDirPath = path_1.join(getProjectRoot_1.getProjectRoot(), "src", "lib", "i18n", "generated_messages"); +fs.mkdirSync(targetDirPath, { "recursive": true }); +Object.keys(record).forEach(function (pageType) { + var filePath = path_1.join(targetDirPath, pageType + ".ts"); + fs.writeFileSync(filePath, Buffer.from([ + "//This code was automatically generated by running " + path_1.relative(getProjectRoot_1.getProjectRoot(), __filename), + '//PLEASE DO NOT EDIT MANUALLY', + '', + '/* spell-checker: disable */', + "export const messages= " + JSON.stringify(record[pageType], null, 2) + " as const;", + '/* spell-checker: enable */' + ].join("\n"), "utf8")); + console.log(filePath + " wrote"); +}); +//# sourceMappingURL=generate-i18n-messages.js.map \ No newline at end of file diff --git a/bin/generate-i18n-messages.js.map b/bin/generate-i18n-messages.js.map new file mode 100644 index 00000000..f2d7151e --- /dev/null +++ b/bin/generate-i18n-messages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generate-i18n-messages.js","sourceRoot":"","sources":["../src/bin/generate-i18n-messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,6BAAkE;AAClE,uCAAsC;AACtC,6DAA4D;AAC5D,qFAAuG;AACvG,yDAAwD;AACxD,2DAA+C;AAE/C,YAAY;AACZ,IAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEtD,IAAM,UAAU,GAAG,WAAQ,CAAC,+BAAc,EAAE,EAAE,kBAAkB,CAAC,CAAC;AAElE,aAAa,CAAC,QAAQ,CAAC,YAAU,UAAY,CAAC,CAAC;AAE/C,mCAAgB,CAAC;IACb,aAAa,EAAE,UAAU;IACzB,KAAK,EAAE,oFAAkD;CAC5D,CAAC,CAAC;AAIH,IAAM,MAAM,GAAiE,EAAE,CAAC;AAEhF,OAAO,CAAC,KAAK,CAAC,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AA6B;KAChC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAC5B,CAAC;IAEF,OAAO,CAAC,GAAG,CAAI,QAAQ,WAAQ,CAAC,CAAC;AAGrC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/bin/tools/crawl.d.ts b/bin/tools/crawl.d.ts new file mode 100644 index 00000000..a17223ab --- /dev/null +++ b/bin/tools/crawl.d.ts @@ -0,0 +1,2 @@ +/** List all files in a given directory return paths relative to the dir_path */ +export declare const crawl: (dir_path: string) => string[]; diff --git a/bin/tools/crawl.js b/bin/tools/crawl.js new file mode 100644 index 00000000..bfc642a0 --- /dev/null +++ b/bin/tools/crawl.js @@ -0,0 +1,65 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.crawl = void 0; +var fs = __importStar(require("fs")); +var path = __importStar(require("path")); +/** List all files in a given directory return paths relative to the dir_path */ +exports.crawl = (function () { + var crawlRec = function (dir_path, paths) { + var e_1, _a; + try { + for (var _b = __values(fs.readdirSync(dir_path)), _c = _b.next(); !_c.done; _c = _b.next()) { + var file_name = _c.value; + var file_path = path.join(dir_path, file_name); + if (fs.lstatSync(file_path).isDirectory()) { + crawlRec(file_path, paths); + continue; + } + paths.push(file_path); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + }; + return function crawl(dir_path) { + var paths = []; + crawlRec(dir_path, paths); + return paths.map(function (file_path) { return path.relative(dir_path, file_path); }); + }; +})(); +//# sourceMappingURL=crawl.js.map \ No newline at end of file diff --git a/bin/tools/crawl.js.map b/bin/tools/crawl.js.map new file mode 100644 index 00000000..ab5685c2 --- /dev/null +++ b/bin/tools/crawl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crawl.js","sourceRoot":"","sources":["../../src/bin/tools/crawl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAE7B,gFAAgF;AACnE,QAAA,KAAK,GAAG,CAAC;IAElB,IAAM,QAAQ,GAAG,UAAC,QAAgB,EAAE,KAAe;;;YAE/C,KAAwB,IAAA,KAAA,SAAA,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA,gBAAA,4BAAE;gBAA7C,IAAM,SAAS,WAAA;gBAEhB,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;gBAEjD,IAAI,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE;oBAEvC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;oBAE3B,SAAS;iBAEZ;gBAED,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aAEzB;;;;;;;;;IAEL,CAAC,CAAC;IAEF,OAAO,SAAS,KAAK,CAAC,QAAgB;QAElC,IAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAE1B,OAAO,KAAK,CAAC,GAAG,CAAC,UAAA,SAAS,IAAI,OAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAlC,CAAkC,CAAC,CAAC;IAEtE,CAAC,CAAA;AAEL,CAAC,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/bin/tools/downloadAndUnzip.d.ts b/bin/tools/downloadAndUnzip.d.ts new file mode 100644 index 00000000..342f75c3 --- /dev/null +++ b/bin/tools/downloadAndUnzip.d.ts @@ -0,0 +1,4 @@ +export declare function downloadAndUnzip(params: { + url: string; + destDirPath: string; +}): void; diff --git a/bin/tools/downloadAndUnzip.js b/bin/tools/downloadAndUnzip.js new file mode 100644 index 00000000..33de8acf --- /dev/null +++ b/bin/tools/downloadAndUnzip.js @@ -0,0 +1,40 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.downloadAndUnzip = void 0; +var path_1 = require("path"); +var child_process_1 = __importDefault(require("child_process")); +var fs_1 = __importDefault(require("fs")); +function downloadAndUnzip(params) { + var url = params.url, destDirPath = params.destDirPath; + fs_1.default.mkdirSync(destDirPath, { "recursive": true }); + console.log({ url: url, destDirPath: destDirPath }); + __spreadArray([ + "wget " + url + ], __read(["unzip", "rm"].map(function (prg) { return prg + " " + path_1.basename(url); }))).forEach(function (cmd) { return child_process_1.default.execSync(cmd, { "cwd": destDirPath }); }); +} +exports.downloadAndUnzip = downloadAndUnzip; +//# sourceMappingURL=downloadAndUnzip.js.map \ No newline at end of file diff --git a/bin/tools/downloadAndUnzip.js.map b/bin/tools/downloadAndUnzip.js.map new file mode 100644 index 00000000..e43051cb --- /dev/null +++ b/bin/tools/downloadAndUnzip.js.map @@ -0,0 +1 @@ +{"version":3,"file":"downloadAndUnzip.js","sourceRoot":"","sources":["../../src/bin/tools/downloadAndUnzip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAAgD;AAChD,gEAA0C;AAC1C,0CAAoB;AAEpB,SAAgB,gBAAgB,CAC5B,MAGC;IAGO,IAAA,GAAG,GAAkB,MAAM,IAAxB,EAAE,WAAW,GAAK,MAAM,YAAX,CAAY;IAEpC,YAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjD,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,KAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;IAElC;QACI,UAAQ,GAAK;cACV,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAG,GAAG,SAAI,eAAY,CAAC,GAAG,CAAG,EAA7B,CAA6B,CAAC,GAC9D,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,uBAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAnD,CAAmD,CAAC,CAAC;AAE1E,CAAC;AAlBD,4CAkBC"} \ No newline at end of file diff --git a/bin/tools/getProjectRoot.d.ts b/bin/tools/getProjectRoot.d.ts new file mode 100644 index 00000000..7927ee7e --- /dev/null +++ b/bin/tools/getProjectRoot.d.ts @@ -0,0 +1 @@ +export declare function getProjectRoot(): string; diff --git a/bin/tools/getProjectRoot.js b/bin/tools/getProjectRoot.js new file mode 100644 index 00000000..8cd6d008 --- /dev/null +++ b/bin/tools/getProjectRoot.js @@ -0,0 +1,39 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getProjectRoot = void 0; +var fs = __importStar(require("fs")); +var path = __importStar(require("path")); +function getProjectRootRec(dirPath) { + if (fs.existsSync(path.join(dirPath, "package.json"))) { + return dirPath; + } + return getProjectRootRec(path.join(dirPath, "..")); +} +var result = undefined; +function getProjectRoot() { + if (result !== undefined) { + return result; + } + return (result = getProjectRootRec(__dirname)); +} +exports.getProjectRoot = getProjectRoot; +//# sourceMappingURL=getProjectRoot.js.map \ No newline at end of file diff --git a/bin/tools/getProjectRoot.js.map b/bin/tools/getProjectRoot.js.map new file mode 100644 index 00000000..647f81d0 --- /dev/null +++ b/bin/tools/getProjectRoot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getProjectRoot.js","sourceRoot":"","sources":["../../src/bin/tools/getProjectRoot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAE7B,SAAS,iBAAiB,CAAC,OAAe;IACtC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE;QACnD,OAAO,OAAO,CAAC;KAClB;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,MAAM,GAAuB,SAAS,CAAC;AAE3C,SAAgB,cAAc;IAC1B,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO,MAAM,CAAC;KACjB;IAED,OAAO,CAAC,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC;AAND,wCAMC"} \ No newline at end of file diff --git a/bin/tools/grant-exec-perms.d.ts b/bin/tools/grant-exec-perms.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/bin/tools/grant-exec-perms.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/bin/tools/grant-exec-perms.js b/bin/tools/grant-exec-perms.js new file mode 100644 index 00000000..7a7cccef --- /dev/null +++ b/bin/tools/grant-exec-perms.js @@ -0,0 +1,30 @@ +"use strict"; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var getProjectRoot_1 = require("./getProjectRoot"); +var path_1 = require("path"); +var child_process_1 = __importDefault(require("child_process")); +Object.entries(require(path_1.join(getProjectRoot_1.getProjectRoot(), "package.json"))["bin"]) + .forEach(function (_a) { + var _b = __read(_a, 2), scriptPath = _b[1]; + return child_process_1.default.execSync("chmod +x " + scriptPath, { "cwd": getProjectRoot_1.getProjectRoot() }); +}); +//# sourceMappingURL=grant-exec-perms.js.map \ No newline at end of file diff --git a/bin/tools/grant-exec-perms.js.map b/bin/tools/grant-exec-perms.js.map new file mode 100644 index 00000000..affed62c --- /dev/null +++ b/bin/tools/grant-exec-perms.js.map @@ -0,0 +1 @@ +{"version":3,"file":"grant-exec-perms.js","sourceRoot":"","sources":["../../src/bin/tools/grant-exec-perms.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,mDAAkD;AAClD,6BAAwC;AACxC,gEAA0C;AAE1C,MAAM,CAAC,OAAO,CAAS,OAAO,CAAC,WAAQ,CAAC,+BAAc,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KAC7E,OAAO,CAAC,UAAC,EAAc;QAAd,KAAA,aAAc,EAAX,UAAU,QAAA;IAAM,OAAA,uBAAa,CAAC,QAAQ,CAAC,cAAY,UAAY,EAAE,EAAE,KAAK,EAAE,+BAAc,EAAE,EAAE,CAAC;AAA7E,CAA6E,CAAC,CAAC"} \ No newline at end of file diff --git a/bin/tools/transformCodebase.d.ts b/bin/tools/transformCodebase.d.ts new file mode 100644 index 00000000..1b8cbf7d --- /dev/null +++ b/bin/tools/transformCodebase.d.ts @@ -0,0 +1,13 @@ +/// +/** Apply a transformation function to every file of directory */ +export declare function transformCodebase(params: { + srcDirPath: string; + destDirPath: string; + transformSourceCodeString: (params: { + sourceCode: Buffer; + filePath: string; + }) => { + modifiedSourceCode: Buffer; + newFileName?: string; + } | undefined; +}): void; diff --git a/bin/tools/transformCodebase.js b/bin/tools/transformCodebase.js new file mode 100644 index 00000000..fbe75ab2 --- /dev/null +++ b/bin/tools/transformCodebase.js @@ -0,0 +1,66 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.transformCodebase = void 0; +var fs = __importStar(require("fs")); +var path = __importStar(require("path")); +var crawl_1 = require("./crawl"); +/** Apply a transformation function to every file of directory */ +function transformCodebase(params) { + var e_1, _a; + var srcDirPath = params.srcDirPath, destDirPath = params.destDirPath, transformSourceCodeString = params.transformSourceCodeString; + try { + for (var _b = __values(crawl_1.crawl(srcDirPath)), _c = _b.next(); !_c.done; _c = _b.next()) { + var file_relative_path = _c.value; + var filePath = path.join(srcDirPath, file_relative_path); + var transformSourceCodeStringResult = transformSourceCodeString({ + "sourceCode": fs.readFileSync(filePath), + "filePath": path.join(srcDirPath, file_relative_path) + }); + if (transformSourceCodeStringResult === undefined) { + continue; + } + fs.mkdirSync(path.dirname(path.join(destDirPath, file_relative_path)), { "recursive": true }); + var newFileName = transformSourceCodeStringResult.newFileName, modifiedSourceCode = transformSourceCodeStringResult.modifiedSourceCode; + fs.writeFileSync(path.join(path.dirname(path.join(destDirPath, file_relative_path)), newFileName !== null && newFileName !== void 0 ? newFileName : path.basename(file_relative_path)), modifiedSourceCode); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } +} +exports.transformCodebase = transformCodebase; +//# sourceMappingURL=transformCodebase.js.map \ No newline at end of file diff --git a/bin/tools/transformCodebase.js.map b/bin/tools/transformCodebase.js.map new file mode 100644 index 00000000..ddbb2473 --- /dev/null +++ b/bin/tools/transformCodebase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transformCodebase.js","sourceRoot":"","sources":["../../src/bin/tools/transformCodebase.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qCAAyB;AACzB,yCAA6B;AAC7B,iCAAgC;AAEhC,iEAAiE;AACjE,SAAgB,iBAAiB,CAC7B,MAUC;;IAGO,IAAA,UAAU,GAA6C,MAAM,WAAnD,EAAE,WAAW,GAAgC,MAAM,YAAtC,EAAE,yBAAyB,GAAK,MAAM,0BAAX,CAAY;;QAEtE,KAAiC,IAAA,KAAA,SAAA,aAAK,CAAC,UAAU,CAAC,CAAA,gBAAA,4BAAE;YAA/C,IAAM,kBAAkB,WAAA;YAEzB,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YAE3D,IAAM,+BAA+B,GAAG,yBAAyB,CAAC;gBAC9D,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;gBACvC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC;aACxD,CAAC,CAAC;YAEH,IAAI,+BAA+B,KAAK,SAAS,EAAE;gBAC/C,SAAS;aACZ;YAED,EAAE,CAAC,SAAS,CACR,IAAI,CAAC,OAAO,CACR,IAAI,CAAC,IAAI,CACL,WAAW,EACX,kBAAkB,CACrB,CACJ,EACD,EAAE,WAAW,EAAE,IAAI,EAAE,CACxB,CAAC;YAEM,IAAA,WAAW,GAAyB,+BAA+B,YAAxD,EAAE,kBAAkB,GAAK,+BAA+B,mBAApC,CAAqC;YAE5E,EAAE,CAAC,aAAa,CACZ,IAAI,CAAC,IAAI,CACL,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,EACxD,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CACnD,EACD,kBAAkB,CACrB,CAAC;SAEL;;;;;;;;;AAGL,CAAC;AApDD,8CAoDC"} \ No newline at end of file diff --git a/lib/LoginPage.d.ts b/lib/LoginPage.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/lib/LoginPage.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/lib/LoginPage.js b/lib/LoginPage.js new file mode 100644 index 00000000..f31b602a --- /dev/null +++ b/lib/LoginPage.js @@ -0,0 +1,31 @@ +"use strict"; +/* +import { useState, memo } from "react"; +import { KcProperties, Template } from "./Template"; +import { assert } from "evt/tools/typeSafety/assert"; +import { keycloakPagesContext } from "./keycloakFtlValues"; + +export type Props = { + properties: KcProperties; +}; + +export const LoginPage = memo((props: Props)=>{ + + + const [{ }] = useState(() => { + + assert(keycloakPagesContext !== undefined); + + return keycloakPagesContext; + + }); + + + return ( +