From ae8d1f2b70bcca317c9000e651d3cdd1c7a6b8f2 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 5 May 2025 18:43:03 +0200 Subject: [PATCH] fix scoped npm modules this fix tried so fix the npm function if using scoped modules like @vue/cli-services@latest --- misc/tools.func | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/misc/tools.func b/misc/tools.func index 7ad1c02..c0b8ded 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -55,10 +55,16 @@ install_node_and_modules() { IFS=',' read -ra MODULES <<<"$NODE_MODULE" for mod in "${MODULES[@]}"; do local MODULE_NAME MODULE_REQ_VERSION MODULE_INSTALLED_VERSION - if [[ "$mod" == *"@"* ]]; then + if [[ "$mod" == @*/*@* ]]; then + # Scoped package with version, e.g. @vue/cli-service@latest MODULE_NAME="${mod%@*}" - MODULE_REQ_VERSION="${mod#*@}" + MODULE_REQ_VERSION="${mod##*@}" + elif [[ "$mod" == *"@"* ]]; then + # Unscoped package with version, e.g. yarn@latest + MODULE_NAME="${mod%@*}" + MODULE_REQ_VERSION="${mod##*@}" else + # No version specified MODULE_NAME="$mod" MODULE_REQ_VERSION="latest" fi