Skip to content

Commit

Permalink
removing nodejs executable for mac and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-portmen committed Jan 15, 2025
1 parent e9424d3 commit 11baeec
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 23 deletions.
2 changes: 1 addition & 1 deletion host.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let files = [];
const sprocess = [];

const config = {
version: '0.9.7'
version: '0.9.8'
};
// closing node when parent process is killed
process.stdin.resume();
Expand Down
81 changes: 60 additions & 21 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,71 @@
#!/usr/bin/env bash

# Define Node.js version and base URL
NODE_VERSION="v18.20.5"
NODE_BASE_URL="https://nodejs.org/download/release/${NODE_VERSION}"
NODE_INSTALL_DIR="./node"

cd "$(dirname "$0")/app"

which node 2>/dev/null
isNode=$?
echo NodeJS status = $isNode
# Function to determine the appropriate Node.js binary
get_node_binary_url() {
OS_TYPE=$(uname | tr '[:upper:]' '[:lower:]')
MACHINE_TYPE=$(uname -m)

case "${OS_TYPE}" in
linux)
case "${MACHINE_TYPE}" in
x86_64) echo "${NODE_BASE_URL}/node-${NODE_VERSION}-linux-x64.tar.gz" ;;
*64)
# If the machine type ends with '64' and is not x86_64, assume it's ARM64
echo "${NODE_BASE_URL}/node-${NODE_VERSION}-linux-arm64.tar.gz" ;;
armv7l) echo "${NODE_BASE_URL}/node-${NODE_VERSION}-linux-armv7l.tar.gz" ;;
ppc64le) echo "${NODE_BASE_URL}/node-${NODE_VERSION}-linux-ppc64le.tar.gz" ;;
s390x) echo "${NODE_BASE_URL}/node-${NODE_VERSION}-linux-s390x.tar.gz" ;;
*) echo "Unsupported architecture: ${MACHINE_TYPE}" >&2; exit 1 ;;
esac
;;
darwin)
case "${MACHINE_TYPE}" in
x86_64) echo "${NODE_BASE_URL}/node-${NODE_VERSION}-darwin-x64.tar.gz" ;;
arm64) echo "${NODE_BASE_URL}/node-${NODE_VERSION}-darwin-arm64.tar.gz" ;;
*) echo "Unsupported architecture: ${MACHINE_TYPE}" >&2; exit 1 ;;
esac
;;
*)
echo "Unsupported OS: ${OS_TYPE}" >&2
exit 1
;;
esac
}

# Check if Node.js is globally installed
which node >/dev/null 2>&1
IS_NODE_GLOBAL=$?

if [ $isNode -eq 0 ]; then
if [ $IS_NODE_GLOBAL -eq 0 ]; then
node -e "process.exit(Number(process.version.substr(1).split('.')[0]) > 5 ? 0 : 1)"
isNode=$?
IS_NODE_GLOBAL=$?
fi
if [ $isNode -eq 0 ]; then

if [ $IS_NODE_GLOBAL -eq 0 ]; then
echo "Installer is using your system NodeJS."
echo
node install.js `which node` $1
node install.js "$(which node)" "$1"
else
MACHINE_TYPE=`uname -m`
echo "Installer is using the embedded NodeJS"
echo
if [[ $OSTYPE == 'darwin'* ]]; then
if [[ $MACHINE_TYPE == 'arm64' ]]; then
../node/arm64/node install.js --add_node $1
else
../node/x64/node install.js --add_node $1
fi
elif [ ${MACHINE_TYPE} == 'x86_64' ]; then
../node/x64/node install.js --add_node $1
else
../node/x86/node install.js --add_node $1
fi
echo "Node.js not found or version is less than 6. Downloading Node.js..."
mkdir -p "${NODE_INSTALL_DIR}"

NODE_URL=$(get_node_binary_url)
NODE_ARCHIVE="${NODE_INSTALL_DIR}/node.tar.gz"

echo "Downloading ${NODE_URL}..."
curl -o "${NODE_ARCHIVE}" "${NODE_URL}"

echo "Extracting Node.js..."
tar -xzf "${NODE_ARCHIVE}" -C "${NODE_INSTALL_DIR}" --strip-components=1
rm "${NODE_ARCHIVE}"

echo "Running installer with embedded Node.js..."
"${NODE_INSTALL_DIR}/bin/node" install.js --add_node "$1"
fi
Binary file removed linux/node/x64/node
Binary file not shown.
1 change: 0 additions & 1 deletion linux/node/x86/ReadMe

This file was deleted.

Binary file removed linux/node/x86/node
Binary file not shown.
Binary file removed mac/node/arm64/node
Binary file not shown.
Binary file removed mac/node/x64/node
Binary file not shown.

0 comments on commit 11baeec

Please sign in to comment.