From 5225c960b0a89e90260874b058f8860418187018 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Wed, 6 Nov 2024 00:20:25 +0700 Subject: [PATCH] feat: ensure nvm with node version for fe --- .env.example | 2 ++ setup/functions.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/.env.example b/.env.example index d201dfe..40535db 100644 --- a/.env.example +++ b/.env.example @@ -13,4 +13,6 @@ INSTALLER=yarn # E.g: prod, dev ENV=prod +NODE_VERSION=22 + USE_SUBMODULES=false diff --git a/setup/functions.sh b/setup/functions.sh index d957dba..c92b886 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -14,6 +14,13 @@ build_fe() { home_resource_env + if ! command -v nvm &> /dev/null; then + # shellcheck disable=SC2155 + export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + fi + nvm use "$NODE_VERSION" + if ! command -v yarn &> /dev/null; then echo ' ∟ Installing yarn...' npm install -g yarn