v1.1.1: 升级到 Node.js 20.x LTS

主要更新:
- 升级默认Node.js版本从18.x到20.x (LTS长期支持)
- 解决 NodeSource 弃用警告问题
- 更新所有Node.js版本检查逻辑使用变量而非硬编码
- 提高代码可维护性和未来兼容性

技术改进:
- NODE_VERSION: 18 → 20
- install_nodejs_apt/yum/dnf/zypper: 使用 $NODE_VERSION 变量检查
- 确保更长的官方支持周期(至2026年4月)

支持周期:
- Node.js 18.x: 支持到 2025-04-30
- Node.js 20.x: 支持到 2026-04-30 
This commit is contained in:
WanWanYun
2025-11-10 23:29:43 +08:00
parent 47f04f4cb9
commit 1eb619a0b6

View File

@@ -3,7 +3,7 @@
################################################################################ ################################################################################
# 玩玩云 (WanWanYun) - 一键部署脚本 # 玩玩云 (WanWanYun) - 一键部署脚本
# 项目地址: https://gitee.com/yu-yon/vue-driven-cloud-storage # 项目地址: https://gitee.com/yu-yon/vue-driven-cloud-storage
# 版本: v1.1.0 # 版本: v1.1.1
################################################################################ ################################################################################
set -e set -e
@@ -23,7 +23,7 @@ NC='\033[0m' # No Color
PROJECT_NAME="wanwanyun" PROJECT_NAME="wanwanyun"
PROJECT_DIR="/var/www/${PROJECT_NAME}" PROJECT_DIR="/var/www/${PROJECT_NAME}"
REPO_URL="https://gitee.com/yu-yon/vue-driven-cloud-storage.git" REPO_URL="https://gitee.com/yu-yon/vue-driven-cloud-storage.git"
NODE_VERSION="18" NODE_VERSION="20"
ADMIN_USERNAME="" ADMIN_USERNAME=""
ADMIN_PASSWORD="" ADMIN_PASSWORD=""
DOMAIN="" DOMAIN=""
@@ -410,7 +410,7 @@ install_dependencies() {
install_nodejs_apt() { install_nodejs_apt() {
if command -v node &> /dev/null; then if command -v node &> /dev/null; then
NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [[ $NODE_VER -ge 18 ]]; then if [[ $NODE_VER -ge $NODE_VERSION ]]; then
print_success "Node.js 已安装: $(node -v)" print_success "Node.js 已安装: $(node -v)"
return return
fi fi
@@ -425,7 +425,7 @@ install_nodejs_apt() {
install_nodejs_yum() { install_nodejs_yum() {
if command -v node &> /dev/null; then if command -v node &> /dev/null; then
NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [[ $NODE_VER -ge 18 ]]; then if [[ $NODE_VER -ge $NODE_VERSION ]]; then
print_success "Node.js 已安装: $(node -v)" print_success "Node.js 已安装: $(node -v)"
return return
fi fi
@@ -464,7 +464,7 @@ install_nginx_yum() {
install_nodejs_dnf() { install_nodejs_dnf() {
if command -v node &> /dev/null; then if command -v node &> /dev/null; then
NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [[ $NODE_VER -ge 18 ]]; then if [[ $NODE_VER -ge $NODE_VERSION ]]; then
print_success "Node.js 已安装: $(node -v)" print_success "Node.js 已安装: $(node -v)"
return return
fi fi
@@ -491,7 +491,7 @@ install_nginx_dnf() {
install_nodejs_zypper() { install_nodejs_zypper() {
if command -v node &> /dev/null; then if command -v node &> /dev/null; then
NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) NODE_VER=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [[ $NODE_VER -ge 18 ]]; then if [[ $NODE_VER -ge $NODE_VERSION ]]; then
print_success "Node.js 已安装: $(node -v)" print_success "Node.js 已安装: $(node -v)"
return return
fi fi