From 9d8191c62599d2471ba2dc54ffacc2dadf15a5ee Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 15 Sep 2022 11:37:39 +0200 Subject: [PATCH 01/37] [ECS-463] update tests to not test the old bundle files anymore --- test/server.spec.js | 12 ------------ test/utils/expected-files.js | 9 +-------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/test/server.spec.js b/test/server.spec.js index 59ba447b..bd8bfeba 100644 --- a/test/server.spec.js +++ b/test/server.spec.js @@ -50,7 +50,6 @@ describe('Subgenerator server of entando JHipster blueprint', () => { it('creates expected files for the blueprint', () => { assert.file(expectedFiles.server); - assert.file(`bundle/plugins/${appBaseName.toLowerCase()}-plugin.yaml`); }); it('creates expected keycloack Entando Placeholder', () => { @@ -336,16 +335,6 @@ describe('Subgenerator server of entando JHipster blueprint', () => { ); }); - it('package.json file contains Entando scripts', () => { - assert.fileContent( - 'package.json', - ' "scripts": {\n' + - ' "populate-bundle": "bash ./buildBundle.sh",\n' + - ' "build-all": "bash ./buildBundle.sh -d",\n' + - ' "keycloak": "docker-compose -f src/main/docker/keycloak.yml up",', - ); - }); - it('JwtGrantedAuthorityConverter file contains Entando modification', () => { assert.fileContent( `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/security/oauth2/JwtGrantedAuthorityConverter.java`, @@ -423,7 +412,6 @@ describe('Subgenerator server of entando JHipster blueprint', () => { it('creates expected files for the blueprint', () => { assert.file(expectedFiles.server); - assert.file(`bundle/plugins/${appBaseName.toLowerCase()}-plugin.yaml`); }); it('CacheConfiguration file contains Entando modification', () => { diff --git a/test/utils/expected-files.js b/test/utils/expected-files.js index cbfbc262..06698fa1 100644 --- a/test/utils/expected-files.js +++ b/test/utils/expected-files.js @@ -4,14 +4,7 @@ const { SERVER_MAIN_RES_DIR, SERVER_MAIN_SRC_DIR, SERVER_TEST_SRC_DIR, DOCKER_DI const expectedFiles = { microservices: [`${SERVER_MAIN_RES_DIR}static/favicon.png`], - server: [ - 'bundle/descriptor.yaml', - 'prepareMicrofrontends.sh', - 'prepareBundle.sh', - 'prepareDockerImage.sh', - 'buildBundle.sh', - `${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/config/OpenApiConfiguration.java`, - ], + server: [`${SERVER_MAIN_SRC_DIR}com/mycompany/myapp/config/OpenApiConfiguration.java`], 'entando-keycloack': `${DOCKER_DIR}keycloak-db/.entando-placeholder`, entity: { server: { From 1860e6b842f47d2f68e5002a70b0de7acc73353f Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 15 Sep 2022 11:38:36 +0200 Subject: [PATCH 02/37] [ECS-463] delete templates related to the bundle and remove scripts --- generators/server/files.js | 22 -- generators/server/templates/buildBundle.sh | 34 ---- .../templates/bundle/descriptor.yaml.ejs | 10 - .../bundle/plugins/myplugin.yaml.ejs | 19 -- generators/server/templates/package.json.ejs | 2 - generators/server/templates/prepareBundle.sh | 192 ------------------ .../server/templates/prepareDockerImage.sh | 17 -- .../server/templates/prepareMicrofrontends.sh | 109 ---------- 8 files changed, 405 deletions(-) delete mode 100755 generators/server/templates/buildBundle.sh delete mode 100644 generators/server/templates/bundle/descriptor.yaml.ejs delete mode 100644 generators/server/templates/bundle/plugins/myplugin.yaml.ejs delete mode 100755 generators/server/templates/prepareBundle.sh delete mode 100755 generators/server/templates/prepareDockerImage.sh delete mode 100755 generators/server/templates/prepareMicrofrontends.sh diff --git a/generators/server/files.js b/generators/server/files.js index 8672f316..0603833d 100644 --- a/generators/server/files.js +++ b/generators/server/files.js @@ -22,28 +22,6 @@ const entandoServerFiles = { templates: ['package.json'], }, ], - bundle: [ - { - templates: [ - { file: 'prepareMicrofrontends.sh', method: 'copy', noEjs: true }, - { file: 'prepareBundle.sh', method: 'copy', noEjs: true }, - { file: 'prepareDockerImage.sh', method: 'copy', noEjs: true }, - { file: 'buildBundle.sh', method: 'copy', noEjs: true }, - ], - }, - { - PATH: '.', - templates: [ - { - file: 'bundle/descriptor.yaml', - }, - { - file: 'bundle/plugins/myplugin.yaml', - renameTo: generator => `bundle/plugins/${generator.baseName.toLowerCase()}-plugin.yaml`, - }, - ], - }, - ], docker: [ { condition: generator => generator.authenticationType === 'oauth2', diff --git a/generators/server/templates/buildBundle.sh b/generators/server/templates/buildBundle.sh deleted file mode 100755 index 28c84f5d..00000000 --- a/generators/server/templates/buildBundle.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -set -e - -while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in - -d | --docker ) - docker="true"; - ;; -esac; shift; done -if [[ "$1" == '--' ]]; then shift; fi - -BUNDLE_NAME=$(awk -F':' 'NR==1 {gsub(/ /, "", $2); print $2}' ./bundle/descriptor.yaml) -STEP=1 - -echo "Generation of the $BUNDLE_NAME bundle" -echo "=====================================" -echo "" - - -if [[ -n "$docker" ]]; then - echo "Step $STEP. Preparing docker image" - ./prepareDockerImage.sh - echo "---" - STEP=$((STEP+1)) -fi - -echo "Step $STEP. Preparing micro-frontends for inclusion in the bundle" -./prepareMicrofrontends.sh -echo "---" -STEP=$((STEP+1)) -echo "Step $STEP. Including micro-frontends metadata and resources in the bundle package" -./prepareBundle.sh -echo "---" -echo "All done! Bundle available in the $(pwd)/bundle folder" - diff --git a/generators/server/templates/bundle/descriptor.yaml.ejs b/generators/server/templates/bundle/descriptor.yaml.ejs deleted file mode 100644 index 60618da7..00000000 --- a/generators/server/templates/bundle/descriptor.yaml.ejs +++ /dev/null @@ -1,10 +0,0 @@ -code: <%=bundleName%> -description: This is the <%=baseName%> bundle - -components: - plugins: - - plugins/<%=baseName.toLowerCase()%>-plugin.yaml - - widgets: -# entando-needle-descriptor-add-widgets - Entando blueprint will add widget bundle files here - diff --git a/generators/server/templates/bundle/plugins/myplugin.yaml.ejs b/generators/server/templates/bundle/plugins/myplugin.yaml.ejs deleted file mode 100644 index e72d10b3..00000000 --- a/generators/server/templates/bundle/plugins/myplugin.yaml.ejs +++ /dev/null @@ -1,19 +0,0 @@ -descriptorVersion: v4 -image: <%= dockerImageOrganization %>/<%= dasherizedBaseName %>:0.0.1-SNAPSHOT -dbms: <%= prodDatabaseTypePlugin%> -healthCheckPath: "/management/health" -roles: - - "<%=baseName%>-admin" -# entando-needle-descriptor-add-roles - Entando blueprint will add roles here -# -### uncomment lines below to enable the injection of environment variables in your plugin -### ENV_1_NAME directly injects a value -### ENV_2_NAME leverages a cluster secret value -# environmentVariables: -# - name: ENV_1_NAME -# value: env1value -# - name: ENV_2_NAME -# valueFrom: -# secretKeyRef: -# name: env-2-secret -# key: env-2-secret-key diff --git a/generators/server/templates/package.json.ejs b/generators/server/templates/package.json.ejs index ca93128d..d02a380f 100644 --- a/generators/server/templates/package.json.ejs +++ b/generators/server/templates/package.json.ejs @@ -47,8 +47,6 @@ "default_environment": "prod" }, "scripts": { - "populate-bundle": "bash ./buildBundle.sh", - "build-all": "bash ./buildBundle.sh -d", "keycloak": "docker-compose -f src/main/docker/keycloak.yml up", "prettier:check": "prettier --check \"{,src/**/}*.{<%= getPrettierExtensions() %>}\"", "prettier:format": "prettier --write \"{,src/**/}*.{<%= getPrettierExtensions() %>}\"" diff --git a/generators/server/templates/prepareBundle.sh b/generators/server/templates/prepareBundle.sh deleted file mode 100755 index f21ebd6c..00000000 --- a/generators/server/templates/prepareBundle.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash - -if [[ "$OSTYPE" == "darwin"* ]]; then - function sedReplace() { - sed -i '' "$@" - } -else - function sedReplace() { - sed -i'' "$@" - } -fi - -function syncFiles() { - local CPCMD - - rsync --version 1>/dev/null 2>&1 - [[ $? -eq 0 ]] && CPCMD="rsync -a" || CPCMD="cp -ra" - - $CPCMD "$@" -} - -function syncResources() { - local widgetFolder="$1" - - echo "> Processing widgets $(echo $widgetFolder | cut -d/ -f3-)" - - echo "- Preparing target folder structure" - mkdir -p bundle{,"/$widgetFolder"}/resources - - echo "- Copying bundle descriptor" - syncFiles "$widgetFolder"/bundle/* bundle/"$widgetFolder"/ - if [ -d "$widgetFolder/build/static" ]; then - echo "- Copying bundle static resource" - syncFiles "$widgetFolder/build/static" bundle/resources 2>/dev/null - syncFiles "$widgetFolder/build/static" "bundle/$widgetFolder/resources" 2>/dev/null - else - echo " > no build/static folder found for $widgetFolder" - fi -} - -function createFolderTree() { - local widgetFolder="$1" - - echo "- Creating folder structure for $widgetFolder" - mkdir -p bundle/"$widgetFolder"/resources/static/{js,css} - - # Copy bundle metadata and template - cp "$widgetFolder"/bundle/* bundle/"$widgetFolder"/ - - # Copying resources for widgets - cp -r "$widgetFolder"/build/static/js/*.js bundle/"$widgetFolder"/resources/static/js - - local jsExitStatus=$? - if [ $jsExitStatus -ne 0 ]; then - echo " > no js found for $widgetFolder" - fi - - cp "$widgetFolder"/build/static/css/*.css bundle/"$widgetFolder"/resources/static/css 2>/dev/null - - local cssExitStatus=$? - if [ $cssExitStatus -ne 0 ]; then - echo " > no css found for $widgetFolder" - fi - -} - -function injectResource() { - local resource="$1" - local destFile="$2" - - local _NL=$'\\\n' - echo "- Injecting resource $resource in $destFile" - sedReplace 's|'"$INJECTION_POINT"'|'"$resource$_NL$INJECTION_POINT"'|g' "$destFile" -} - -function getServiceUrlFromDockerImage() { - # Convert a docker image to the ingressPath which is /// where - # each field only contains lowercase numbers and letters and "-" - - shopt -s nullglob # Set the results of globs in forloop to emptylist if no file is found - local dockerImage="$1" - - [ -z "$dockerImage" ] && echo "" - echo "$dockerImage" | cut -d : -f1 | sed 's:[^a-zA-Z0-9/]:-:g' | tr "[:upper:]" "[:lower:]" | sed 's:^:/:g' -} - -function updateFTLTemplate() { - shopt -s nullglob # Set the results of globs in forloop to emptylist if no file is found - local dir="$1" - local bundleCode="$2" - local dockerImage="$3" - local customizedPluginIngressPath="$4" - - widgetName=$(basename "$dir") - - if [ -z "$customizedPluginIngressPath" ]; then - ingressPath=$(getServiceUrlFromDockerImage "$dockerImage") - else - ingressPath="$customizedPluginIngressPath" - fi - - echo "" - echo "> Updating ${widgetName} micro-frontend resources for $dir" - - for ftlName in "$dir"/*.ftl; - do - [ -e "$ftlName" ] || continue - - if [ -n "$ingressPath" ]; then - # Replace the service path with the correct ingressPath - sedReplace "s|service-url=\".*\"|service-url=\"$ingressPath\"|g" "$ftlName" - fi - - #For every JS file add a script reference in the widget FTL - for jspath in "$dir"/resources/static/js/*.js; - do - # This moves the referenced file to the top level bundle/resources/static dir for correct processing when loaded - jsfile=$(basename "$jspath") - - - cp "$dir/resources/static/js/$jsfile" bundle/resources/static/js/ - resource="" - injectResource "$resource" "$ftlName" - done - - # For every CSS file add a script reference in the widget FTL - for csspath in "$dir"/resources/static/css/*.css; - do - - # This moves the referenced file to the top level bundle/resources/static dir for correct processing when loaded - cssfile=$(basename "$csspath") - - cp "$dir/resources/static/css/$cssfile" bundle/resources/static/css/ - resource="${bundleCode}/static/css/${cssfile}\" rel=\"stylesheet\">" - injectResource "$resource" "$ftlName" - done - done - - #Cleanup the resources that were copied into the widget folders specifically. They are now copied into the main bundle folder - echo "" - echo "> Cleaning temporary resource folders" - rm -rvf "$dir/resources" - shopt -u nullglob - -} - -export -f sedReplace -export -f syncFiles -export -f createFolderTree -export -f injectResource -export -f updateFTLTemplate -export -f syncResources -export -f getServiceUrlFromDockerImage -export INJECTION_POINT="<#-- entando_resource_injection_point -->" - -BUNDLE_NAME=$(awk -F': ' '/^code/{print $2}' ./bundle/descriptor.yaml) -DOCKER_IMAGE=$(awk -F': ' '/^image/{print $2}' ./bundle/plugins/*-plugin.yaml | head -1) -CUSTOMIZED_PLUGIN_INGRESS_PATH="$(awk -F': ' '/^ingressPath/{print $2}' ./bundle/plugins/*-plugin.yaml | head -1)" - - -WIDGET_FOLDER="ui/widgets" - -find "$WIDGET_FOLDER" -maxdepth 2 -mindepth 2 -type d -not -path "*utils*" > /dev/null 2>&1 -HAS_WIDGETS=$? - -if [ $HAS_WIDGETS -eq 0 ]; then - # This command assumes that the widgets are all under ui/widgets//. The command finds all of the micro-frontends in those folders and - # copies the result of the build into the bundle resources folder so that the bundle can be deployed to a Entando Component Repository instance (or imported on an existing page). - # The command also copies css optionally with this structure since some widgets will be js only 2>/dev/null || : - echo "---" - echo "Generating the bundle folder tree for the micro-frontends" - echo "" - find "$WIDGET_FOLDER" -maxdepth 2 -mindepth 2 -type d -not -path "*utils*" -exec bash -c 'syncResources "$@"' bash {} \; - mkdir -p bundle/resources/static/{js,css} - echo "" - - # #Fetch the top level service name from the pom and use this as the context directory for the publishing of assets specific to the project when building the bundle - # artifactId=$(awk -F'[><]' '/.*<\/artifactId>/ {print $3; exit}' pom.xml) - # echo "---" - # echo "Updating bundle for service ${artifactId}" - - # For each widget under the structure ui/widgets// generate an FTL file that imports the css and js that goes with that widget. - # The FTL file from the widget itself is preserved and the imports are added at the top of the widget - echo "---" - echo "Updating micro-frontend templates to include static resources" - echo "" - find bundle/ui/widgets -maxdepth 2 -mindepth 2 -type d -not -path "*utils*" -exec bash -c 'updateFTLTemplate "$@"' bash {} "$BUNDLE_NAME" "$DOCKER_IMAGE" "$CUSTOMIZED_PLUGIN_INGRESS_PATH" \; - - echo "" -else - echo "No micro-frontend has been found in the $WIDGET_FOLDER, skipping this step" -fi diff --git a/generators/server/templates/prepareDockerImage.sh b/generators/server/templates/prepareDockerImage.sh deleted file mode 100755 index 085eab3c..00000000 --- a/generators/server/templates/prepareDockerImage.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -echo "" -echo "Building project and Docker image " -export MY_IMAGE=$(./mvnw -Pprod clean package jib:dockerBuild | while read i -do - - if [[ "$i" == *"Built image to Docker daemon"* ]]; then - echo "$i" | awk '{print $NF}' - fi -done -) -echo "Built $MY_IMAGE" - -echo "" -echo "Uploading $MY_IMAGE to dockerhub" -docker push $MY_IMAGE diff --git a/generators/server/templates/prepareMicrofrontends.sh b/generators/server/templates/prepareMicrofrontends.sh deleted file mode 100755 index 153766ee..00000000 --- a/generators/server/templates/prepareMicrofrontends.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -BUNDLE_NAME=$(awk -F':' 'NR==1{gsub(" ","",$2); print $2}' ./bundle/descriptor.yaml) -WIDGET_FOLDER="ui/widgets"; -BASE_LOG_OUTPUT="./.bundle_build/logs" -ERROR_OUTPUT="./.bundle_build/errors" -PIDS=() - -function getMicrofrontendsNumber() { - find "$WIDGET_FOLDER" -mindepth 3 -maxdepth 3 -type d -name bundle | wc -l -} - -function processWidget() { - local WIDGET_PATH="$1" - local MFE_NAME="$2" - local WIDGET_NAME="$3" - - ( - cd "$WIDGET_PATH" - - THIS=$BASHPID - echo "Installing micro-frontend dependencies" - npm install || return $? - echo "Building micro-frontend code" - npm run build --production | while read i - do - if [[ "$i" == *"Failed to compile"* ]]; then - echo "$i" 1>&2 - echo "**ERROR DETECTED**" 1>&2 - ( sleep 3; kill $THIS ) & - else - echo "$i" - fi - done - - [ $? -ne 0 ] && return $? - - echo "$MFE_NAME - $WIDGET_NAME built successfully" - ) || ( - touch "$ERROR_OUTPUT/$MFE_NAME-$WIDGET_NAME" - ) - -} - -if [ "$(getMicrofrontendsNumber)" -eq 0 ]; then - echo "No micro-frontends found in $WIDGET_FOLDER, skipping this step" - exit 0 -else - - # Prepare supporting folders - mkdir -p "$BASE_LOG_OUTPUT" - rm -fr "$ERROR_OUTPUT" && mkdir -p "$ERROR_OUTPUT" - - # Get all entities - ALL_MFE_PATHS=$(find "$WIDGET_FOLDER" -mindepth 3 -maxdepth 3 -type d -name bundle) - ENTITIES=$(echo "$ALL_MFE_PATHS" | awk -F'/' '{print $3}' | sort -u) - - for ENTITY in $ENTITIES; do - - # Get entity widgets - WIDGETS=$(echo "$ALL_MFE_PATHS" | awk -F'/' -v e_name="$ENTITY" '$3 == e_name {print $0}') - - for WIDGET_PATH in $WIDGETS; do - - # Process the widgets - MFE_NAME=$(echo "$WIDGET_PATH" | awk -F'/' '{print $3}') - WIDGET_NAME=$(echo "$WIDGET_PATH" | awk -F'/' '{print $4}') - LOG_OUTPUT_FOLDER="$BASE_LOG_OUTPUT/$BUNDLE_NAME/$MFE_NAME" - LOG_OUTPUT="$LOG_OUTPUT_FOLDER/$WIDGET_NAME.log" - - echo "- Processing micro-frontend $MFE_NAME - $WIDGET_NAME in background" - echo " Logs available at $LOG_OUTPUT" - echo "" - - mkdir -p "$LOG_OUTPUT_FOLDER" - processWidget "$WIDGET_PATH" "$MFE_NAME" "$WIDGET_NAME" >> "$LOG_OUTPUT" 2>&1 & - PIDS+=($!) - done - done - - echo "Waiting for all processes to complete" - - # Wait for all the collected PIDs to terminate - for PID in "${PIDS[@]}"; do - wait "$PID" - done - - echo "All processes completed" - echo "" - - # Check for errors and in case exit - ERROR_COUNT=$(find "$ERROR_OUTPUT" -type f | wc -l) - if [ "$ERROR_COUNT" -ge 1 ]; then - echo "" - echo "ERROR: Some of the micro-frontend didnt built correctly; Check the logs in $BASE_LOG_OUTPUT" - ERRORS=$(find "$ERROR_OUTPUT" -type f) - for ERR in $ERRORS; do - echo "> $ERR" - done - echo "" - exit 1 - else - echo "" - echo "SUCCESS: All micro-frontends have been built correctly" - echo "" - exit 0 - fi -fi - From 8e69ff3daf0a87f8b2e9bbd5bf74b8cb7605ac0f Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 15 Sep 2022 15:02:44 +0200 Subject: [PATCH 03/37] [ECS-463] Update the mfe tests --- test/utils/expected-files.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/utils/expected-files.js b/test/utils/expected-files.js index 06698fa1..a601d007 100644 --- a/test/utils/expected-files.js +++ b/test/utils/expected-files.js @@ -22,8 +22,6 @@ const expectedFiles = { }, widget: { detailsWidget: [ - 'ui/widgets/foo/detailsWidget/bundle/foo-details-widget.ftl', - 'ui/widgets/foo/detailsWidget/bundle/foo-details-widget-descriptor.yaml', 'ui/widgets/foo/detailsWidget/public/favicon.ico', 'ui/widgets/foo/detailsWidget/public/index.html', 'ui/widgets/foo/detailsWidget/public/robots.txt', @@ -71,8 +69,6 @@ const expectedFiles = { 'ui/widgets/foo/detailsWidget/README.md', ], formWidget: [ - 'ui/widgets/foo/formWidget/bundle/foo-form-widget.ftl', - 'ui/widgets/foo/formWidget/bundle/foo-form-widget-descriptor.yaml', 'ui/widgets/foo/formWidget/public/favicon.ico', 'ui/widgets/foo/formWidget/public/index.html', 'ui/widgets/foo/formWidget/public/robots.txt', @@ -125,8 +121,6 @@ const expectedFiles = { 'ui/widgets/foo/formWidget/README.md', ], tableWidget: [ - 'ui/widgets/foo/tableWidget/bundle/foo-table-widget.ftl', - 'ui/widgets/foo/tableWidget/bundle/foo-table-widget-descriptor.yaml', 'ui/widgets/foo/tableWidget/public/favicon.ico', 'ui/widgets/foo/tableWidget/public/index.html', 'ui/widgets/foo/tableWidget/public/robots.txt', From 78eeb39fe712b1008510161eb19db27b5c6732ad Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 15 Sep 2022 15:03:39 +0200 Subject: [PATCH 04/37] [ECS-463] Remove bundle files and needle code from the MFEs templates --- generators/entity-microfrontend/files.js | 57 ------------------- .../needle-api/needle-server-bundle.js | 40 ------------- .../bundle/details-widget-descriptor.yaml.ejs | 6 -- .../bundle/details-widget.ftl.ejs | 5 -- .../bundle/form-widget-descriptor.yaml.ejs | 6 -- .../formWidget/bundle/form-widget.ftl.ejs | 6 -- .../bundle/table-widget-descriptor.yaml.ejs | 6 -- .../tableWidget/bundle/table-widget.ftl.ejs | 6 -- 8 files changed, 132 deletions(-) delete mode 100644 generators/entity-microfrontend/needle-api/needle-server-bundle.js delete mode 100644 generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget-descriptor.yaml.ejs delete mode 100644 generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget.ftl.ejs delete mode 100644 generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget-descriptor.yaml.ejs delete mode 100644 generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget.ftl.ejs delete mode 100644 generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget-descriptor.yaml.ejs delete mode 100644 generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget.ftl.ejs diff --git a/generators/entity-microfrontend/files.js b/generators/entity-microfrontend/files.js index b7fb446a..6b5bd91c 100644 --- a/generators/entity-microfrontend/files.js +++ b/generators/entity-microfrontend/files.js @@ -1,5 +1,4 @@ const constants = require('../generator-constants'); -const EntandoNeedle = require('./needle-api/needle-server-bundle'); const { getMockData } = require('./lib/mfe-test-tools'); const { MFE_MAIN_DIR, DETAILS_WIDGET, FORM_WIDGET, TABLE_WIDGET } = constants; @@ -141,56 +140,6 @@ const microFrontendFiles = { ], }, ], - bundle: [ - { - path: MFE_MAIN_DIR, - condition: generator => generator.selectedWidgets.includes(DETAILS_WIDGET), - templates: [ - { - file: 'entity/detailsWidget/bundle/details-widget.ftl', - renameTo: generator => - `${generator.entityFileName}/detailsWidget/bundle/${generator.entityFileName}-details-widget.ftl`, - }, - { - file: 'entity/detailsWidget/bundle/details-widget-descriptor.yaml', - renameTo: generator => - `${generator.entityFileName}/detailsWidget/bundle/${generator.entityFileName}-details-widget-descriptor.yaml`, - }, - ], - }, - { - path: MFE_MAIN_DIR, - condition: generator => generator.selectedWidgets.includes(FORM_WIDGET), - templates: [ - { - file: 'entity/formWidget/bundle/form-widget.ftl', - renameTo: generator => - `${generator.entityFileName}/formWidget/bundle/${generator.entityFileName}-form-widget.ftl`, - }, - { - file: 'entity/formWidget/bundle/form-widget-descriptor.yaml', - renameTo: generator => - `${generator.entityFileName}/formWidget/bundle/${generator.entityFileName}-form-widget-descriptor.yaml`, - }, - ], - }, - { - path: MFE_MAIN_DIR, - condition: generator => generator.selectedWidgets.includes(TABLE_WIDGET), - templates: [ - { - file: 'entity/tableWidget/bundle/table-widget.ftl', - renameTo: generator => - `${generator.entityFileName}/tableWidget/bundle/${generator.entityFileName}-table-widget.ftl`, - }, - { - file: 'entity/tableWidget/bundle/table-widget-descriptor.yaml', - renameTo: generator => - `${generator.entityFileName}/tableWidget/bundle/${generator.entityFileName}-table-widget-descriptor.yaml`, - }, - ], - }, - ], public: [ { path: MFE_MAIN_DIR, @@ -1093,12 +1042,6 @@ function writeFiles() { } }, - updateBundleDescriptor() { - this.entandoNeedleApi = new EntandoNeedle(this); - this.entandoNeedleApi.addWidgetToDescriptor(this.entityFileName); - this.entandoNeedleApi.addRolesToDescriptor(this.baseName.toLowerCase(), this.entityFileName); - }, - addPrettier() { if (this.jhipsterConfig.generateMfeForEntity) { this.addNpmDevDependency('prettier', '2.0.5'); diff --git a/generators/entity-microfrontend/needle-api/needle-server-bundle.js b/generators/entity-microfrontend/needle-api/needle-server-bundle.js deleted file mode 100644 index 19915dd5..00000000 --- a/generators/entity-microfrontend/needle-api/needle-server-bundle.js +++ /dev/null @@ -1,40 +0,0 @@ -const chalk = require('chalk'); -const needleServer = require('generator-jhipster/generators/server/needle-api/needle-server'); - -const descriptorPath = 'bundle/descriptor.yaml'; -const pluginsDirectory = 'bundle/plugins'; - -module.exports = class extends needleServer { - addWidgetToDescriptor(entityName) { - const errorMessage = `${chalk.yellow('Reference to widget in descriptor ')} - ${chalk.yellow(' not added.\n')}`; - - const widgets = [ - `ui/widgets/${entityName}/tableWidget/${entityName}-table-widget-descriptor.yaml`, - `ui/widgets/${entityName}/detailsWidget/${entityName}-details-widget-descriptor.yaml`, - `ui/widgets/${entityName}/formWidget/${entityName}-form-widget-descriptor.yaml`, - ]; - let i; - - for (i = 0; i < widgets.length; i++) { - const rewriteFileModel = this.generateFileModel( - descriptorPath, - 'entando-needle-descriptor-add-widgets', - ` - ${widgets[i]}`, - ); - this.addBlockContentToFile(rewriteFileModel, errorMessage); - } - } - - addRolesToDescriptor(baseName, entityName) { - const errorMessage = `${chalk.yellow('Reference to widget in descriptor ')} - ${chalk.yellow(' not added.\n')}`; - const mainPluginDescriptorPath = `${pluginsDirectory}/${baseName}-plugin.yaml`; - const rewriteFileModelAdmin = this.generateFileModel( - mainPluginDescriptorPath, - 'entando-needle-descriptor-add-roles', - ` - "${entityName}-admin"`, - ); - this.addBlockContentToFile(rewriteFileModelAdmin, errorMessage); - } -}; diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget-descriptor.yaml.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget-descriptor.yaml.ejs deleted file mode 100644 index 68137c16..00000000 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget-descriptor.yaml.ejs +++ /dev/null @@ -1,6 +0,0 @@ -code: <%= entityFileName %>-details-widget -titles: - en: <%= entityClassHumanized %> Details Widget - it: <%= entityClassHumanized %> Details Widget -group: free -customUiPath: <%= entityFileName %>-details-widget.ftl diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget.ftl.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget.ftl.ejs deleted file mode 100644 index d0de1924..00000000 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/detailsWidget/bundle/details-widget.ftl.ejs +++ /dev/null @@ -1,5 +0,0 @@ -<#assign wp=JspTaglibs["/aps-core"]> -<#-- entando_resource_injection_point --> -<#-- Don't add anything above this line. The build scripts will automatically link the compiled JS and CSS for you and add them above this line so that the widget can be loaded--> - -<<%= entityFileName %>-details service-url="/<%= baseName %>" /> diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget-descriptor.yaml.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget-descriptor.yaml.ejs deleted file mode 100644 index e3e29a35..00000000 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget-descriptor.yaml.ejs +++ /dev/null @@ -1,6 +0,0 @@ -code: <%= entityFileName %>-form-widget -titles: - en: <%= entityClassHumanized %> Form Widget - it: <%= entityClassHumanized %> Form Widget -group: free -customUiPath: <%= entityFileName %>-form-widget.ftl diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget.ftl.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget.ftl.ejs deleted file mode 100644 index f57256d4..00000000 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/bundle/form-widget.ftl.ejs +++ /dev/null @@ -1,6 +0,0 @@ -<#assign wp=JspTaglibs["/aps-core"]> -<#-- entando_resource_injection_point --> -<#-- Don't add anything above this line. The build scripts will automatically link the compiled JS and CSS for you and add them above this line so that the widget can be loaded--> - -<#-- This is the custom element --> -<<%= entityFileName %>-form service-url="/<%= baseName %>" /> diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget-descriptor.yaml.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget-descriptor.yaml.ejs deleted file mode 100644 index 4cfdf948..00000000 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget-descriptor.yaml.ejs +++ /dev/null @@ -1,6 +0,0 @@ -code: <%= entityFileName %>-table-widget -titles: - en: <%= entityClassHumanized %> Table Widget - it: <%= entityClassHumanized %> Table Widget -group: free -customUiPath: <%= entityFileName %>-table-widget.ftl diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget.ftl.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget.ftl.ejs deleted file mode 100644 index e333f004..00000000 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/tableWidget/bundle/table-widget.ftl.ejs +++ /dev/null @@ -1,6 +0,0 @@ -<#assign wp=JspTaglibs["/aps-core"]> -<#-- entando_resource_injection_point --> -<#-- Don't add anything above this line. The build scripts will automatically link the compiled JS and CSS for you and add them above this line so that the widget can be loaded--> - -<#-- This is the custom element --> -<<%= entityFileName %>-table service-url="/<%= baseName %>" /> From 92e0f46d797be56bd675bea9f754aaf82f5f1afd Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 15 Sep 2022 18:09:07 +0200 Subject: [PATCH 05/37] [ECS-463] Remove the bundle Name question and the bundleName property --- generators/server/index.js | 1 - generators/server/prompts.js | 19 ------------------- .../ms-noDb-oauth2-alwaysMFE/.yo-rc.json | 1 - .../ms-noDb-oauth2-askForMFE/.yo-rc.json | 1 - .../ms-noDb-oauth2-withoutMFE/.yo-rc.json | 1 - .../ms-postgres-oauth2-alwaysMFE/.yo-rc.json | 1 - .../ms-postgres-oauth2-askForMFE/.yo-rc.json | 1 - .../ms-postgres-oauth2-withoutMFE/.yo-rc.json | 1 - 8 files changed, 26 deletions(-) diff --git a/generators/server/index.js b/generators/server/index.js index 933f6272..deab749a 100644 --- a/generators/server/index.js +++ b/generators/server/index.js @@ -59,7 +59,6 @@ module.exports = class extends ServerGenerator { const entandoPhase = { loadEntandoSharedConfig() { const configuration = this.getJhipsterConfig(); - this.bundleName = configuration.get('bundleName'); this.dockerImageOrganization = configuration.get('dockerImageOrganization'); this.microserviceDependencies = configuration.get('microserviceDependencies'); this.prodDatabaseTypePlugin = ['mongodb', 'neo4j', 'couchbase', 'cassandra', 'no'].includes( diff --git a/generators/server/prompts.js b/generators/server/prompts.js index 04157940..e8cd67b8 100644 --- a/generators/server/prompts.js +++ b/generators/server/prompts.js @@ -9,7 +9,6 @@ module.exports = { /* eslint-disable no-use-before-define */ askForServerSideOpts, askForMicroserviceDependencies, - askForBundleName, askForDockerOrganization, askForMicroFrontendGeneration, }; @@ -164,24 +163,6 @@ function askForServerSideOpts() { }); } -async function askForBundleName() { - if (this.existingProject) return; - - const { applicationType, baseName } = this.jhipsterConfig; - const prompts = [ - { - when: () => applicationType === 'microservice', - type: 'input', - name: 'bundleName', - message: 'What name would you give to the bundle to share on an Entando Component Repository?', - default: `${baseName.toLowerCase()}-bundle`, - }, - ]; - - const answers = await this.prompt(prompts); - this.bundleName = this.jhipsterConfig.bundleName = answers.bundleName; -} - async function askForDockerOrganization() { if (this.existingProject) return; diff --git a/test/templates/ms-noDb-oauth2-alwaysMFE/.yo-rc.json b/test/templates/ms-noDb-oauth2-alwaysMFE/.yo-rc.json index 220e16bf..ef166d6a 100644 --- a/test/templates/ms-noDb-oauth2-alwaysMFE/.yo-rc.json +++ b/test/templates/ms-noDb-oauth2-alwaysMFE/.yo-rc.json @@ -41,7 +41,6 @@ "searchEngine": false, "messageBroker": false, "enableSwaggerCodegen": false, - "bundleName": "entjhi7-bundle", "dockerImageOrganization": "dddd", "generateMicroFrontends": "always", "enableTranslation": true, diff --git a/test/templates/ms-noDb-oauth2-askForMFE/.yo-rc.json b/test/templates/ms-noDb-oauth2-askForMFE/.yo-rc.json index 074746ff..82a8e6fd 100644 --- a/test/templates/ms-noDb-oauth2-askForMFE/.yo-rc.json +++ b/test/templates/ms-noDb-oauth2-askForMFE/.yo-rc.json @@ -41,7 +41,6 @@ "searchEngine": false, "messageBroker": false, "enableSwaggerCodegen": false, - "bundleName": "entjhi7-bundle", "dockerImageOrganization": "dddd", "generateMicroFrontends": "ask", "enableTranslation": true, diff --git a/test/templates/ms-noDb-oauth2-withoutMFE/.yo-rc.json b/test/templates/ms-noDb-oauth2-withoutMFE/.yo-rc.json index 85c1bcf2..33671cdd 100644 --- a/test/templates/ms-noDb-oauth2-withoutMFE/.yo-rc.json +++ b/test/templates/ms-noDb-oauth2-withoutMFE/.yo-rc.json @@ -41,7 +41,6 @@ "searchEngine": false, "messageBroker": false, "enableSwaggerCodegen": false, - "bundleName": "entjhi7-bundle", "dockerImageOrganization": "dddd", "generateMicroFrontends": "never", "enableTranslation": true, diff --git a/test/templates/ms-postgres-oauth2-alwaysMFE/.yo-rc.json b/test/templates/ms-postgres-oauth2-alwaysMFE/.yo-rc.json index 8c324b43..94c16687 100644 --- a/test/templates/ms-postgres-oauth2-alwaysMFE/.yo-rc.json +++ b/test/templates/ms-postgres-oauth2-alwaysMFE/.yo-rc.json @@ -41,7 +41,6 @@ "searchEngine": false, "messageBroker": false, "enableSwaggerCodegen": false, - "bundleName": "entjhi7-bundle", "dockerImageOrganization": "dddd", "generateMicroFrontends": "always", "enableTranslation": true, diff --git a/test/templates/ms-postgres-oauth2-askForMFE/.yo-rc.json b/test/templates/ms-postgres-oauth2-askForMFE/.yo-rc.json index aa48a0df..462bbd73 100644 --- a/test/templates/ms-postgres-oauth2-askForMFE/.yo-rc.json +++ b/test/templates/ms-postgres-oauth2-askForMFE/.yo-rc.json @@ -41,7 +41,6 @@ "searchEngine": false, "messageBroker": false, "enableSwaggerCodegen": false, - "bundleName": "entjhi7-bundle", "dockerImageOrganization": "dddd", "generateMicroFrontends": "ask", "enableTranslation": true, diff --git a/test/templates/ms-postgres-oauth2-withoutMFE/.yo-rc.json b/test/templates/ms-postgres-oauth2-withoutMFE/.yo-rc.json index 1b7e4bc7..b6c28066 100644 --- a/test/templates/ms-postgres-oauth2-withoutMFE/.yo-rc.json +++ b/test/templates/ms-postgres-oauth2-withoutMFE/.yo-rc.json @@ -41,7 +41,6 @@ "searchEngine": false, "messageBroker": false, "enableSwaggerCodegen": false, - "bundleName": "entjhi7-bundle", "dockerImageOrganization": "dddd", "generateMicroFrontends": "never", "enableTranslation": true, From 6d55aca5f7f2939a39f1aabbc1ddc8b91fcaa337 Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 15 Sep 2022 18:12:53 +0200 Subject: [PATCH 06/37] [ECS-463] Remove the common sub generator since we don't need anymore with the revert in the .gitignore --- generators/common/index.js | 25 ---- generators/common/templates/gitignore.ejs | 171 ---------------------- test/common.spec.js | 58 -------- 3 files changed, 254 deletions(-) delete mode 100644 generators/common/index.js delete mode 100644 generators/common/templates/gitignore.ejs delete mode 100644 test/common.spec.js diff --git a/generators/common/index.js b/generators/common/index.js deleted file mode 100644 index c9b8b87a..00000000 --- a/generators/common/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const chalk = require('chalk'); -const CommonGenerator = require('generator-jhipster/generators/common'); - -module.exports = class extends CommonGenerator { - constructor(args, options, features) { - super(args, options, features); - - if (this.options.help) return; - - if (!this.options.jhipsterContext) { - throw new Error( - `This is a JHipster blueprint and should be used only like ${chalk.yellow( - 'jhipster --blueprints entando', - )}`, - ); - } - - this.sbsBlueprint = true; - } - - /** - * A blueprint can't be empty, we add a fake method here to ensure that. - */ - notEmpty() {} -}; diff --git a/generators/common/templates/gitignore.ejs b/generators/common/templates/gitignore.ejs deleted file mode 100644 index 8216b9c9..00000000 --- a/generators/common/templates/gitignore.ejs +++ /dev/null @@ -1,171 +0,0 @@ -###################### -# Project Specific -######################<% if (!skipClient) { %> -/<%= CLIENT_MAIN_SRC_DIR %>content/css/main.css<% } %> -/<%= CLIENT_DIST_DIR %>** -/<%= TEST_DIR %>javascript/coverage/ - -###################### -# Node -###################### -/node/ -node_tmp/ -node_modules/ -npm-debug.log.* -/.awcache/* -/.cache-loader/* - -###################### -# SASS -###################### -.sass-cache/ - -###################### -# Eclipse -###################### -*.pydevproject -.project -.metadata -tmp/ -tmp/**/* -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath -.factorypath -/<%= SERVER_MAIN_RES_DIR %>rebel.xml - -# External tool builders -.externalToolBuilders/** - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - -# STS-specific -/.sts4-cache/* - -###################### -# IntelliJ -###################### -.idea/ -*.iml -*.iws -*.ipr -*.ids -*.orig -classes/ -out/ - -###################### -# Visual Studio Code -###################### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -###################### -# Maven -###################### -/log/ -/target/ - -###################### -# Gradle -###################### -.gradle/ -/build/ - -###################### -# Package Files -###################### -*.jar -*.war -*.ear -*.db - -###################### -# Windows -###################### -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - -###################### -# Mac OSX -###################### -.DS_Store -.svn - -# Thumbnails -._* - -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -###################### -# Directories -###################### -/bin/ -/deploy/ - -###################### -# Logs -###################### -*.log* - -###################### -# Others -###################### -*.class -*.*~ -*~ -.merge_file* - -###################### -# Gradle Wrapper -###################### -!gradle/wrapper/gradle-wrapper.jar - -###################### -# Maven Wrapper -###################### -!.mvn/wrapper/maven-wrapper.jar - -###################### -# ESLint -###################### -.eslintcache - -###################### -# Code coverage -###################### -/coverage/ -/.nyc_output/ - -###################### -# Entando -###################### -bundle/ -# !/bundle/descriptor.yaml -.entando-placeholder - -###################### -# Keycloak DB files -###################### -/src/main/docker/keycloak-db/ diff --git a/test/common.spec.js b/test/common.spec.js deleted file mode 100644 index e799c503..00000000 --- a/test/common.spec.js +++ /dev/null @@ -1,58 +0,0 @@ -const path = require('path'); -const assert = require('yeoman-assert'); -const helpers = require('yeoman-test'); - -describe('Subgenerator common of entando JHipster blueprint', () => { - describe('With default blueprint configuration', () => { - before(done => { - helpers - .run('generator-jhipster/generators/common') - .withOptions({ - 'from-cli': true, - skipInstall: true, - blueprint: 'entando', - skipChecks: true, - }) - .withGenerators([ - [ - require('../generators/common/index'), // eslint-disable-line global-require - 'jhipster-entando:common', - path.join(__dirname, '../generators/common/index.js'), - ], - ]) - .withPrompts({ - baseName: 'entandoPlugin', - packageName: 'com.mycompany.myapp', - applicationType: 'microservice', - databaseType: 'sql', - devDatabaseType: 'h2Disk', - prodDatabaseType: 'mysql', - cacheProvider: 'ehcache', - authenticationType: 'oauth2', - enableTranslation: true, - nativeLanguage: 'en', - languages: ['fr', 'de'], - buildTool: 'maven', - rememberMeKey: '2bb60a80889aa6e6767e9ccd8714982681152aa5', - }) - .on('end', done); - }); - - it('should have Entando bundle in the .gitignore file', () => { - assert.fileContent( - '.gitignore', - '######################\n' + - '# Entando\n' + - '######################\n' + - 'bundle/\n' + - '# !/bundle/descriptor.yaml\n' + - '.entando-placeholder\n' + - '\n' + - '######################\n' + - '# Keycloak DB files\n' + - '######################\n' + - '/src/main/docker/keycloak-db/', - ); - }); - }); -}); From 9b037acf07284eb9324e05c60104825ca526a994 Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 15 Sep 2022 15:29:14 +0200 Subject: [PATCH 07/37] [ECS-230] Update the SecurityConfiguration.java to avoid 403 on startup --- .../java/package/config/SecurityConfiguration.java.ejs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs b/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs index 39c273ac..4cc510f1 100644 --- a/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +++ b/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs @@ -122,8 +122,11 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { private String issuerUri; <%_ } _%> private final SecurityProblemSupport problemSupport; +<%_ if (authenticationTypeOauth2) { _%> + private final JwtGrantedAuthorityConverter jwtGrantedAuthorityConverter; +<%_ } _%> - public SecurityConfiguration(<% if (authenticationTypeSession && !skipUserManagement) { %>RememberMeServices rememberMeServices, <% } if (authenticationTypeJwt) { %>TokenProvider tokenProvider, <% } %><% if (!applicationTypeMicroservice) { %>CorsFilter corsFilter, <% } %> JHipsterProperties jHipsterProperties, SecurityProblemSupport problemSupport) { + public SecurityConfiguration(<% if (authenticationTypeSession && !skipUserManagement) { %>RememberMeServices rememberMeServices, <% } if (authenticationTypeJwt) { %>TokenProvider tokenProvider, <% } %><% if (!applicationTypeMicroservice) { %>CorsFilter corsFilter, <% } %> JHipsterProperties jHipsterProperties, SecurityProblemSupport problemSupport, <%_ if (authenticationTypeOauth2) { _%>JwtGrantedAuthorityConverter jwtGrantedAuthorityConverter<%_ } _%>) { <%_ if (authenticationTypeSession && !skipUserManagement) { _%> this.rememberMeServices = rememberMeServices; <%_ } _%> @@ -135,6 +138,9 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { <%_ } _%> this.problemSupport = problemSupport; this.jHipsterProperties = jHipsterProperties; + <%_ if (authenticationTypeOauth2) { _%> + this.jwtGrantedAuthorityConverter = jwtGrantedAuthorityConverter; + <%_ } _%> } <%_ if (authenticationTypeSession) { _%> @@ -301,7 +307,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { Converter authenticationConverter() { JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter(); - jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(new JwtGrantedAuthorityConverter()); + jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(jwtGrantedAuthorityConverter); return jwtAuthenticationConverter; } <%_ if (!applicationTypeMicroservice) { _%> From cd2440d3a357487148f15a550f0ed048f6c3e046 Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Tue, 20 Sep 2022 18:04:29 +0200 Subject: [PATCH 08/37] [ECS-463] Resync the pom.xml --- generators/server/templates/pom.xml.ejs | 432 +++++++++++++++--------- 1 file changed, 273 insertions(+), 159 deletions(-) diff --git a/generators/server/templates/pom.xml.ejs b/generators/server/templates/pom.xml.ejs index 93f1361e..8159b650 100644 --- a/generators/server/templates/pom.xml.ejs +++ b/generators/server/templates/pom.xml.ejs @@ -30,13 +30,13 @@ <%= humanizedBaseName %> - <%_ if (SPRING_BOOT_VERSION.indexOf('M') > -1 || SPRING_BOOT_VERSION.indexOf('RC') > -1) { _%> +<%_ if (SPRING_BOOT_VERSION.indexOf('M') > -1 || SPRING_BOOT_VERSION.indexOf('RC') > -1) { _%> spring-milestone https://repo.spring.io/milestone - <%_ } _%> - <%_ if (JHIPSTER_DEPENDENCIES_VERSION.endsWith('-SNAPSHOT')) { _%> +<%_ } _%> +<%_ if (JHIPSTER_DEPENDENCIES_VERSION.endsWith('-SNAPSHOT')) { _%> ossrh-snapshots https://oss.sonatype.org/content/repositories/snapshots/ @@ -61,13 +61,13 @@ - <%_ if (SPRING_BOOT_VERSION.indexOf('M') > -1 || SPRING_BOOT_VERSION.indexOf('RC') > -1) { _%> +<%_ if (SPRING_BOOT_VERSION.indexOf('M') > -1 || SPRING_BOOT_VERSION.indexOf('RC') > -1) { _%> spring-milestones Spring Milestones https://repo.spring.io/milestone - <%_ } _%> +<%_ } _%> @@ -92,7 +92,7 @@ jdt_apt false -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> <%_ } _%> @@ -106,71 +106,83 @@ <%= SPRING_BOOT_VERSION %> -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> <%= HIBERNATE_VERSION %> - <%_ if (!reactive) { _%> + <%_ if (!reactive) { _%> 3.27.0-GA - <%_ } _%> + <%_ } _%> <%= LIQUIBASE_VERSION %> - <%_ if (!reactive) { _%> - 4.3.5 - <%_ } _%> - <%_ if (devDatabaseType === 'h2Disk') { _%> + <%_ if (!reactive) { _%> + 4.4.3 + <%_ } _%> + <%_ if (devDatabaseTypeH2Disk) { _%> 1.4.200 - <%_ } _%> + <%_ } _%> 2.0.1.Final - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> 1.9.4 - <%_ } _%> + <%_ } _%> <%_ } _%> <%_ if (reactive) { _%> 1.0.6.RELEASE <%_ } _%> -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> 2.3.3 <%_ } _%> - 0.19.0 +<%_ if (databaseTypeCassandra) { _%> + + 4.11.3 +<%_ } _%> + 0.21.0 1.4.2.Final <%_ if (enableSwaggerCodegen) { _%> <%= JACKSON_DATABIND_NULLABLE_VERSION %> <%_ } _%> -<%_ if (cacheProvider === 'caffeine') { _%> - 3.0.2 +<%_ if (cacheProviderCaffeine) { _%> + 3.0.3 1.4.1 <%_ } _%> - 3.0.0 +<%_ if (databaseTypeNeo4j) { _%> + + 4.8.87 +<%_ } _%> 3.1.0 3.9.1 3.8.1 - 3.3.0 + 3.3.1 2.10 - 3.0.0-M3 + 3.0.0 3.0.0-M5 2.2.1 3.2.0 3.0.0-M5 3.3.1 3.1.2 - 8.43 - 0.0.8 + 9.0 + 0.0.9 <%_ if (!skipClient) { _%> 1.12.0 - 1.10 + 1.11 3.0.0 <%_ } _%> - 4.0.5 + 5.0.0 + 2.3.0 <%= JACOCO_VERSION %> <%= JIB_VERSION %> + <%= DOCKER_JAVA_JRE %> + amd64 1.0.0 <%_ if (enableSwaggerCodegen) { _%> - 5.1.1 + 5.2.1 <%_ } _%> 1.0.0 3.9.0.2155 @@ -222,23 +234,29 @@ runtime <%_ } _%> -<%_ if (cacheProvider !== 'no') { _%> +<%_ if (!cacheProviderNo) { _%> org.springframework.boot spring-boot-starter-cache <%_ } _%> -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> com.fasterxml.jackson.module jackson-module-jaxb-annotations - <%_ if (!reactive) { _%> + <%_ if (!reactive) { _%> com.fasterxml.jackson.datatype jackson-datatype-hibernate5 - <%_ } _%> + <%_ } else { _%> + + commons-beanutils + commons-beanutils + ${commons-beanutils.version} + + <%_ } _%> <%_ } _%> com.fasterxml.jackson.datatype @@ -248,45 +266,39 @@ com.fasterxml.jackson.datatype jackson-datatype-jsr310 -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> com.h2database h2 test - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> io.r2dbc r2dbc-h2 test - <%_ } _%> + <%_ } _%> <%_ } _%> -<%_ if (applicationType === 'gateway' && authenticationType === 'uaa') { _%> - - org.apache.httpcomponents - httpclient - -<%_ } _%> -<%_ if (cacheProvider === 'hazelcast') { _%> +<%_ if (cacheProviderHazelcast) { _%> com.hazelcast hazelcast <%_ } _%> -<%_ if (cacheProvider === 'hazelcast' && enableHibernateCache) { _%> +<%_ if (cacheProviderHazelcast && enableHibernateCache) { _%> com.hazelcast hazelcast-hibernate53 <%_ } _%> -<%_ if (cacheProvider === 'hazelcast') { _%> +<%_ if (cacheProviderHazelcast) { _%> com.hazelcast hazelcast-spring <%_ } _%> -<%_ if (cacheProvider === 'infinispan') { _%> +<%_ if (cacheProviderInfinispan) { _%> org.infinispan infinispan-hibernate-cache-v53 @@ -304,7 +316,7 @@ infinispan-jcache <%_ } _%> -<%_ if (cacheProvider === 'memcached') { _%> +<%_ if (cacheProviderMemcached) { _%> com.google.code.simple-spring-memcached spring-cache @@ -318,13 +330,13 @@ xmemcached <%_ } _%> -<%_ if (cacheProvider === 'redis' && enableHibernateCache) { _%> +<%_ if (cacheProviderRedis && enableHibernateCache) { _%> org.hibernate hibernate-jcache <%_ } _%> -<%_ if (cacheProvider === 'redis') { _%> +<%_ if (cacheProviderRedis) { _%> org.redisson redisson @@ -344,7 +356,7 @@ io.springfox springfox-bean-validators -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> com.zaxxer HikariCP @@ -354,7 +366,7 @@ org.apache.commons commons-lang3 -<%_ if (databaseType === 'cassandra' || databaseType === 'couchbase') { _%> +<%_ if (databaseTypeCassandra || databaseTypeCouchbase) { _%> commons-codec commons-codec @@ -367,14 +379,14 @@ ${jackson-databind-nullable.version} <%_ } _%> -<%_ if (databaseType === 'mongodb') { _%> +<%_ if (databaseTypeMongodb) { _%> de.flapdoodle.embed de.flapdoodle.embed.mongo test <%_ } _%> -<%_ if (databaseType === 'couchbase') { _%> +<%_ if (databaseTypeCouchbase) { _%> org.testcontainers couchbase @@ -384,71 +396,98 @@ com.couchbase.client java-client +<%_ } _%> +<%_ if (databaseTypeNeo4j) { _%> - com.couchbase.client - encryption + org.springframework.boot + spring-boot-starter-data-neo4j + + + eu.michael-simons.neo4j + neo4j-migrations-spring-boot-starter + + + + io.github.classgraph + classgraph + ${classgraph.version} + + + org.testcontainers + neo4j + test + + + org.testcontainers + testcontainers + test + + + org.testcontainers + junit-jupiter + test <%_ } _%> -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> org.testcontainers - <%_ if (prodDatabaseType === 'mysql') { _%> + <%_ if (prodDatabaseTypeMysql) { _%> mysql - <%_ } else if (prodDatabaseType === 'mariadb') { _%> + <%_ } else if (prodDatabaseTypeMariadb) { _%> mariadb - <%_ } else if (prodDatabaseType === 'postgresql') { _%> + <%_ } else if (prodDatabaseTypePostgres) { _%> postgresql - <%_ } else if (prodDatabaseType === 'mssql') { _%> + <%_ } else if (prodDatabaseTypeMssql) { _%> mssqlserver - <%_ } else if (prodDatabaseType === 'oracle') { _%> + <%_ } else if (prodDatabaseTypeOracle) { _%> oracle-xe - <%_ } _%> + <%_ } _%> test <%_ } _%> -<%_ if (['ehcache', 'caffeine', 'hazelcast', 'infinispan', 'memcached'].includes(cacheProvider)) { _%> +<%_ if (cacheProviderEhCache || cacheProviderCaffeine || cacheProviderHazelcast || cacheProviderInfinispan || cacheProviderMemcached) { _%> javax.cache cache-api <%_ } _%> -<%_ if (prodDatabaseType === 'mysql') { _%> +<%_ if (prodDatabaseTypeMysql) { _%> mysql mysql-connector-java - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> dev.miku r2dbc-mysql - <%_ } _%> + <%_ } _%> <%_ } _%> -<%_ if (prodDatabaseType === 'mariadb') { _%> +<%_ if (prodDatabaseTypeMariadb) { _%> org.mariadb.jdbc mariadb-java-client - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> org.mariadb r2dbc-mariadb - <%_ } _%> + <%_ } _%> <%_ } _%> -<%_ if (databaseType === 'cassandra') { _%> +<%_ if (databaseTypeCassandra) { _%> org.lz4 lz4-java <%_ } _%> -<%_ if (prodDatabaseType === 'oracle') { _%> +<%_ if (prodDatabaseTypeOracle) { _%> com.oracle.database.jdbc ojdbc8 <%_ } _%> -<%_ if (prodDatabaseType === 'mssql') { _%> +<%_ if (prodDatabaseTypeMssql) { _%> com.microsoft.sqlserver mssql-jdbc @@ -458,14 +497,14 @@ liquibase-mssql ${liquibase.version} - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> io.r2dbc r2dbc-mssql - <%_ } _%> + <%_ } _%> <%_ } _%> -<%_ if (databaseType === 'cassandra') { _%> +<%_ if (databaseTypeCassandra) { _%> org.cassandraunit cassandra-unit-spring @@ -477,19 +516,19 @@ test <%_ } _%> -<%_ if (cacheProvider === 'ehcache') { _%> +<%_ if (cacheProviderEhCache) { _%> org.ehcache ehcache - <%_ if (enableHibernateCache) { _%> + <%_ if (enableHibernateCache) { _%> org.hibernate hibernate-jcache - <%_ } _%> + <%_ } _%> <%_ } _%> -<%_ if (cacheProvider === 'caffeine') { _%> +<%_ if (cacheProviderCaffeine) { _%> com.github.ben-manes.caffeine caffeine @@ -505,14 +544,14 @@ config ${typesafe.version} - <%_ if (enableHibernateCache) { _%> + <%_ if (enableHibernateCache) { _%> org.hibernate hibernate-jcache - <%_ } _%> + <%_ } _%> <%_ } _%> -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> org.hibernate hibernate-jpamodelgen @@ -533,7 +572,7 @@ ${liquibase.version} <%_ } _%> -<%_ if (databaseType === 'mongodb') { _%> +<%_ if (databaseTypeMongodb) { _%> com.github.cloudyrock.mongock mongock-spring-v5 @@ -543,23 +582,23 @@ mongodb-springdata-v3-driver <%_ } _%> -<%_ if (databaseType === 'couchbase') { _%> +<%_ if (databaseTypeCouchbase) { _%> com.github.differentway couchmove <%_ } _%> -<%_ if (prodDatabaseType === 'postgresql') { _%> +<%_ if (prodDatabaseTypePostgres) { _%> org.postgresql postgresql - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> io.r2dbc r2dbc-postgresql - <%_ } _%> + <%_ } _%> <%_ } _%> org.mapstruct @@ -585,36 +624,48 @@ org.springframework.boot spring-boot-starter-actuator -<%_ if (databaseType === 'sql') { _%> - <%_ if (!reactive) { _%> +<%_ if (databaseTypeSql) { _%> + <%_ if (!reactive) { _%> org.springframework.boot spring-boot-starter-data-jpa - <%_ } else { _%> + <%_ } else { _%> org.springframework.boot spring-boot-starter-data-r2dbc - <%_ } _%> + <%_ } _%> <%_ } _%> -<%_ if (searchEngine === 'elasticsearch') { _%> +<%_ if (searchEngineElasticsearch) { _%> org.springframework.boot spring-boot-starter-data-elasticsearch <%_ } _%> -<%_ if (['mongodb', 'cassandra', 'couchbase'].includes(databaseType)) { _%> +<%_ if (databaseTypeMongodb || databaseTypeCassandra || databaseTypeCouchbase) { _%> org.springframework.boot spring-boot-starter-data-<%= databaseType %><% if (reactive) { %>-reactive<% } %> <%_ } _%> <%_ if (reactive) { _%> + <%_ if (databaseTypeMongodb) { _%> + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + <%_ } _%> org.springframework.boot spring-boot-starter-validation + + org.springframework.data + spring-data-commons + io.netty netty-tcnative-boringssl-static @@ -628,7 +679,7 @@ org.springframework.boot spring-boot-starter-mail -<%_ if (authenticationType !== 'oauth2') { _%> +<%_ if (!authenticationTypeOauth2) { _%> org.springframework.boot spring-boot-starter-security @@ -646,14 +697,14 @@ org.springframework.boot spring-boot-starter-test test - <%_ if (cucumberTests === false) { _%> +<%_ if (cucumberTests === false) { _%> org.junit.vintage junit-vintage-engine - <%_ } _%> +<%_ } _%> org.springframework.boot @@ -679,14 +730,6 @@ ${archunit-junit5.version} test - <%_ if (databaseType === 'no') { _%> - - org.json - json - 20210307 - test - - <%_ } _%> @@ -695,18 +738,18 @@ ${archunit-junit5.version} test -<%_ if (messageBroker === 'kafka') { _%> - <%_ if (!reactive) { _%> +<%_ if (messageBrokerKafka) { _%> + <%_ if (!reactive) { _%> org.apache.kafka kafka-clients - <%_ } else { _%> + <%_ } else { _%> io.projectreactor.kafka reactor-kafka - <%_ } _%> + <%_ } _%> org.testcontainers kafka @@ -717,13 +760,13 @@ org.zalando problem-spring-web<% if (reactive) { %>flux<%_ } _%> -<%_ if (websocket === 'spring-websocket') { _%> +<%_ if (communicationSpringWebsocket) { _%> org.springframework.boot spring-boot-starter-websocket <%_ } _%> -<%_ if (authenticationType === 'oauth2') { _%> +<%_ if (authenticationTypeOauth2) { _%> org.springframework.boot @@ -734,7 +777,7 @@ spring-boot-starter-oauth2-resource-server <%_ } _%> -<%_ if (authenticationType === 'jwt') { _%> +<%_ if (authenticationTypeJwt) { _%> io.jsonwebtoken jjwt-api @@ -750,7 +793,7 @@ <% if (reactive) { %>compile<% } else { %>runtime<% } %> <%_ } _%> -<%_ if (databaseType === 'cassandra') { _%> +<%_ if (databaseTypeCassandra) { _%> com.datastax.oss @@ -758,7 +801,7 @@ <%_ } _%> -<%_ if (applicationType === 'gateway') { _%> +<%_ if (applicationTypeGateway) { _%> org.springframework.cloud spring-cloud-starter-gateway @@ -772,15 +815,22 @@ bucket4j-jcache <%_ } _%> -<%_ if (applicationType === 'microservice' || applicationType === 'gateway') { _%> +<%_ if (applicationTypeMicroservice || applicationTypeGateway) { _%> org.springframework.cloud spring-cloud-starter +<%_ if (reactive) { _%> org.springframework.cloud - spring-cloud-starter-netflix-hystrix + spring-cloud-starter-circuitbreaker-reactor-resilience4j +<%_ } else { _%> + + org.springframework.cloud + spring-cloud-starter-circuitbreaker-resilience4j + +<%_ } _%> org.springframework.retry spring-retry @@ -792,7 +842,7 @@ spring-cloud-starter-bootstrap <%_ } _%> -<%_ if (serviceDiscoveryType === 'eureka') { _%> +<%_ if (serviceDiscoveryEureka) { _%> org.springframework.cloud spring-cloud-starter-netflix-eureka-client @@ -802,7 +852,7 @@ spring-cloud-starter-config <%_ } _%> -<%_ if (serviceDiscoveryType === 'consul') { _%> +<%_ if (serviceDiscoveryConsul) { _%> org.springframework.cloud spring-cloud-starter-consul-discovery @@ -812,18 +862,32 @@ spring-cloud-starter-consul-config <%_ } _%> -<%_ if (applicationType === 'gateway' && authenticationType === 'oauth2' && reactive) { _%> +<%_ if (applicationTypeGateway && authenticationTypeOauth2 && reactive) { _%> org.springframework.cloud spring-cloud-starter-security <%_ } _%> -<%_ if (applicationType === 'microservice' || applicationType === 'gateway') { _%> +<%_ if (applicationTypeMicroservice || applicationTypeGateway) { _%> org.springframework.cloud spring-cloud-starter-openfeign <%_ } _%> +<%_ if (applicationTypeGateway || (applicationTypeMicroservice && reactive)) { _%> + + com.playtika.reactivefeign + feign-reactor-webclient + + + com.playtika.reactivefeign + feign-reactor-cloud + + + com.playtika.reactivefeign + feign-reactor-spring-configuration + +<%_ } _%> <%_ if (!reactive) { _%><%# Can remove when Spring Security 5.5 is released https://github.com/spring-projects/spring-security/issues/8958 %> org.springframework.security @@ -838,7 +902,7 @@ io.dropwizard.metrics metrics-core -<%_ if (websocket === 'spring-websocket') { _%> +<%_ if (communicationSpringWebsocket) { _%> org.springframework.security spring-security-messaging @@ -922,7 +986,7 @@ org.sonarsource.scanner.maven sonar-maven-plugin -<%_ if (databaseType === 'sql' && !reactive) { _%> +<%_ if (databaseTypeSql && !reactive) { _%> org.liquibase liquibase-maven-plugin @@ -940,6 +1004,10 @@ org.codehaus.mojo properties-maven-plugin + + org.gaul + modernizer-maven-plugin + <%_ if (enableSwaggerCodegen) { _%> org.hibernate @@ -1014,6 +1082,13 @@ jaxb-runtime ${jaxb-runtime.version} +<%_ } _%> +<%_ if (databaseTypeCassandra) { _%> + + com.datastax.oss + java-driver-mapper-processor + ${cassandra-driver.version} + <%_ } _%> @@ -1086,8 +1161,8 @@ - pl.project13.maven - git-commit-id-plugin + io.github.git-commit-id + git-commit-id-maven-plugin ${git-commit-id-plugin.version} @@ -1107,6 +1182,23 @@ + + org.gaul + modernizer-maven-plugin + ${modernizer-maven-plugin.version} + + + modernizer + package + + modernizer + + + + + ${java.version} + + org.jacoco jacoco-maven-plugin @@ -1164,14 +1256,14 @@ <%= serverPort %> - <%_ if (cacheProvider === 'hazelcast') { _%> +<%_ if (cacheProviderHazelcast) { _%> 5701/udp - <%_ } _%> +<%_ } _%> - <%_ if (cacheProvider === 'infinispan') { _%> +<%_ if (cacheProviderInfinispan) { _%> -Djgroups.tcp.address=NON_LOOPBACK -Djava.net.preferIPv4Stack=true - <%_ } _%> +<%_ } _%> ALWAYS 0 @@ -1189,7 +1281,7 @@ -<%_ if (databaseType === 'sql' && !reactive) { _%> +<%_ if (databaseTypeSql && !reactive) { _%> org.liquibase liquibase-maven-plugin @@ -1197,18 +1289,18 @@ ${project.basedir}/<%= SERVER_MAIN_RES_DIR %>config/liquibase/master.xml ${project.basedir}/<%= SERVER_MAIN_RES_DIR %>config/liquibase/changelog/${maven.build.timestamp}_changelog.xml - <% if (devDatabaseType === 'mysql') { %>com.mysql.cj.jdbc.Driver<% } else if (devDatabaseType === 'mariadb') { %>org.mariadb.jdbc.Driver<% } else if (devDatabaseType === 'postgresql') { %>org.postgresql.Driver<% } else if (devDatabaseType === 'h2Disk') { %>org.h2.Driver<% } else if (devDatabaseType === 'oracle') { %>oracle.jdbc.OracleDriver<% } %> - <% if (['mysql', 'mariadb', 'postgresql', 'mssql'].includes(devDatabaseType)) { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: baseName, skipExtraOptions: true }) %><% } else if (devDatabaseType === 'h2Disk') { %><%- getJDBCUrl(devDatabaseType, { localDirectory: '${project.build.directory}/h2db/db', databaseName: lowercaseBaseName, skipExtraOptions: true }) %><% } else if (devDatabaseType === 'oracle') { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: 'xe', skipExtraOptions: true}) %><% } %> - <% if (devDatabaseType === 'mysql') { %><%= baseName %><% } else if (devDatabaseType === 'postgresql') { %><% } %> - <% if (devDatabaseType === 'mysql') { %>root<% } else if (devDatabaseType === 'postgresql' || devDatabaseType === 'h2Disk' || devDatabaseType === 'h2Memory') { %><%= baseName %><% } else if (devDatabaseType === 'mssql') { %>SA<% } %> - <% if (devDatabaseType === 'mssql') { %>yourStrong(!)Password<% } %> - hibernate:spring:<%= packageName %>.domain?dialect=<% if (devDatabaseType === 'mysql') { %>org.hibernate.dialect.MySQL8Dialect<% } else if (devDatabaseType === 'mariadb') { %>org.hibernate.dialect.MariaDB103Dialect<% } else if (devDatabaseType === 'postgresql') { %>tech.jhipster.domain.util.FixedPostgreSQL10Dialect<% } else if (devDatabaseType === 'h2Disk') { %>org.hibernate.dialect.H2Dialect<% } else if (devDatabaseType === 'oracle') { %>org.hibernate.dialect.Oracle12cDialect<% } else if (devDatabaseType === 'mssql') { %>org.hibernate.dialect.SQLServer2012Dialect<% } %>&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + <% if (devDatabaseTypeMysql) { %>com.mysql.cj.jdbc.Driver<% } else if (devDatabaseTypeMariadb) { %>org.mariadb.jdbc.Driver<% } else if (devDatabaseTypePostgres) { %>org.postgresql.Driver<% } else if (devDatabaseTypeH2Disk) { %>org.h2.Driver<% } else if (devDatabaseTypeOracle) { %>oracle.jdbc.OracleDriver<% } %> + <% if (devDatabaseTypeMysql || devDatabaseTypeMariadb || devDatabaseTypePostgres || devDatabaseTypeMssql) { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: baseName, skipExtraOptions: true }) %><% } else if (devDatabaseTypeH2Disk) { %><%- getJDBCUrl(devDatabaseType, { localDirectory: '${project.build.directory}/h2db/db', databaseName: lowercaseBaseName, skipExtraOptions: true }) %><% } else if (devDatabaseTypeOracle) { %><%- getJDBCUrl(devDatabaseType, { hostname: 'localhost', databaseName: 'xe', skipExtraOptions: true}) %><% } %> + <% if (devDatabaseTypeMysql) { %><%= baseName %><% } else if (devDatabaseTypePostgres) { %><% } %> + <% if (devDatabaseTypeMysql) { %>root<% } else if (devDatabaseTypePostgres || devDatabaseTypeH2Any) { %><%= baseName %><% } else if (devDatabaseTypeMssql) { %>SA<% } %> + <% if (devDatabaseTypeMssql) { %>yourStrong(!)Password<% } %> + hibernate:spring:<%= packageName %>.domain?dialect=<% if (devDatabaseTypeMysql) { %>org.hibernate.dialect.MySQL8Dialect<% } else if (devDatabaseTypeMariadb) { %>org.hibernate.dialect.MariaDB103Dialect<% } else if (devDatabaseTypePostgres) { %>tech.jhipster.domain.util.FixedPostgreSQL10Dialect<% } else if (devDatabaseTypeH2Disk) { %>org.hibernate.dialect.H2Dialect<% } else if (devDatabaseTypeOracle) { %>org.hibernate.dialect.Oracle12cDialect<% } else if (devDatabaseTypeMssql) { %>org.hibernate.dialect.SQLServer2012Dialect<% } %>&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy true debug !test - <%_ if (authenticationType === 'oauth2') { _%> + <%_ if (authenticationTypeOauth2) { _%> oauth_access_token, oauth_approvals, oauth_client_details, oauth_client_token, oauth_code, oauth_refresh_token - <%_ } _%> + <%_ } _%> @@ -1236,20 +1328,20 @@ javassist ${javassist.version} - <%_ if (devDatabaseType === 'postgresql') { _%> + <%_ if (devDatabaseTypePostgres) { _%> tech.jhipster jhipster-framework ${jhipster-dependencies.version} - <%_ } _%> - <%_ if (devDatabaseType === 'h2Disk') { _%> + <%_ } _%> + <%_ if (devDatabaseTypeH2Disk) { _%> com.h2database h2 ${h2.version} - <%_ } _%> + <%_ } _%> <%_ } _%> @@ -1418,9 +1510,9 @@ Problem=org.zalando.problem.Problem false - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> true - <%_ } _%> + <%_ } _%> true <%= dasherizedBaseName %> @@ -1455,7 +1547,7 @@ Enable the line below to have remote debugging of your application on port 5005 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 --> -<%_ if (cacheProvider === 'infinispan') { _%> +<%_ if (cacheProviderInfinispan) { _%> -Djgroups.tcp.address=NON_LOOPBACK -Djava.net.preferIPv4Stack=true <%_ } _%> @@ -1466,7 +1558,7 @@ -<%_ if (databaseType === 'sql') { _%> +<%_ if (databaseTypeSql) { _%> no-liquibase @@ -1493,18 +1585,18 @@ true - <%_ if (devDatabaseType === 'h2Disk' || devDatabaseType === 'h2Memory') { _%> + <%_ if (devDatabaseTypeH2Any) { _%> com.h2database h2 - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> io.r2dbc r2dbc-h2 - <%_ } _%> <%_ } _%> + <%_ } _%> @@ -1514,11 +1606,22 @@ ${checksum-maven-plugin.version} + create-pre-compiled-webapp-checksum files generate-resources + + create-compiled-webapp-checksum + + files + + compile + + checksums.csv.old + + @@ -1526,8 +1629,20 @@ ${project.basedir} <%= MAIN_DIR %>webapp/**/*.* + target/classes/static/**/*.* + package-lock.json package.json webpack/*.* + tsconfig.json + <%_ if (clientFrameworkAngular) { _%> + tsconfig.app.json + <%_ } _%> + <%_ if (clientFrameworkReact) { _%> + .postcss.config.js + <%_ } _%> + <%_ if (clientFrameworkVue) { _%> + .postcssrc.js + <%_ } _%> **/app/**/service-worker.js @@ -1565,7 +1680,6 @@ - true @@ -1612,7 +1726,7 @@ - dev<%_ if (databaseType === 'sql') { _%>${profile.no-liquibase}<%_ } _%> + dev<%_ if (databaseTypeSql) { _%>${profile.no-liquibase}<%_ } _%> <%_ } _%> @@ -1633,22 +1747,22 @@ spring-boot-devtools true -<%_ if (devDatabaseType === 'h2Disk' || devDatabaseType === 'h2Memory') { _%> +<%_ if (devDatabaseTypeH2Any) { _%> com.h2database h2 - <%_ if (reactive) { _%> + <%_ if (reactive) { _%> io.r2dbc r2dbc-h2 - <%_ } _%> + <%_ } _%> <%_ } _%> - dev${profile.tls}<%_ if (databaseType === 'sql') { _%>${profile.no-liquibase}<%_ } _%> + dev${profile.tls}<%_ if (databaseTypeSql) { _%>${profile.no-liquibase}<%_ } _%> @@ -1734,14 +1848,14 @@ <%_ } _%> - pl.project13.maven - git-commit-id-plugin + io.github.git-commit-id + git-commit-id-maven-plugin - prod${profile.api-docs}${profile.tls}<%_ if (databaseType === 'sql') { _%>${profile.no-liquibase}<%_ } _%> + prod${profile.api-docs}${profile.tls}<%_ if (databaseTypeSql) { _%>${profile.no-liquibase}<%_ } _%> @@ -1755,7 +1869,7 @@ -<%_ if (serviceDiscoveryType || applicationType === 'gateway' || applicationType === 'microservice') { _%> +<%_ if (serviceDiscoveryType || applicationTypeGateway || applicationTypeMicroservice) { _%> 4.8.87 <%_ } _%> + 3.0.0 3.1.0 3.9.1 From 8bda3b3dfac902f40887f9167a1ca4d5a29ec1b6 Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Thu, 22 Sep 2022 18:37:06 +0200 Subject: [PATCH 14/37] [ECS-463] Add the mfe-config file for all widgets --- generators/entity-microfrontend/files.js | 12 ++++++++++++ .../entity/_shared/public/mfe-config.json.ejs | 9 +++++++++ test/utils/expected-files.js | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 generators/entity-microfrontend/templates/ui/widgets/entity/_shared/public/mfe-config.json.ejs diff --git a/generators/entity-microfrontend/files.js b/generators/entity-microfrontend/files.js index 6b5bd91c..e498a93c 100644 --- a/generators/entity-microfrontend/files.js +++ b/generators/entity-microfrontend/files.js @@ -159,6 +159,10 @@ const microFrontendFiles = { file: 'entity/detailsWidget/public/robots.txt', renameTo: generator => `${generator.entityFileName}/detailsWidget/public/robots.txt`, }, + { + file: 'entity/_shared/public/mfe-config.json', + renameTo: generator => `${generator.entityFileName}/detailsWidget/public/mfe-config.json`, + }, ], }, { @@ -179,6 +183,10 @@ const microFrontendFiles = { file: 'entity/formWidget/public/robots.txt', renameTo: generator => `${generator.entityFileName}/formWidget/public/robots.txt`, }, + { + file: 'entity/_shared/public/mfe-config.json', + renameTo: generator => `${generator.entityFileName}/formWidget/public/mfe-config.json`, + }, ], }, { @@ -199,6 +207,10 @@ const microFrontendFiles = { file: 'entity/tableWidget/public/robots.txt', renameTo: generator => `${generator.entityFileName}/tableWidget/public/robots.txt`, }, + { + file: 'entity/_shared/public/mfe-config.json', + renameTo: generator => `${generator.entityFileName}/tableWidget/public/mfe-config.json`, + }, ], }, ], diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/_shared/public/mfe-config.json.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/_shared/public/mfe-config.json.ejs new file mode 100644 index 00000000..6952d728 --- /dev/null +++ b/generators/entity-microfrontend/templates/ui/widgets/entity/_shared/public/mfe-config.json.ejs @@ -0,0 +1,9 @@ +{ + "systemParams":{ + "api":{ + "<%= entityFileName %>-api":{ + "url":"http://localhost:<%= serverPort %>" + } + } + } +} diff --git a/test/utils/expected-files.js b/test/utils/expected-files.js index 9254d402..d3962bb4 100644 --- a/test/utils/expected-files.js +++ b/test/utils/expected-files.js @@ -25,6 +25,7 @@ const expectedFiles = { 'ui/widgets/foo/detailsWidget/public/favicon.ico', 'ui/widgets/foo/detailsWidget/public/index.html', 'ui/widgets/foo/detailsWidget/public/robots.txt', + 'ui/widgets/foo/detailsWidget/public/mfe-config.json', 'ui/widgets/foo/detailsWidget/scripts/i18next-scanner.config.js', 'ui/widgets/foo/detailsWidget/src/api/foo.js', 'ui/widgets/foo/detailsWidget/src/api/helpers.js', @@ -72,6 +73,7 @@ const expectedFiles = { 'ui/widgets/foo/formWidget/public/favicon.ico', 'ui/widgets/foo/formWidget/public/index.html', 'ui/widgets/foo/formWidget/public/robots.txt', + 'ui/widgets/foo/formWidget/public/mfe-config.json', 'ui/widgets/foo/formWidget/scripts/i18next-scanner.config.js', 'ui/widgets/foo/formWidget/src/api/foos.js', 'ui/widgets/foo/formWidget/src/api/helpers.js', @@ -124,6 +126,7 @@ const expectedFiles = { 'ui/widgets/foo/tableWidget/public/favicon.ico', 'ui/widgets/foo/tableWidget/public/index.html', 'ui/widgets/foo/tableWidget/public/robots.txt', + 'ui/widgets/foo/tableWidget/public/mfe-config.json', 'ui/widgets/foo/tableWidget/scripts/i18next-scanner.config.js', 'ui/widgets/foo/tableWidget/src/api/foos.js', 'ui/widgets/foo/tableWidget/src/api/helpers.js', From 06a8982c92dc0f0f4b1f711743524d7f20be8c0b Mon Sep 17 00:00:00 2001 From: Anthony Viard Date: Fri, 23 Sep 2022 15:41:58 +0200 Subject: [PATCH 15/37] [ECS-463] Manage the MFE config in the FormWidget --- .../entity/formWidget/public/index.html.ejs | 13 +++++++++- .../components/EntityAddFormContainer.js.ejs | 11 +++++--- .../components/EntityEditFormContainer.js.ejs | 25 +++++++++++++++---- .../custom-elements/EntityFormElement.js.ejs | 8 +++--- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/public/index.html.ejs b/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/public/index.html.ejs index 2ee7f957..814bfa7f 100644 --- a/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/public/index.html.ejs +++ b/generators/entity-microfrontend/templates/ui/widgets/entity/formWidget/public/index.html.ejs @@ -59,7 +59,18 @@ - <<%= entityFileName %>-form service-url="%REACT_APP_SERVICE_URL%" id="1" /> + <<%= entityFileName %>-form /> +