|
@@ -1,6 +1,13 @@
|
1
|
|
-const config = require('./config.js')
|
2
|
1
|
const shell = require('shelljs')
|
3
|
2
|
const path = require('path');
|
|
3
|
+const config = {
|
|
4
|
+ ip: "118.190.89.49",
|
|
5
|
+ username: "root",
|
|
6
|
+ port: 22,
|
|
7
|
+ password: "dstech@123",
|
|
8
|
+ path: '/home/itsm_v2_/web/specimenView',
|
|
9
|
+ buildPath: '../dist/specimenView'
|
|
10
|
+}
|
4
|
11
|
let Client = require('ssh2-sftp-client');
|
5
|
12
|
|
6
|
13
|
function connectSSh() {
|
|
@@ -12,11 +19,11 @@ function connectSSh() {
|
12
|
19
|
password: config.password
|
13
|
20
|
}).then(() => {
|
14
|
21
|
console.log("-----先执行删除服务器文件-----")
|
15
|
|
- return sftp.rmdir(config.rmpath, true);
|
|
22
|
+ return sftp.rmdir(config.path, true);
|
16
|
23
|
}).then(() => {
|
17
|
24
|
|
18
|
25
|
console.log("-----开始上传-----")
|
19
|
|
- return sftp.uploadDir(path.resolve(__dirname, '../dist/specimenView'), config.path);
|
|
26
|
+ return sftp.uploadDir(path.resolve(__dirname, config.buildPath), config.path);
|
20
|
27
|
}).then((data) => {
|
21
|
28
|
console.log("-----上传完成-----");
|
22
|
29
|
sftp.end();
|