From 79b3adeb84c6062f931035aefc6d3d30bf66d0bf Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Thu, 19 May 2022 19:41:00 -0400
Subject: [PATCH] ISTWCMS-5509: fixing patterns and css/js for different
 options

---
 build_ohana.sh | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/build_ohana.sh b/build_ohana.sh
index f5852cf9..a25c92b1 100755
--- a/build_ohana.sh
+++ b/build_ohana.sh
@@ -44,17 +44,17 @@ nvm install $version
 echo "**************************************************************************************"
 echo "Done installing correct npm version."
 
-echo "**************************************************************************************"
-echo "Setting up theming ..."
 if [[ $build_option == 1 || $build_option == 3 ]]; then
-  ln -s "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/ohana/dist "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/dist
-  rm -rf src/patterns
-  ln -s ../../src/patterns src/patterns
-else
-  mv "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/ohana/dist "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/
+  echo "**************************************************************************************"
+  echo "Setting up theming ..."
+  if [[ $build_option == 1 || $build_option == 3 ]]; then
+    ln -s "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/ohana/dist "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/dist
+    rm -rf src/patterns
+    ln -s ../../src/patterns src/patterns
+  fi
+  echo "**************************************************************************************"
+  echo "Done setting up theming."
 fi
-echo "**************************************************************************************"
-echo "Done setting up theming."
 
 echo "**************************************************************************************"
 echo "Running npm install ..."
@@ -71,6 +71,19 @@ npm run build
 echo "**************************************************************************************"
 echo "Done running npm run build."
 
+if [[ $build_option != 1 && $build_option != 3 ]]; then
+  echo "**************************************************************************************"
+  echo "Setting up css/js and removing ohana ..."
+  mv "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/ohana/dist "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/
+  cd "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/ohana/dist/css
+  ls | grep -v all.min.css | parallel rm
+  cd "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/ohana/dist/js
+  ls | grep -v all.min.js | parallel rm
+  cd "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/ohana
+  echo "**************************************************************************************"
+  echo "Done setting up css/js and removing ohana."
+fi
+
 if [[ $env_option == 1 ]]; then
   echo "**************************************************************************************"
   echo "Creating symlink for ohana ..."
-- 
GitLab