|
@@ -34,10 +34,17 @@ function connectSSh() {
|
34
|
34
|
}
|
35
|
35
|
function runTask() {
|
36
|
36
|
//打包完成
|
37
|
|
- if (shell.exec(`npm run build`).code == 0) {
|
38
|
|
- console.log("-----打包成功-----");
|
39
|
|
- //提交上传
|
40
|
|
- connectSSh();
|
|
37
|
+ console.log(`当前NodeJs版本是${process.version}`);
|
|
38
|
+ const isNodeVersionLt17 = parseInt(process.version) < 17;
|
|
39
|
+ const execStr = isNodeVersionLt17 ? 'npm run build' : 'npm run build:17';
|
|
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) {
|
|
43
|
+ console.log("-----打包成功-----");
|
|
44
|
+ //提交上传
|
|
45
|
+ connectSSh();
|
|
46
|
+ }
|
|
47
|
+ }
|
41
|
48
|
}
|
42
|
49
|
}
|
43
|
50
|
runTask()
|