From 393a279f1ac8495938b88dd9d1c135b8a758075c Mon Sep 17 00:00:00 2001 From: piumal1999 Date: Mon, 15 Jul 2024 23:33:36 +0530 Subject: [PATCH 1/3] (fix) O3-3607: Correct the e2e support script --- e2e/support/github/run-e2e-docker-env.sh | 40 +++++++++--------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/e2e/support/github/run-e2e-docker-env.sh b/e2e/support/github/run-e2e-docker-env.sh index 8ea68c5..a62aaf8 100644 --- a/e2e/support/github/run-e2e-docker-env.sh +++ b/e2e/support/github/run-e2e-docker-env.sh @@ -4,38 +4,26 @@ script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # create a temporary working directory working_dir=$(mktemp -d "${TMPDIR:-/tmp/}openmrs-e2e-frontends.XXXXXXXXXX") -# get a list of all the apps in this workspace -apps=$(yarn workspaces list --json | jq -r 'if ((.location == ".") or (.location | test("form-engine-app")) or (.location | test("-app") | not)) then halt else .name end') -# this array will hold all of the packed app names -app_names=() +# get the app name +app_name=$(jq -r '.name' "$script_dir/../../../package.json") -echo "Creating packed archives of apps..." -# for each app -for app in $apps -do - # @openmrs/esm-whatever -> _openmrs_esm_whatever - app_name=$(echo "$app" | tr '[:punct:]' '_'); - # add to our array - app_names+=("$app_name.tgz"); - # run yarn pack for our app and add it to the working directory - yarn workspace "$app" pack -o "$working_dir/$app_name.tgz" >/dev/null; -done; -echo "Created packed app archives" +echo "Creating packed archive of the app..." +# @openmrs/esm-whatever -> _openmrs_esm_whatever +packed_app_name=$(echo "$app_name" | tr '[:punct:]' '_'); +# run yarn pack for our app and add it to the working directory +yarn pack -o "$working_dir/$packed_app_name.tgz" >/dev/null; +echo "Created packed app archives" echo "Creating dynamic spa-assemble-config.json..." # dynamically assemble our list of frontend modules, prepending the login app and # primary navigation apps; apps will all be in the /app directory of the Docker # container jq -n \ - --arg apps "$apps" \ - --arg app_names "$(echo ${app_names[@]})" \ - '{"@openmrs/esm-primary-navigation-app": "next", "@openmrs/esm-home-app": "next"} + ( - ($apps | split("\n")) as $apps | ($app_names | split(" ") | map("/app/" + .)) as $app_files - | [$apps, $app_files] - | transpose - | map({"key": .[0], "value": .[1]}) - | from_entries - )' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json" + --arg app_name "$app_name" \ + --arg app_file "/app/$packed_app_name.tgz" \ + '{"@openmrs/esm-primary-navigation-app": "next"} + { + ($app_name): $app_file + }' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json" echo "Created dynamic spa-assemble-config.json" echo "Copying Docker configuration..." @@ -46,4 +34,4 @@ cd $working_dir echo "Starting Docker containers..." # CACHE_BUST to ensure the assemble step is always run docker compose build --build-arg CACHE_BUST=$(date +%s) frontend -docker compose up -d +docker compose up -d \ No newline at end of file From 62841635f6c87e3e14fe335e597d99ab556ffad9 Mon Sep 17 00:00:00 2001 From: piumal1999 Date: Mon, 15 Jul 2024 23:43:01 +0530 Subject: [PATCH 2/3] Add EOF --- e2e/support/github/run-e2e-docker-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/support/github/run-e2e-docker-env.sh b/e2e/support/github/run-e2e-docker-env.sh index a62aaf8..7d3760d 100644 --- a/e2e/support/github/run-e2e-docker-env.sh +++ b/e2e/support/github/run-e2e-docker-env.sh @@ -34,4 +34,4 @@ cd $working_dir echo "Starting Docker containers..." # CACHE_BUST to ensure the assemble step is always run docker compose build --build-arg CACHE_BUST=$(date +%s) frontend -docker compose up -d \ No newline at end of file +docker compose up -d From 7f6e92eccf322339ae15412efd0d15c8183ba3b8 Mon Sep 17 00:00:00 2001 From: piumal1999 Date: Tue, 16 Jul 2024 00:11:54 +0530 Subject: [PATCH 3/3] Add esm-home-app to the list of modules --- e2e/support/github/run-e2e-docker-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/support/github/run-e2e-docker-env.sh b/e2e/support/github/run-e2e-docker-env.sh index 7d3760d..2fb8464 100644 --- a/e2e/support/github/run-e2e-docker-env.sh +++ b/e2e/support/github/run-e2e-docker-env.sh @@ -21,7 +21,7 @@ echo "Creating dynamic spa-assemble-config.json..." jq -n \ --arg app_name "$app_name" \ --arg app_file "/app/$packed_app_name.tgz" \ - '{"@openmrs/esm-primary-navigation-app": "next"} + { + '{"@openmrs/esm-primary-navigation-app": "next", "@openmrs/esm-home-app": "next"} + { ($app_name): $app_file }' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json" echo "Created dynamic spa-assemble-config.json"