diff --git a/package.json b/package.json index b19adc5..b750a49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wuyuanbiaoba-web", - "version": "1.0.0", + "version": "1.0.1", "main": "index.html", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", diff --git a/script/package-app.sh b/script/package-app.sh index 261b217..c7d4f75 100644 --- a/script/package-app.sh +++ b/script/package-app.sh @@ -2,7 +2,13 @@ # 应用打包脚本 - 在开发环境运行 APP_NAME="wuyuanbiaoba-web" -VERSION="1.0.0" +# 自动读取 package.json 的 version 字段,如果失败则用 latest +if [ -f package.json ]; then + VERSION=$(grep '"version"' package.json | head -1 | sed -E 's/.*"version": *"([^"]+)".*/\1/') + [ -z "$VERSION" ] && VERSION="latest" +else + VERSION="latest" +fi TARGET_DIR="./build" DEPLOY_PACKAGE="${APP_NAME}-${VERSION}.tar.gz"