Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
fix: updated script for people who dont have npm or yarn installed (#60)
Browse files Browse the repository at this point in the history
* updated script for people who dont have npm or yarn installed

* fix: also npm / yarn pipe stderr to null

---------

Co-authored-by: Maddiaa0 <[email protected]>
  • Loading branch information
PatrickAlphaC and Maddiaa0 authored Mar 20, 2024
1 parent c4ba155 commit 7d1ce15
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions scripts/binary_check.sh
Original file line number Diff line number Diff line change
@@ -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 2> /dev/null)" =~ "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 2> /dev/null)" =~ "huffc" ]]; then
# huffc was installed via yarn, return 0x00
echo -n 0x00
exit 0
fi
fi

# Else, return 0x01
echo -n 0x01

0 comments on commit 7d1ce15

Please sign in to comment.