Browse Source

feat: 增加打包上传耗时计算

lanjianrong 3 years ago
parent
commit
b23a8b8ff9
2 changed files with 7 additions and 1 deletions
  1. 3 1
      src/commands/build.js
  2. 4 0
      src/utils/index.js

+ 3 - 1
src/commands/build.js

@@ -4,6 +4,7 @@ const {
   showSuccessText,
   showErrorText,
   showBigSuccessText,
+  showLogText,
 } = require("../utils");
 
 const localBuild = async function (config) {
@@ -181,7 +182,8 @@ module.exports = {
         await unzipFile(config);
         await deleteLocalFile(config);
         disconnectSSH();
-        showBigSuccessText("部署成功");
+        showBigSuccessText('部署成功');
+        showLogText(`总耗时:${Math.floor(process.uptime())}s`)
         process.exit(0);
       } else {
         showErrorText(

+ 4 - 0
src/utils/index.js

@@ -16,4 +16,8 @@ module.exports = {
   showBigSuccessText: (message) => {
     console.log(chalk.inverse.green("SUCCESS") + " " + chalk.green(message));
   },
+  // 耗时打印
+  showLogText: (message) => {
+    console.log(chalk.cyan(message))
+  }
 };