seimin 2 vuotta sitten
vanhempi
commit
34e3b51cb5
3 muutettua tiedostoa jossa 1 lisäystä ja 45 poistoa
  1. 0 1
      package.json
  2. 1 1
      upload/development.js
  3. 0 43
      upload/development110.js

+ 0 - 1
package.json

@@ -4,7 +4,6 @@
4 4
   "description": "",
5 5
   "main": "index.js",
6 6
   "scripts": {
7
-    "development110": "node ./upload/development110.js",
8 7
     "development": "node ./upload/development.js",
9 8
     "production": "node ./upload/production.js",
10 9
     "build": "npx gulp build"

+ 1 - 1
upload/development.js

@@ -1,7 +1,7 @@
1 1
 const shell = require('shelljs')
2 2
 const path = require('path');
3 3
 const config = {
4
-  ip: "192.168.3.109", // ssh地址
4
+  ip: "192.168.3.110", // ssh地址
5 5
   username: "root", // ssh 用户名
6 6
   port: 22,      //端口
7 7
   password: "DStech@123", // ssh 密码

+ 0 - 43
upload/development110.js

@@ -1,43 +0,0 @@
1
-const shell = require('shelljs')
2
-const path = require('path');
3
-const config = {
4
-  ip: "192.168.3.110", // ssh地址
5
-  username: "root", // ssh 用户名
6
-  port: 22,      //端口
7
-  password: "DStech@123", // ssh 密码
8
-  path: '/home/itsm/project/web/pcReq', // 上传地址,删除地址
9
-  buildPath: '../dist' // 本地打包后文件地址
10
-}
11
-let Client = require('ssh2-sftp-client');
12
-
13
-function connectSSh() {
14
-  let sftp = new Client();
15
-  sftp.connect({
16
-    host: config.ip,
17
-    port: config.port,
18
-    username: config.username,
19
-    password: config.password
20
-  }).then(() => {
21
-    console.log("-----先执行删除服务器文件-----")
22
-    return sftp.rmdir(config.path, true);
23
-  }).then(() => {
24
-    // 上传文件
25
-    console.log("-----开始上传-----")
26
-    return sftp.uploadDir(path.resolve(__dirname, config.buildPath), config.path);
27
-  }).then((data) => {
28
-    console.log("-----上传完成-----");
29
-    sftp.end();
30
-  }).catch((err) => {
31
-    console.log(err, '-----失败-----');
32
-    sftp.end();
33
-  });
34
-}
35
-function runTask() {
36
-  //打包完成
37
-  if (shell.exec(`npm run build`).code == 0) {
38
-    console.log("-----打包成功-----");
39
-    //提交上传
40
-    connectSSh();
41
-  }
42
-}
43
-runTask()