liyongli 2 rokov pred
rodič
commit
fa5f170a07
1 zmenil súbory, kde vykonal 18 pridanie a 2 odobranie
  1. 18 2
      saveOSSAGitte.js

+ 18 - 2
saveOSSAGitte.js

@@ -2,6 +2,7 @@
 const path = require("path");
 const fs = require("fs");
 const oss = require("ali-oss");
+const {execSync } = require("child_process");
 
 (async function Init() {
   const localDir = "dist/";
@@ -50,7 +51,7 @@ const oss = require("ali-oss");
         }
       })
     );
-    // console.log("文件清除完成");
+    console.log("oss文件清除完成");
   }
 
   /**
@@ -64,7 +65,6 @@ const oss = require("ali-oss");
       let dir = filePath[0].split("\\");
       dir = dir.reverse()[0] + "/";
       if(dir === localDir) dir = "";
-      console.log(baseOssDir + dir + filePath[1],filePath.join("\\"))
       await client.put(
         baseOssDir + dir + filePath[1],
         path.normalize(filePath.join("\\"))
@@ -76,7 +76,23 @@ const oss = require("ali-oss");
       console.log("err--->", e);
     }
   }
+
+  /**
+   * 上传git
+   */
+  function execFun(){
+    try{
+       const add = execSync('git add .');
+       const commit = execSync('git commit -m "提交"');
+       const push = execSync('git push');
+       console.log(add, commit, push);
+    }catch(e){
+        console.error(e);
+    }
+  }
   
+  execFun();
   await delDir(baseOssDir);
   await getFiles(dirPath);
+  console.log("数据上传oss完成");
 })();