|
| 1 | +import { performance } from "node:perf_hooks"; |
| 2 | + |
1 | 3 | import type { CAC } from "cac";
|
2 | 4 | import enquirer from "enquirer";
|
3 | 5 |
|
4 | 6 | import { ACTIVATION, gitCommitScopes, gitCommitTypes } from "@/config";
|
5 |
| -import { execCommand, loadConfigModule, loggerInfo } from "@/helper"; |
| 7 | +import { execCommand, loadConfigModule, loggerInfo, printInfo } from "@/helper"; |
6 | 8 | import { GitCommitOptions } from "@/types";
|
7 | 9 |
|
8 | 10 | const mergeConfig = async () => {
|
@@ -103,13 +105,17 @@ export default function gitCommitInstaller(cli: CAC) {
|
103 | 105 | .option("-s, --scope <scope>", "填写修改范围")
|
104 | 106 | .option("-d, --description <description>", "填写修改描述")
|
105 | 107 | .action(async (options) => {
|
| 108 | + const start = performance.now(); |
| 109 | + |
106 | 110 | const { type, scope, description } = options;
|
107 | 111 | if (!type || !scope || !description) {
|
108 | 112 | const result = await generateEnquirer();
|
109 | 113 | await gitCommit(result.type, result.scope, result.description);
|
110 | 114 | } else {
|
111 | 115 | await gitCommit(type, scope, description);
|
112 | 116 | }
|
| 117 | + const getTime = () => `${(performance.now() - start).toFixed(2)}ms`; |
| 118 | + printInfo(`😁 commit 命令执行结束, 共用时: ${getTime()}`); |
113 | 119 | });
|
114 | 120 | },
|
115 | 121 | };
|
|
0 commit comments