Browse Source

修改配置

seimin 2 years ago
parent
commit
bf7aec09c3
3 changed files with 1 additions and 47 deletions
  1. 0 1
      package.json
  2. 1 1
      upload/development.js
  3. 0 45
      upload/development110.js

+ 0 - 1
package.json

@@ -4,7 +4,6 @@
4 4
   "description": "AngularJs Bootstrap Admin Template",
5 5
   "scripts": {
6 6
     "development": "node ./upload/development.js",
7
-    "development110": "node ./upload/development110.js",
8 7
     "production": "node ./upload/production.js",
9 8
     "build": "npx gulp build"
10 9
   },

+ 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 - 45
upload/development110.js

@@ -1,45 +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/pc', // 上传地址,删除地址(第一次部署)
9
-  path: '/home/itsm/project/web/pc/assets', // 上传地址,删除地址(bower_components太大,第二次以后的更新只更新assets,具体的灵活应变)
10
-  // buildPath: '../dist' // 本地打包后文件地址(第一次部署)
11
-  buildPath: '../dist/assets' // 本地打包后文件地址(bower_components太大,第二次以后的更新只更新assets,具体的灵活应变)
12
-}
13
-let Client = require('ssh2-sftp-client');
14
-
15
-function connectSSh() {
16
-  let sftp = new Client();
17
-  sftp.connect({
18
-    host: config.ip,
19
-    port: config.port,
20
-    username: config.username,
21
-    password: config.password
22
-  }).then(() => {
23
-    console.log("-----先执行删除服务器文件-----")
24
-    return sftp.rmdir(config.path, true);
25
-  }).then(() => {
26
-    // 上传文件
27
-    console.log("-----开始上传-----")
28
-    return sftp.uploadDir(path.resolve(__dirname, config.buildPath), config.path);
29
-  }).then((data) => {
30
-    console.log("-----上传完成-----");
31
-    sftp.end();
32
-  }).catch((err) => {
33
-    console.log(err, '-----失败-----');
34
-    sftp.end();
35
-  });
36
-}
37
-function runTask() {
38
-  //打包完成
39
-  if (shell.exec(`npm run build`).code == 0) {
40
-    console.log("-----打包成功-----");
41
-    //提交上传
42
-    connectSSh();
43
-  }
44
-}
45
-runTask()