Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install npm binary from npm package #756

Merged
merged 1 commit into from
Feb 21, 2025
Merged
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
25 changes: 1 addition & 24 deletions scripts/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install() {
cc) set build-essential ;;
curl) set curl ;;
mdl) set markdownlint ;;
npm) _system_nodejs_setup ; set nodejs ;;
npm) set npm ;;
pkg-config) set pkgconf ;;
socat) set socat ;;
usbip)
Expand All @@ -61,27 +61,4 @@ install() {
fi
}

# AssemblyScript needs Node 16 or later.
_SYSTEM_NODEJS_MIN_VERSION=16
_system_nodejs_setup() {
[ "$(_system_nodejs_version)" -ge $_SYSTEM_NODEJS_MIN_VERSION ] && return
# See https://github.com/nodesource/distributions#installation-instructions
ensure apt ca-certificates
ensure apt curl
ensure apt gnupg
( set -x
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] \
https://deb.nodesource.com/node_$_SYSTEM_NODEJS_MIN_VERSION.x nodistro main" \
| sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
)
}

_system_nodejs_version() {
apt-cache show nodejs | sed -n 's/^Version: \([0-9]\+\)\..*$/\1/p;T;q'
}

_system_dist_id() { lsb_release -is; }