[vite] replace node/npm with v14 to support modern syntax

This commit is contained in:
axolotle 2022-12-09 09:23:28 +01:00
parent bbb20ce6cc
commit 9ea49be229

25
ynh-dev
View file

@ -19,7 +19,7 @@ function show_usage() {
test [PKG] Deploy, update and run tests for some packages test [PKG] Deploy, update and run tests for some packages
Tests for single modules and functions can ran with Tests for single modules and functions can ran with
e.g. ./ynh-dev test yunohost/appurl:urlavailable e.g. ./ynh-dev test yunohost/appurl:urlavailable
catalog catalog
build Rebuild the custom catalog build Rebuild the custom catalog
add Add the custom catalog in Yunohost catalog list add Add the custom catalog in Yunohost catalog list
override Override default catalog with the custom catalog override Override default catalog with the custom catalog
@ -329,22 +329,15 @@ with open(setting_file) as f:
EOF EOF
fi fi
# Install npm if needed # Vite require node v14 to parse modern syntax
if [[ ! -e "/var/cache/ynh-dev/yunohost-admin/node_modules/vue" ]] if [[ ! $(node -v) == v14* ]]
then then
info "Installing dependencies to develop in yunohost-admin ..." info "Installing node v14..."
DISTRO="$(lsb_release -s -c)" curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
if [ "$DISTRO" == "buster" ]; then apt install nodejs
KEYRING=/usr/share/keyrings/nodesource.gpg apt autoremove
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee "$KEYRING" >/dev/null # to return to nodejs debian version
gpg --no-default-keyring --keyring "$KEYRING" --list-keys # apt purge nodejs && rm -r /etc/apt/sources.list.d/nodesource.list && apt install nodejs
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
fi fi
# Install dependencies with npm install (or rather npm ci) # Install dependencies with npm install (or rather npm ci)