From 103b179b9d1e133aa23d2f91fd45b8828542c83f Mon Sep 17 00:00:00 2001 From: PatrickAlphac <54278053+PatrickAlphaC@users.noreply.github.com> Date: Tue, 19 Mar 2024 09:04:47 -0400 Subject: [PATCH] updated script for people who dont have npm or yarn installed --- scripts/binary_check.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/binary_check.sh b/scripts/binary_check.sh index 725a058..07fde0e 100755 --- a/scripts/binary_check.sh +++ b/scripts/binary_check.sh @@ -1,11 +1,22 @@ #! /bin/bash -if ! [[ "$(npm list -g huffc)" =~ "empty" ]]; then - # huffc was installed via npm, return 0x00 - echo -n 0x00 -elif [[ "$(yarn global list)" =~ "huffc" ]]; then - # huffc was installed via yarn, return 0x00 - echo -n 0x00 -else - echo -n 0x01 +# Check if npm is installed +if command -v npm &> /dev/null; then + if ! [[ "$(npm list -g huffc)" =~ "empty" ]]; then + # huffc was installed via npm, return 0x00 + echo -n 0x00 + exit 0 + fi fi + +# Check if yarn is installed +if command -v yarn &> /dev/null; then + if [[ "$(yarn global list)" =~ "huffc" ]]; then + # huffc was installed via yarn, return 0x00 + echo -n 0x00 + exit 0 + fi +fi + +# Else, return 0x01 +echo -n 0x01