From 79f1c20f8ab741a19e303770ee361f720ab0a96c Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Sun, 6 Oct 2024 17:24:53 +0800 Subject: [PATCH] Added custom build.sh --- src/static/app/build.sh | 32 ++++++++++++++++++++++++++++++++ src/static/app/package.json | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 src/static/app/build.sh diff --git a/src/static/app/build.sh b/src/static/app/build.sh new file mode 100755 index 0000000..171b801 --- /dev/null +++ b/src/static/app/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Step 1: Run vite build +echo "Running vite build..." +if vite build; then + echo "Vite build successful." +else + echo "Vite build failed. Exiting." + exit 1 +fi + +# Step 2: Check for changes and commit +echo "Checking for changes to commit..." +if git diff-index --quiet HEAD --; then + echo "No changes to commit. Skipping commit." +else + if git commit -a; then + echo "Git commit successful." + else + echo "Git commit failed. Exiting." + exit 1 + fi +fi + +# Step 3: Push changes to remote +echo "Pushing changes to remote..." +if git push; then + echo "Git push successful." +else + echo "Git push failed. Exiting." + exit 1 +fi diff --git a/src/static/app/package.json b/src/static/app/package.json index 1995703..b5e3c4c 100644 --- a/src/static/app/package.json +++ b/src/static/app/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build && git commit -a && git push", + "build": "./build.sh", "build electron": "vite build && vite build --mode electron && cd ../../../../WGDashboard-Desktop && electron-builder --mac --win", "preview": "vite preview" },