From 51c729eafc3b290a5daddf7f0ccffd0a2a9fe2aa Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Thu, 1 Feb 2024 09:04:58 -0800 Subject: [PATCH] refactor(angular, react, vue): add missing test app msg (#28951) Issue number: N/A --------- ## What is the current behavior? The packages, Angular, React, and Vue, will accept any `app_dir` parameter when passing it to the build script. This can lead to a user to entering a directory that doesn't exist within `test/apps`. If this happens, then the build folder will include an incomplete test app. For example: 1. `./build ng13` 2. This creates a `build/ng13` folder, but the folder only contains the contents from the `base` folder. This causes it to be incomplete. ## What is the new behavior? - Provides a message that the provided app directory doesn't exist. - Does not create the incomplete app when an invalid app directory is given. ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information N/A --- packages/angular/test/build.sh | 6 ++++++ packages/react/test/build.sh | 6 ++++++ packages/vue/test/build.sh | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/packages/angular/test/build.sh b/packages/angular/test/build.sh index d91b9cb177..f597a55f9e 100755 --- a/packages/angular/test/build.sh +++ b/packages/angular/test/build.sh @@ -22,6 +22,12 @@ FULL_BASE_DIR="${BASE_DIR}/." # The full path to the built application. BUILD_APP_DIR="${BUILD_DIR}/${APP_DIR}/" +# Make sure the full app directory exists. +if [ ! -d $FULL_APP_DIR ]; then + echo "Could not find test app: ${FULL_APP_DIR}" + exit 1 +fi + # Make the build directory if it does not already exist. mkdir -p $BUILD_DIR diff --git a/packages/react/test/build.sh b/packages/react/test/build.sh index a646dc74ba..51467aee36 100755 --- a/packages/react/test/build.sh +++ b/packages/react/test/build.sh @@ -22,6 +22,12 @@ FULL_BASE_DIR="${BASE_DIR}/." # The full path to the built application. BUILD_APP_DIR="${BUILD_DIR}/${APP_DIR}/" +# Make sure the full app directory exists. +if [ ! -d $FULL_APP_DIR ]; then + echo "Could not find test app: ${FULL_APP_DIR}" + exit 1 +fi + # Make the build directory if it does not already exist. mkdir -p $BUILD_DIR diff --git a/packages/vue/test/build.sh b/packages/vue/test/build.sh index a646dc74ba..51467aee36 100755 --- a/packages/vue/test/build.sh +++ b/packages/vue/test/build.sh @@ -22,6 +22,12 @@ FULL_BASE_DIR="${BASE_DIR}/." # The full path to the built application. BUILD_APP_DIR="${BUILD_DIR}/${APP_DIR}/" +# Make sure the full app directory exists. +if [ ! -d $FULL_APP_DIR ]; then + echo "Could not find test app: ${FULL_APP_DIR}" + exit 1 +fi + # Make the build directory if it does not already exist. mkdir -p $BUILD_DIR