From 9ea49be22992a2e78d3ccc2ed7f4608af1888509 Mon Sep 17 00:00:00 2001 From: axolotle Date: Fri, 9 Dec 2022 09:23:28 +0100 Subject: [PATCH] [vite] replace node/npm with v14 to support modern syntax --- ynh-dev | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/ynh-dev b/ynh-dev index dc2550c..cf0a1b4 100755 --- a/ynh-dev +++ b/ynh-dev @@ -19,7 +19,7 @@ function show_usage() { test [PKG] Deploy, update and run tests for some packages Tests for single modules and functions can ran with e.g. ./ynh-dev test yunohost/appurl:urlavailable - catalog + catalog build Rebuild the custom catalog add Add the custom catalog in Yunohost catalog list override Override default catalog with the custom catalog @@ -329,22 +329,15 @@ with open(setting_file) as f: EOF fi - # Install npm if needed - if [[ ! -e "/var/cache/ynh-dev/yunohost-admin/node_modules/vue" ]] + # Vite require node v14 to parse modern syntax + if [[ ! $(node -v) == v14* ]] then - info "Installing dependencies to develop in yunohost-admin ..." - DISTRO="$(lsb_release -s -c)" - if [ "$DISTRO" == "buster" ]; then - KEYRING=/usr/share/keyrings/nodesource.gpg - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null - gpg --no-default-keyring --keyring "$KEYRING" --list-keys - VERSION=node_8.x - KEYRING=/usr/share/keyrings/nodesource.gpg - echo "deb [signed-by=$KEYRING] https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list - fi - apt-get update - apt install nodejs npm -y - npm install -g npm@6 + info "Installing node v14..." + curl -fsSL https://deb.nodesource.com/setup_14.x | bash - + apt install nodejs + apt autoremove + # to return to nodejs debian version + # apt purge nodejs && rm -r /etc/apt/sources.list.d/nodesource.list && apt install nodejs fi # Install dependencies with npm install (or rather npm ci)