From e14323b3c28a73d5364fdaf0fc2bc02465dd0818 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Mon, 18 Oct 2021 18:41:39 +0000
Subject: [PATCH] Fix rebuild script, build option 2

---
 build_gesso.sh | 112 +++++++++++++++++++++++++++----------------------
 gulpfile.js    |   7 ++++
 2 files changed, 70 insertions(+), 49 deletions(-)

diff --git a/build_gesso.sh b/build_gesso.sh
index 08d90948..887cee5c 100755
--- a/build_gesso.sh
+++ b/build_gesso.sh
@@ -31,65 +31,66 @@ if [ "$?" != 0 ]; then
   exit 2;
 fi
 
-if [[ $build_option == 1 || $build_option == 3 ]]; then
 
-  if [ -f "gulpfile.js" ]; then
-    cp gulpfile.js gesso
-  fi
 
-  if [ -f "package.json" ]; then
-    cp package.json gesso
-  fi
+if [ -f "gulpfile.js" ]; then
+  cp gulpfile.js gesso
+fi
 
-  echo "**************************************************************************************"
-  echo "Removing Gesso files ..."
-  rm gesso/gesso.layouts.yml
-  rm gesso/gesso.info.yml
-  rm gesso/gesso.libraries.yml
-  rm gesso/gesso.breakpoints.yml
-  rm gesso/Dockerfile
-  rm gesso/screenshot.png
-  rm -rf gesso/templates
-  echo "Done removing gesso theme files."
-  echo "**************************************************************************************"
-  echo ""
+if [ -f "package.json" ]; then
+  cp package.json gesso
+fi
 
-  echo "**************************************************************************************"
-  echo "Running npm install ..."
-  cd gesso
-  npm install
-  if [ "$?" != 0 ]; then
-    echo "Error: npm install failed"
-    exit 2;
-  fi
-  echo "Done npm install."
-  echo "**************************************************************************************"
-  echo ""
+echo "**************************************************************************************"
+echo "Removing Gesso files ..."
+rm gesso/gesso.layouts.yml
+rm gesso/gesso.info.yml
+rm gesso/gesso.libraries.yml
+rm gesso/gesso.breakpoints.yml
+rm gesso/Dockerfile
+rm gesso/screenshot.png
+rm -rf gesso/templates
+echo "Done removing gesso theme files."
+echo "**************************************************************************************"
+echo ""
 
-  echo "**************************************************************************************"
-  echo "Symbolic linking source directory"
-  if [ -d "source" ]; then
-    echo ""
-    echo "**************************************************************************************"
-    echo "Removing old source directory ..."
-    rm -rf source
-    echo "Done removing old source directory."
-    echo "**************************************************************************************"
-    echo ""
-  fi
-  ln -fs "../source" source
-  echo "Done symbolic linking source directory."
-  echo "**************************************************************************************"
-  echo ""
+echo "**************************************************************************************"
+echo "Running npm install ..."
+cd gesso
+npm install
+if [ "$?" != 0 ]; then
+  echo "Error: npm install failed"
+  exit 2;
+fi
+echo "Done npm install."
+echo "**************************************************************************************"
+echo ""
 
+echo "**************************************************************************************"
+echo "Symbolic linking source directory"
+if [ -d "source" ]; then
+  echo ""
   echo "**************************************************************************************"
-  echo "Removing style lint config and replacing with UW config ..."
-  rm .stylelintrc.yml
-  cp ../.stylelintrc.yml .
-  echo "Done removing style lint config and replacing with UW config."
+  echo "Removing old source directory ..."
+  rm -rf source
+  echo "Done removing old source directory."
   echo "**************************************************************************************"
   echo ""
+fi
+ln -fs "../source" source
+echo "Done symbolic linking source directory."
+echo "**************************************************************************************"
+echo ""
+
+echo "**************************************************************************************"
+echo "Removing style lint config and replacing with UW config ..."
+rm .stylelintrc.yml
+cp ../.stylelintrc.yml .
+echo "Done removing style lint config and replacing with UW config."
+echo "**************************************************************************************"
+echo ""
 
+if [[ $build_option == 1 || $build_option == 3 ]]; then
   echo "**************************************************************************************"
   echo "Running gulp build ..."
   gulp build
@@ -119,6 +120,19 @@ if [[ $build_option == 1 || $build_option == 3 ]]; then
   echo ""
 
 else
+
+  echo "**************************************************************************************"
+  echo "Compiling CSS and JS ..."
+  gulp buildStyles
+  gulp buildScripts
+  cd ..
+  rm css/styles.css
+  rm css/pattern-lab.css
+  rm css/uw-dashboards.css
+  echo "Done compiling CSS and JS"
+  echo "**************************************************************************************"
+  echo ""
+
   echo "**************************************************************************************"
   echo "Setting up gesso helper ..."
   mv gesso/gesso_helper .
diff --git a/gulpfile.js b/gulpfile.js
index 22586269..2cb29492 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -246,6 +246,13 @@ const build = (isProduction = true ) => {
     parallel(task('bundleScripts'), buildStyles, buildComponentScripts, buildPLStyle, buildPatternLab));
 }
 
+const buildCSSJS = (isProduction = true ) => {
+  return series(
+    parallel(buildStyles, buildComponentScripts));
+}
+
 exports.build = build(true);
 
+exports.buildCSSJS = build(true);
+
 exports.default = series(build(false), watchFiles);
-- 
GitLab