Files
DailyMeals/scripts/npm
2026-06-04 06:24:56 +02:00

24 lines
553 B
Bash
Executable File

#!/usr/bin/env bash
# npm wrapper that uses the project-local Node toolchain.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
VERSION="22.22.0"
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$ARCH" in
arm64|aarch64) ARCH="arm64" ;;
x86_64|amd64) ARCH="x64" ;;
esac
DIR_NAME="node-v${VERSION}-${OS}-${ARCH}"
NPM="$ROOT/.toolchain/$DIR_NAME/bin/npm"
if [[ ! -x "$NPM" ]]; then
echo "Node toolchain not found. Run from DailyMeals root:" >&2
echo " ./scripts/install-node.sh" >&2
exit 1
fi
exec "$NPM" "$@"