|
@@ -46,16 +46,18 @@ const { execSync } = require("child_process");
|
|
const sftp = new client();
|
|
const sftp = new client();
|
|
try {
|
|
try {
|
|
await sftp.connect(config.romote);
|
|
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("已清空原有文件");
|
|
console.log("已清空原有文件");
|
|
- await sftp.uploadDir(config.path.localPath, config.path.romotePath);
|
|
|
|
|
|
+ await sftp.uploadDir(config.path.localPath, romotePath);
|
|
console.log("上传完成");
|
|
console.log("上传完成");
|
|
// 断开连接
|
|
// 断开连接
|
|
sftp.end();
|
|
sftp.end();
|