From 3cc3acfd91c7da1c79487e3ad4a004f111ebfa2e Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Sun, 3 Dec 2023 12:23:47 +1100 Subject: [PATCH] update scripts to auto check for pnpm and npm --- scripts/build.bat | 24 +++++++++++++++++++----- scripts/build.sh | 22 +++++++++++++++++----- scripts/dev.bat | 24 +++++++++++++++++++----- scripts/dev.sh | 22 +++++++++++++++++----- scripts/install.bat | 0 scripts/install.sh | 0 6 files changed, 72 insertions(+), 20 deletions(-) mode change 100644 => 100755 scripts/build.bat mode change 100644 => 100755 scripts/build.sh mode change 100644 => 100755 scripts/dev.bat mode change 100644 => 100755 scripts/dev.sh mode change 100644 => 100755 scripts/install.bat mode change 100644 => 100755 scripts/install.sh diff --git a/scripts/build.bat b/scripts/build.bat old mode 100644 new mode 100755 index 977bc4cb..1276a916 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -1,10 +1,24 @@ @echo off + REM Running install script call install.bat -REM Building projects cd .. -cd interface -npm run build -cd .. -npm run build \ No newline at end of file + +REM Try to get the version of pnpm +pnpm --version > NUL 2>&1 + +REM Check the exit status of the previous command +IF %ERRORLEVEL% EQU 0 ( + REM Running pnpm run build in both directories + cd ./interface + pnpm run build + cd .. + pnpm run build +) ELSE ( + REM Running npm run build in both directories + cd ./interface + npm run build + cd .. + npm run build +) diff --git a/scripts/build.sh b/scripts/build.sh old mode 100644 new mode 100755 index ab5d97aa..470a7e9a --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,8 +5,20 @@ cd .. -# Building projects -cd ./interface -npm run build -cd .. -npm run build \ No newline at end of file +# Try to get the version of pnpm +pnpm --version > /dev/null 2>&1 + +# Check the exit status of the previous command +if [ $? -eq 0 ]; then + # Running npm run dev in both directories + cd ./interface + pnpm run build + cd .. + pnpm run build +else + # Running npm run dev in both directories + cd ./interface + npm run build + cd .. + npm run build +fi \ No newline at end of file diff --git a/scripts/dev.bat b/scripts/dev.bat old mode 100644 new mode 100755 index 73040d8f..7964eacc --- a/scripts/dev.bat +++ b/scripts/dev.bat @@ -1,7 +1,21 @@ @echo off -REM Running npm run dev in both directories + cd .. -cd interface -START cmd /k "npm run dev" -cd .. -npm run dev \ No newline at end of file + +REM Try to get the version of pnpm +pnpm --version >nul 2>&1 + +REM Check the exit status of the previous command +if %ERRORLEVEL% == 0 ( + REM Running pnpm run dev in both directories + cd interface + start /b pnpm run dev + cd .. + pnpm run dev +) else ( + REM Running npm run dev in both directories + cd interface + start /b npm run dev + cd .. + npm run dev +) diff --git a/scripts/dev.sh b/scripts/dev.sh old mode 100644 new mode 100755 index 86240dd4..5307018a --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -2,8 +2,20 @@ cd .. -# Running npm run dev in both directories -cd ./interface -npm run dev & -cd .. -npm run dev \ No newline at end of file +# Try to get the version of pnpm +pnpm --version > /dev/null 2>&1 + +# Check the exit status of the previous command +if [ $? -eq 0 ]; then + # Running npm run dev in both directories + cd ./interface + pnpm run dev & + cd .. + pnpm run dev +else + # Running npm run dev in both directories + cd ./interface + npm run dev & + cd .. + npm run dev +fi \ No newline at end of file diff --git a/scripts/install.bat b/scripts/install.bat old mode 100644 new mode 100755 diff --git a/scripts/install.sh b/scripts/install.sh old mode 100644 new mode 100755