|
@@ -1,11 +1,11 @@
|
1
|
1
|
const shell = require('shelljs')
|
2
|
2
|
const path = require('path');
|
3
|
3
|
const config = {
|
4
|
|
- ip: "118.190.89.49", // ssh地址
|
|
4
|
+ ip: "47.113.226.223", // ssh地址
|
5
|
5
|
username: "root", // ssh 用户名
|
6
|
6
|
port: 22, //端口
|
7
|
|
- password: "dstech@123", // ssh 密码
|
8
|
|
- path: '/home/itsm_v2_/web/pc', // 上传地址,删除地址
|
|
7
|
+ password: "DStech@123", // ssh 密码
|
|
8
|
+ path: '/home/itsm/project/html2/spreadSheet', // 上传地址,删除地址
|
9
|
9
|
buildPath: '../dist/spreadSheet' // 本地打包后文件地址
|
10
|
10
|
}
|
11
|
11
|
let Client = require('ssh2-sftp-client');
|
|
@@ -35,16 +35,16 @@ function connectSSh() {
|
35
|
35
|
function runTask() {
|
36
|
36
|
//打包完成
|
37
|
37
|
console.log(`当前NodeJs版本是${process.version}`);
|
38
|
|
- const isNodeVersionLt17 = parseInt(process.version) < 17;
|
39
|
|
- const execStr = isNodeVersionLt17 ? 'npm run build' : 'npm run build:17';
|
|
38
|
+ const isNodeVersionLt17 = parseInt(process.version.slice(1)) < 17;
|
|
39
|
+ const execStr = isNodeVersionLt17 ? 'npm run build' : 'npm run build';
|
40
|
40
|
if (shell.exec(execStr).code == 0) {
|
41
|
|
- if (shell.exec(`find dist -name '*.js' -print0 | xargs -0 gzip -k`).code == 0) {
|
42
|
|
- if (shell.exec(`find dist -name '*.css' -print0 | xargs -0 gzip -k`).code == 0) {
|
|
41
|
+ // if (shell.exec(`find dist -name '*.js' -print0 | xargs -0 gzip -k`).code == 0) {
|
|
42
|
+ // if (shell.exec(`find dist -name '*.css' -print0 | xargs -0 gzip -k`).code == 0) {
|
43
|
43
|
console.log("-----打包成功-----");
|
44
|
44
|
//提交上传
|
45
|
45
|
connectSSh();
|
46
|
|
- }
|
47
|
|
- }
|
|
46
|
+ // }
|
|
47
|
+ // }
|
48
|
48
|
}
|
49
|
49
|
}
|
50
|
50
|
runTask()
|