Browse Source

优化打包

ZaiZai 2 years ago
parent
commit
84769d68fc
3 changed files with 7 additions and 7 deletions
  1. 1 3
      package.json
  2. 1 1
      public/version.json
  3. 5 3
      scripts/build.sh

+ 1 - 3
package.json

@@ -8,9 +8,7 @@
         "build:zip": "sh ./scripts/build.sh all",
         "build:zip:wgt": "sh ./scripts/build.sh wgt",
         "build:test": "sh ./scripts/build.sh all test",
-        "build:test:wgt": "sh ./scripts/build.sh wgt test",
-        "build:prod": "sh ./scripts/build.sh all prod",
-        "build:prod:wgt": "sh ./scripts/build.sh wgt prod"
+        "build:test:wgt": "sh ./scripts/build.sh wgt test"
     },
     "dependencies": {
         "axios": "^1.4.0",

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20230705182522"
+  "value": "20230706095744"
 }

+ 5 - 3
scripts/build.sh

@@ -25,6 +25,7 @@ fi
 # 执行打包为zip
 node ./scripts/zip.js
 
+current_time=$(date "+%Y%m%d%H%M%S")
 
  # 上传到测试服务器
 function testServer() {
@@ -35,7 +36,6 @@ function testServer() {
             \"*password\" {set timeout 500;send \"${passwd}\r\";}
         }
     expect eof"
-
 #服务器上的相关操作
 /usr/bin/expect << EOF
     set time 30
@@ -57,6 +57,10 @@ function testServer() {
     expect "*]#"
     send "unzip -o ${file_name}\r"
 
+    # 备份当前文件
+    expect "*]#"
+    send "cp ./${file_name} ./backup/${current_time}_${file_name}\r"
+
     # 退出
     send "exit\r"
     expect eof
@@ -68,8 +72,6 @@ EOF
  # 上传到测试服务器
 if [ $2 == "test" ]; then
     testServer
-elif [ $2 == "prod" ]; then
-    echo "暂不支持自动部署到正式服务器上,如有需求,请手动上传到正式服务器上更新"
 else
     echo "编译完成"
 fi