Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash

DIR=$(dirname "$0")

cd "$SDIR" || exit

pause() {
read -p "Press any key to exit . . ."
exit
Expand All @@ -12,16 +17,21 @@ if ! [ -d "node_modules" ]; then
fi
fi

if ! [ -e "node" ]; then
echo "Detected local Node.js executable, attempting to use it..."
node src/app.js
if ! command -v node &> /dev/null; then
echo "Node.js is not installed. Please install Node.js to run this script."
pause
else
echo "Did not detect local Node.js executable, attempting to use `npm`..."
npm start
if [ -x "node" ]; then
echo "Detected local Node.js executable, attempting to use it..."
./node src/app.js
else
echo "Did not detect local Node.js executable, attempting to use `npm`..."
npm start
fi
fi

if [ $? -ne 0 ]; then
if [ "$1" -eq "--keep-on-error" ]; then
if [ "$1" = "--keep-on-error" ]; then
pause
fi
fi