更新 java-mall-app-shop-admin/Jenkinsfile
This commit is contained in:
parent
3d1e9df1b9
commit
755e9ee4de
38
java-mall-app-shop-admin/Jenkinsfile
vendored
38
java-mall-app-shop-admin/Jenkinsfile
vendored
@ -2,14 +2,14 @@ pipeline {
|
|||||||
agent any
|
agent any
|
||||||
|
|
||||||
tools {
|
tools {
|
||||||
nodejs 'NodeJS18' // 使用NodeJS18版本
|
nodejs 'NodeJS18'
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
UNIAPP_DIR = 'java-mall-app-shop-admin'
|
UNIAPP_DIR = 'java-mall-app-shop-admin'
|
||||||
TARGET_PLATFORM = 'h5'
|
TARGET_PLATFORM = 'h5'
|
||||||
OUTPUT_DIR = "${UNIAPP_DIR}/dist/build/${TARGET_PLATFORM}"
|
OUTPUT_DIR = "${UNIAPP_DIR}/dist/build/${TARGET_PLATFORM}"
|
||||||
DEPLOY_PATH = '/data/nginx/www/demo'
|
DEPLOY_PATH = '/data/nginx/www/uniapp-h5'
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
@ -19,7 +19,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('安装完整依赖(含UniApp插件)') {
|
stage('彻底清理并安装完整依赖') {
|
||||||
steps {
|
steps {
|
||||||
sh """
|
sh """
|
||||||
cd ${UNIAPP_DIR} || {
|
cd ${UNIAPP_DIR} || {
|
||||||
@ -27,20 +27,31 @@ pipeline {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# 清理旧依赖
|
# 彻底清理旧依赖和缓存
|
||||||
rm -rf node_modules package-lock.json
|
rm -rf node_modules package-lock.json
|
||||||
|
npm cache clean --force # 清理npm缓存,解决依赖下载不完整问题
|
||||||
|
|
||||||
# 设置镜像源
|
# 设置镜像源(确保国内访问稳定)
|
||||||
npm config set registry https://registry.npmmirror.com
|
npm config set registry https://registry.npmmirror.com
|
||||||
|
# 额外配置@dcloudio私有源(关键:解决uni系列包下载问题)
|
||||||
|
npm config set @dcloudio:registry https://registry.npmmirror.com
|
||||||
|
|
||||||
# 安装项目基础依赖
|
# 安装核心依赖(指定稳定版本,避免latest版本兼容性问题)
|
||||||
|
npm install @vue/cli-service@5.0.8 --save-dev
|
||||||
|
npm install @dcloudio/vue-cli-plugin-uni@3.0.0 --save-dev
|
||||||
|
|
||||||
|
# 强制安装缺失的i18n模块
|
||||||
|
npm install @dcloudio/uni-cli-i18n@latest --save-dev
|
||||||
|
|
||||||
|
# 安装项目其他依赖
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
# 关键:安装UniApp核心打包插件(解决uni-build不存在问题)
|
# 验证依赖是否安装完整
|
||||||
npm install @dcloudio/vue-cli-plugin-uni@latest --save-dev
|
echo "检查关键模块是否存在..."
|
||||||
|
if [ ! -d "node_modules/@dcloudio/uni-cli-i18n" ]; then
|
||||||
# 安装Vue CLI服务(确保vue-cli-service可用)
|
echo "错误:@dcloudio/uni-cli-i18n 仍未安装成功!"
|
||||||
npm install @vue/cli-service@5.0.8 --save-dev
|
exit 1
|
||||||
|
fi
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,10 +61,9 @@ pipeline {
|
|||||||
sh """
|
sh """
|
||||||
cd ${UNIAPP_DIR}
|
cd ${UNIAPP_DIR}
|
||||||
|
|
||||||
# 验证依赖是否安装成功
|
# 再次验证命令可用性
|
||||||
echo "检查uni-build命令是否存在..."
|
|
||||||
npx vue-cli-service help | grep uni-build || {
|
npx vue-cli-service help | grep uni-build || {
|
||||||
echo "错误:uni-build命令仍不存在,依赖安装失败!"
|
echo "错误:uni-build命令仍不可用!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user