[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

23
ynh-dev
View file

@ -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)