liyongli 2 năm trước cách đây
mục cha
commit
769759d245
1 tập tin đã thay đổi với 11 bổ sung9 xóa
  1. 11 9
      saveOSSAGitte.js

+ 11 - 9
saveOSSAGitte.js

@@ -46,16 +46,18 @@ const { execSync } = require("child_process");
     const sftp = new client();
     try {
       await sftp.connect(config.romote);
-      const isCss = sftp.exists(config.path.romotePath + "/css");
-      const isFonts = sftp.exists(config.path.romotePath + "/fonts");
-      const isJs = sftp.exists(config.path.romotePath + "/js");
-      const isIndexHtml = sftp.exists(config.path.romotePath + "/index.html");
-      isCss && await sftp.rmdir(config.path.romotePath + "/css", true);
-      isFonts && await sftp.rmdir(config.path.romotePath + "/fonts", true);
-      isJs && await sftp.rmdir(config.path.romotePath + "/js", true);
-      isIndexHtml && await sftp.delete(config.path.romotePath + "/index.html", true);
+      const romotePath = config.path.romotePath;
+      const isCss = sftp.exists(romotePath + "/css");
+      const isFonts = sftp.exists(romotePath + "/fonts");
+      const isJs = sftp.exists(romotePath + "/js");
+      const isIndexHtml = sftp.exists(romotePath + "/index.html");
+      console.log("css ---> ",isCss)
+      isCss && await sftp.rmdir(romotePath + "/css", true);
+      isFonts && await sftp.rmdir(romotePath + "/fonts", true);
+      isJs && await sftp.rmdir(romotePath + "/js", true);
+      isIndexHtml && await sftp.delete(romotePath + "/index.html", true);
       console.log("已清空原有文件");
-      await sftp.uploadDir(config.path.localPath, config.path.romotePath);
+      await sftp.uploadDir(config.path.localPath, romotePath);
       console.log("上传完成");
       // 断开连接
       sftp.end();