From b745bc1a666d0333f139d68adbffa9751f797c06 Mon Sep 17 00:00:00 2001
From: "Wortman, Elliot (UG - Comp Sci & Elec Eng)" <ew00710@surrey.ac.uk>
Date: Sun, 26 Nov 2023 17:02:07 +0000
Subject: [PATCH] Bash script to create a demo zip

---
 .gitignore |  3 ++-
 deploy.sh  | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100755 deploy.sh

diff --git a/.gitignore b/.gitignore
index 131840b..4356310 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,5 @@ coverage
 *.sw?
 
 __pycache__/
-env/
\ No newline at end of file
+env/
+archive.zip
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..baa69e9
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,48 @@
+#!/bin/bash -ex
+
+# Check if npm is installed
+if ! hash npm 2>/dev/null; then
+    echo "Error: npm is not installed."
+    exit 1
+fi
+
+# Check if zip is installed
+if ! hash zip 2>/dev/null; then
+    echo "Error: zip is not installed."
+    exit 1
+fi
+
+# Remove 'dist' and 'node_modules' directories if they exist
+echo "Cleaning up old 'dist' and 'node_modules' directories..."
+rm -rf dist node_modules
+
+# Run npm install
+echo "Running npm install..."
+npm ci
+
+# Run npm build
+echo "Running npm run build..."
+npm run build
+
+# Check if the build was successful and 'dist' directory exists
+if [ ! -d "dist" ]; then
+    echo "Error: 'dist' directory not found. Build may have failed."
+    exit 1
+fi
+
+# Check if 'requirements.txt' exists
+if [ ! -f "requirements.txt" ]; then
+    echo "Error: 'requirements.txt' file not found."
+    exit 1
+fi
+
+# Check if 'app.py' exists
+if [ ! -f "app.py" ]; then
+    echo "Error: 'app.py' file not found."
+    exit 1
+fi
+
+# Create a zip file
+zip -r archive.zip requirements.txt app.py dist
+
+echo "Archive 'archive.zip' created successfully."
-- 
GitLab