cli-z-develop 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +121 -121
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { program as D } from "commander";
|
|
2
2
|
import $t from "node:child_process";
|
|
3
3
|
import { existsSync as v, readdirSync as vt, lstatSync as Nt, createWriteStream as bt } from "node:fs";
|
|
4
|
-
import { readdir as Re, mkdir as le, writeFile as L, rename as
|
|
4
|
+
import { readdir as Re, mkdir as le, writeFile as L, rename as _e, readFile as ke, stat as At } from "node:fs/promises";
|
|
5
5
|
import m from "node:path";
|
|
6
|
-
import ce, { AxiosError as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import ce, { AxiosError as jt } from "axios";
|
|
7
|
+
import S from "chalk";
|
|
8
|
+
import St from "dayjs";
|
|
9
9
|
import P from "shelljs";
|
|
10
10
|
import Tt from "node:os";
|
|
11
11
|
import Me from "child_process";
|
|
12
|
-
import { confirm as Ue, select as T, input as
|
|
12
|
+
import { confirm as Ue, select as T, input as F, password as Et, checkbox as Ce, number as ze } from "@inquirer/prompts";
|
|
13
13
|
import w from "ora";
|
|
14
14
|
import I from "fs-extra";
|
|
15
15
|
import { select as ae } from "inquirer-select-pro";
|
|
@@ -66,10 +66,10 @@ const Ot = {
|
|
|
66
66
|
8: "财务",
|
|
67
67
|
9: "其他"
|
|
68
68
|
}, fe = "http://git.cxlqd.com", Mt = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
|
|
69
|
-
var
|
|
69
|
+
var j = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e.CHORE = "chore", e.CI = "ci", e.Break = "BREAKING CHANGE", e))(j || {});
|
|
70
70
|
const zt = "fe-biz7tvsd", He = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
|
|
71
71
|
var R = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(R || {});
|
|
72
|
-
const
|
|
72
|
+
const Bt = [
|
|
73
73
|
{
|
|
74
74
|
name: "模块",
|
|
75
75
|
value: "module"
|
|
@@ -80,7 +80,7 @@ const _t = [
|
|
|
80
80
|
value: "case"
|
|
81
81
|
/* CASE */
|
|
82
82
|
}
|
|
83
|
-
],
|
|
83
|
+
], Jt = ".z", Ft = "develop-config.json", K = ".z", _t = ".commit-msg-tpl", Ut = "project.json";
|
|
84
84
|
function C(e = "") {
|
|
85
85
|
return m.join(K, e);
|
|
86
86
|
}
|
|
@@ -88,16 +88,16 @@ function Ze() {
|
|
|
88
88
|
return C(Ut);
|
|
89
89
|
}
|
|
90
90
|
function Ne() {
|
|
91
|
-
return C(
|
|
91
|
+
return C(_t);
|
|
92
92
|
}
|
|
93
93
|
function Ke() {
|
|
94
94
|
Me.spawnSync("git", ["config", "core.hooksPath", C()]), Me.spawnSync("git", ["config", "commit.template", Ne()]);
|
|
95
95
|
}
|
|
96
96
|
function he(e = "") {
|
|
97
|
-
return m.resolve(Tt.homedir(),
|
|
97
|
+
return m.resolve(Tt.homedir(), Jt, e);
|
|
98
98
|
}
|
|
99
99
|
function be() {
|
|
100
|
-
return he(
|
|
100
|
+
return he(Ft);
|
|
101
101
|
}
|
|
102
102
|
function Gt() {
|
|
103
103
|
return v(he());
|
|
@@ -116,25 +116,25 @@ function $e(e) {
|
|
|
116
116
|
}
|
|
117
117
|
return encodeURIComponent(t.replace(/\.git$/, ""));
|
|
118
118
|
}
|
|
119
|
-
const { red:
|
|
119
|
+
const { red: Be, green: Vt, blue: bn, magenta: Wt, yellow: An } = S;
|
|
120
120
|
function ye(...e) {
|
|
121
121
|
}
|
|
122
122
|
function V(...e) {
|
|
123
123
|
console.log(Vt(...e));
|
|
124
124
|
}
|
|
125
125
|
function Xe(e) {
|
|
126
|
-
e instanceof Error && (e.name === "ExitPromptError" || e.message.includes("User force closed the prompt with")) && (console.log(), console.log(
|
|
126
|
+
e instanceof Error && (e.name === "ExitPromptError" || e.message.includes("User force closed the prompt with")) && (console.log(), console.log(S.cyan(" 👋 下次见~")), console.log(), process.exit(1));
|
|
127
127
|
}
|
|
128
128
|
function l(e, t = !1) {
|
|
129
129
|
Xe(e);
|
|
130
130
|
let i = e;
|
|
131
|
-
e instanceof Error ? (i = e.message, ce.isAxiosError(e) && (i = `请求失败:${e.message}`), console.log(
|
|
131
|
+
e instanceof Error ? (i = e.message, ce.isAxiosError(e) && (i = `请求失败:${e.message}`), console.log(Be(i)), console.log(Wt(e.stack))) : console.log(Be(e)), t || process.exit(1);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Je(e) {
|
|
134
134
|
return v(e) ? Nt(e).isDirectory() : !1;
|
|
135
135
|
}
|
|
136
136
|
function Qe(e = process.cwd()) {
|
|
137
|
-
return
|
|
137
|
+
return Je(e) ? vt(e).filter((i) => Je(m.resolve(e, i))) : [];
|
|
138
138
|
}
|
|
139
139
|
async function p(e, t = {
|
|
140
140
|
removeTailLinkBreak: !0,
|
|
@@ -158,7 +158,7 @@ function et(e) {
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
function tt() {
|
|
161
|
-
return
|
|
161
|
+
return St(Date.now()).format("YYMMDD");
|
|
162
162
|
}
|
|
163
163
|
function qt(e, t) {
|
|
164
164
|
for (const i of t)
|
|
@@ -261,7 +261,7 @@ const Xt = {
|
|
|
261
261
|
// "**/*.{py}": "python --fix",
|
|
262
262
|
"**/*.{py}": "echo 'todo'"
|
|
263
263
|
}
|
|
264
|
-
}, Qt = "cli-z-develop", ei = "0.12.
|
|
264
|
+
}, Qt = "cli-z-develop", ei = "0.12.1", ti = "技术团队开发流程管理工具", ii = "dist/index.js", ai = { z: "bin/z.js", "z-develop": "bin/z.js" }, ni = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", eslint: "eslint '**/*.{ts,js}' --fix", prettier: "prettier -wu .", upload: "npm run build && npm publish --access public --registry https://registry.npmjs.org/", "upload:patch": "npm version patch && npm run upload", "upload:minor": "npm version minor && npm run upload", "upload:major": "npm version major && npm run upload" }, si = "module", ri = "z", oi = { "@lonely9/eslint-config-team": "^1.3.8", "@tsconfig/node22": "^22.0.5", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.9", "@types/minimist": "^1.2.5", "@types/node": "^22.15.29", "@types/semver": "^7.7.1", "@types/shelljs": "^0.10.0", "@typescript-eslint/eslint-plugin": "^8.58.2", "@typescript-eslint/parser": "^8.58.2", eslint: "^9.39.2", jiti: "^2.6.1", prettier: "^3.8.2", typescript: "^5.9.3", vite: "^7.3.1", "vue-tsc": "^3.2.6" }, ci = { "@inquirer/prompts": "^8.4.1", axios: "^1.15.0", chalk: "^5.6.2", commander: "^14.0.3", dayjs: "^1.11.20", "fs-extra": "^11.3.4", "inquirer-select-pro": "^1.0.0-alpha.9", "lint-staged": "^16.4.0", minimist: "^1.2.8", "npm-check-updates": "^19.3.1", ora: "^9.3.0", "p-limit": "^7.3.0", semver: "^7.7.4", shelljs: "^0.10.0" }, ie = {
|
|
265
265
|
name: Qt,
|
|
266
266
|
version: ei,
|
|
267
267
|
description: ti,
|
|
@@ -302,7 +302,8 @@ const Xt = {
|
|
|
302
302
|
ZenTaoDomain: "",
|
|
303
303
|
K8sDomain: "",
|
|
304
304
|
FEServerDomain: "",
|
|
305
|
-
K8SWebDomain: ""
|
|
305
|
+
K8SWebDomain: "",
|
|
306
|
+
FECDNDomain: ""
|
|
306
307
|
}
|
|
307
308
|
};
|
|
308
309
|
function k(e) {
|
|
@@ -314,12 +315,12 @@ function ge(e) {
|
|
|
314
315
|
function q(e) {
|
|
315
316
|
return e ? x.constants[e] : x.constants;
|
|
316
317
|
}
|
|
317
|
-
let
|
|
318
|
+
let _ = null, U = null;
|
|
318
319
|
function Ae() {
|
|
319
|
-
if (
|
|
320
|
-
return
|
|
320
|
+
if (_)
|
|
321
|
+
return _;
|
|
321
322
|
const e = m.join("package.json");
|
|
322
|
-
return v(e) || l(`当前目录(${P.pwd()})不存在${e}文件,请在项目根目录执行该命令。`),
|
|
323
|
+
return v(e) || l(`当前目录(${P.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), _ = I.readJsonSync(e), _;
|
|
323
324
|
}
|
|
324
325
|
function me() {
|
|
325
326
|
if (U)
|
|
@@ -336,10 +337,10 @@ function ui(e) {
|
|
|
336
337
|
} : U = e, I.writeJSONSync(Ze(), U, { spaces: 2 });
|
|
337
338
|
}
|
|
338
339
|
function li(e) {
|
|
339
|
-
|
|
340
|
-
...
|
|
340
|
+
_ ? _ = {
|
|
341
|
+
..._,
|
|
341
342
|
...e
|
|
342
|
-
} :
|
|
343
|
+
} : _ = e, I.writeJSONSync(m.join("package.json"), _, { spaces: 2 });
|
|
343
344
|
}
|
|
344
345
|
const Z = {
|
|
345
346
|
id: 0,
|
|
@@ -399,11 +400,11 @@ async function Y(e) {
|
|
|
399
400
|
headers: i,
|
|
400
401
|
responseType: e?.responseType || "json"
|
|
401
402
|
};
|
|
402
|
-
ye(
|
|
403
|
+
ye(S.magenta(s.method.toUpperCase()), S.yellow(s.url), JSON.stringify(s.headers)), ye(S.gray(JSON.stringify(s[a], null, 2)));
|
|
403
404
|
const o = await ce(s);
|
|
404
|
-
return ye(
|
|
405
|
+
return ye(S.green("Response"), S.grey(JSON.stringify(o.data, null, 2))), Promise.resolve(o.data);
|
|
405
406
|
} catch (s) {
|
|
406
|
-
return s instanceof
|
|
407
|
+
return s instanceof jt && ye(S.red("Error"), S.grey(JSON.stringify(s?.response?.data))), Promise.reject(s);
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
410
|
async function mi() {
|
|
@@ -521,87 +522,87 @@ async function gi(e, t) {
|
|
|
521
522
|
throw console.error("下载失败:", i), i;
|
|
522
523
|
}
|
|
523
524
|
}
|
|
524
|
-
const
|
|
525
|
+
const B = () => `${fe}/api/v4`, J = (e) => `${B()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
|
|
525
526
|
function hi() {
|
|
526
527
|
return N({
|
|
527
|
-
url:
|
|
528
|
+
url: J("src/data/template-projects.json")
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
531
|
function wi() {
|
|
531
532
|
return N({
|
|
532
|
-
url:
|
|
533
|
+
url: J("src/data/java-project-module.json")
|
|
533
534
|
});
|
|
534
535
|
}
|
|
535
536
|
function at() {
|
|
536
537
|
return N({
|
|
537
|
-
url:
|
|
538
|
+
url: J("src/data/z-develop-config.json")
|
|
538
539
|
});
|
|
539
540
|
}
|
|
540
541
|
function yi() {
|
|
541
542
|
return N({
|
|
542
|
-
url:
|
|
543
|
+
url: J("src/assets/tsconfig.browser.json")
|
|
543
544
|
});
|
|
544
545
|
}
|
|
545
546
|
function $i() {
|
|
546
547
|
return N({
|
|
547
|
-
url:
|
|
548
|
+
url: J("src/assets/tsconfig.node.json")
|
|
548
549
|
});
|
|
549
550
|
}
|
|
550
551
|
function vi() {
|
|
551
552
|
return N({
|
|
552
|
-
url:
|
|
553
|
+
url: J("src/assets/.prettierignore")
|
|
553
554
|
});
|
|
554
555
|
}
|
|
555
556
|
function Ni() {
|
|
556
557
|
return N({
|
|
557
|
-
url:
|
|
558
|
+
url: J("src/assets/.prettierrc.json")
|
|
558
559
|
});
|
|
559
560
|
}
|
|
560
561
|
function bi() {
|
|
561
562
|
return N({
|
|
562
|
-
url:
|
|
563
|
+
url: J("src/assets/data.yaml")
|
|
563
564
|
});
|
|
564
565
|
}
|
|
565
566
|
function Ai() {
|
|
566
567
|
return N({
|
|
567
|
-
url:
|
|
568
|
+
url: J("src/assets/main.py")
|
|
568
569
|
});
|
|
569
570
|
}
|
|
570
|
-
function
|
|
571
|
+
function ji() {
|
|
571
572
|
return N({
|
|
572
|
-
url:
|
|
573
|
+
url: J("src/assets/checkstyle.xml")
|
|
573
574
|
});
|
|
574
575
|
}
|
|
575
|
-
function
|
|
576
|
+
function Si() {
|
|
576
577
|
return N({
|
|
577
|
-
url:
|
|
578
|
+
url: J("src/data/project-group-chats.json")
|
|
578
579
|
});
|
|
579
580
|
}
|
|
580
581
|
function Ti() {
|
|
581
582
|
return N({
|
|
582
|
-
url: `${
|
|
583
|
+
url: `${B()}/user`
|
|
583
584
|
});
|
|
584
585
|
}
|
|
585
586
|
function Ei() {
|
|
586
587
|
return N({
|
|
587
|
-
url: `${
|
|
588
|
+
url: `${B()}/groups`
|
|
588
589
|
});
|
|
589
590
|
}
|
|
590
591
|
function ki(e) {
|
|
591
592
|
return N({
|
|
592
|
-
url: `${
|
|
593
|
+
url: `${B()}/projects`,
|
|
593
594
|
method: "post",
|
|
594
595
|
data: e
|
|
595
596
|
});
|
|
596
597
|
}
|
|
597
598
|
function nt(e) {
|
|
598
599
|
return N({
|
|
599
|
-
url: `${
|
|
600
|
+
url: `${B()}/projects/${e}`
|
|
600
601
|
});
|
|
601
602
|
}
|
|
602
603
|
function Ci(e) {
|
|
603
604
|
return N({
|
|
604
|
-
url: `${
|
|
605
|
+
url: `${B()}/projects`,
|
|
605
606
|
data: {
|
|
606
607
|
search: e,
|
|
607
608
|
search_namespaces: !0
|
|
@@ -610,40 +611,40 @@ function Ci(e) {
|
|
|
610
611
|
}
|
|
611
612
|
function Ri(e) {
|
|
612
613
|
return N({
|
|
613
|
-
url: `${
|
|
614
|
+
url: `${B()}/projects/${e.id}/merge_requests`,
|
|
614
615
|
method: "post",
|
|
615
616
|
data: e
|
|
616
617
|
});
|
|
617
618
|
}
|
|
618
619
|
function Ii(e) {
|
|
619
620
|
return N({
|
|
620
|
-
url: `${
|
|
621
|
+
url: `${B()}/projects/${e.id}/merge_requests/${e.iid}/merge`,
|
|
621
622
|
method: "put"
|
|
622
623
|
});
|
|
623
624
|
}
|
|
624
625
|
function xi(e) {
|
|
625
626
|
return N({
|
|
626
|
-
url: `${
|
|
627
|
+
url: `${B()}/projects/${e.id}/merge_requests/${e.iid}`,
|
|
627
628
|
method: "put",
|
|
628
629
|
data: e
|
|
629
630
|
});
|
|
630
631
|
}
|
|
631
632
|
function Di(e) {
|
|
632
633
|
return N({
|
|
633
|
-
url: `${
|
|
634
|
+
url: `${B()}/projects/${e.id}/merge_requests/${e.iid}`,
|
|
634
635
|
method: "get"
|
|
635
636
|
});
|
|
636
637
|
}
|
|
637
638
|
function Li(e) {
|
|
638
639
|
return N({
|
|
639
|
-
url: `${
|
|
640
|
+
url: `${B()}/projects/${e.id}/repository/branches`,
|
|
640
641
|
method: "post",
|
|
641
642
|
data: e
|
|
642
643
|
});
|
|
643
644
|
}
|
|
644
645
|
function Pi(e) {
|
|
645
646
|
return N({
|
|
646
|
-
url: `${
|
|
647
|
+
url: `${B()}/projects/${e}/repository/branches`
|
|
647
648
|
});
|
|
648
649
|
}
|
|
649
650
|
function Oi() {
|
|
@@ -680,7 +681,7 @@ function zi() {
|
|
|
680
681
|
url: "/user/list2"
|
|
681
682
|
});
|
|
682
683
|
}
|
|
683
|
-
function
|
|
684
|
+
function Bi() {
|
|
684
685
|
return A({
|
|
685
686
|
url: "/zen/testcase/product/list"
|
|
686
687
|
});
|
|
@@ -693,7 +694,7 @@ function st(e) {
|
|
|
693
694
|
}
|
|
694
695
|
});
|
|
695
696
|
}
|
|
696
|
-
function
|
|
697
|
+
function Ji(e) {
|
|
697
698
|
return A({
|
|
698
699
|
url: "/zen/testcase/product/name",
|
|
699
700
|
data: {
|
|
@@ -701,7 +702,7 @@ function Bi(e) {
|
|
|
701
702
|
}
|
|
702
703
|
});
|
|
703
704
|
}
|
|
704
|
-
function
|
|
705
|
+
function Fi(e, t) {
|
|
705
706
|
return A({
|
|
706
707
|
url: "/zen/testcase/product/auto-case/list",
|
|
707
708
|
data: {
|
|
@@ -710,7 +711,7 @@ function Ji(e, t) {
|
|
|
710
711
|
}
|
|
711
712
|
});
|
|
712
713
|
}
|
|
713
|
-
function
|
|
714
|
+
function _i(e) {
|
|
714
715
|
return A({
|
|
715
716
|
url: "/zen/testcase/step/list",
|
|
716
717
|
data: {
|
|
@@ -848,7 +849,7 @@ async function ot(e, t, i) {
|
|
|
848
849
|
return a = Array.isArray(a) ? a : [a], aa(a, n), a;
|
|
849
850
|
}
|
|
850
851
|
async function na(e, t, i) {
|
|
851
|
-
const { groups: n } = await
|
|
852
|
+
const { groups: n } = await Si(), a = n.map((o) => ({
|
|
852
853
|
name: o.name,
|
|
853
854
|
value: o.url
|
|
854
855
|
}));
|
|
@@ -885,7 +886,7 @@ async function sa() {
|
|
|
885
886
|
}
|
|
886
887
|
]
|
|
887
888
|
});
|
|
888
|
-
let i = await
|
|
889
|
+
let i = await F({
|
|
889
890
|
message: "请输入LDAP账号:"
|
|
890
891
|
});
|
|
891
892
|
i = i.trim();
|
|
@@ -931,7 +932,7 @@ z run commit-files`, { mode: 493 });
|
|
|
931
932
|
mode: 493
|
|
932
933
|
}
|
|
933
934
|
), await L(C(".prettierignore"), await vi(), { mode: 493 }), await L(C("tsconfig.node.json"), await $i(), { mode: 493 }), await L(C("tsconfig.browser.json"), await yi(), { mode: 493 })), e === $.JAVA) {
|
|
934
|
-
await gi(`${q("FECDNDomain")}/file/vgnlfbfHRF.jar`, C("checkstyle.jar")), await L(C("checkstyle.xml"), await
|
|
935
|
+
await gi(`${q("FECDNDomain")}/file/vgnlfbfHRF.jar`, C("checkstyle.jar")), await L(C("checkstyle.xml"), await ji(), { mode: 493 });
|
|
935
936
|
const t = m.join("package.json");
|
|
936
937
|
v(t) || await L(t, JSON.stringify({ version: "0.0.1" }, null, 2), {
|
|
937
938
|
mode: 493
|
|
@@ -1025,7 +1026,7 @@ async function da(e) {
|
|
|
1025
1026
|
value: de.REFACTOR
|
|
1026
1027
|
}
|
|
1027
1028
|
]
|
|
1028
|
-
}), e.branchPurpose ? i = e.branchPurpose : (i = await
|
|
1029
|
+
}), e.branchPurpose ? i = e.branchPurpose : (i = await F({
|
|
1029
1030
|
message: "请输入创建分支的目的(大小写字母、数字,小驼峰式命名。如userInfo)",
|
|
1030
1031
|
validate: ma
|
|
1031
1032
|
}), i = i.trim());
|
|
@@ -1059,26 +1060,25 @@ async function ga() {
|
|
|
1059
1060
|
}
|
|
1060
1061
|
})) : [];
|
|
1061
1062
|
}
|
|
1062
|
-
async function
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
return t += ` BODY_MESSAGE_START ${i} BODY_MESSAGE_END `, await ia({
|
|
1066
|
-
type: "commit-message",
|
|
1063
|
+
async function Fe(e) {
|
|
1064
|
+
const t = await p("git diff HEAD"), i = await ia({
|
|
1065
|
+
type: "commit-message-v2",
|
|
1067
1066
|
input: t
|
|
1068
1067
|
// modelName: "qwen-turbo",
|
|
1069
1068
|
});
|
|
1069
|
+
return e + i;
|
|
1070
1070
|
}
|
|
1071
1071
|
async function Ee(e, t, i) {
|
|
1072
1072
|
const n = w("🤖 生成提交信息中...").start();
|
|
1073
1073
|
let a = "", s = !0;
|
|
1074
|
-
if ([
|
|
1074
|
+
if ([j.FEAT, j.FIX, j.REFACTOR].includes(e)) {
|
|
1075
1075
|
const o = t.map((r) => r.value).join(",");
|
|
1076
|
-
if (i || (a = await
|
|
1076
|
+
if (i || (a = await Fe(`${e}(${o}): `)), !a) {
|
|
1077
1077
|
const r = t.map((c) => c.name).join(";");
|
|
1078
1078
|
a = `${e}(${o}): ${r}`, s = !1;
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
|
-
e ===
|
|
1081
|
+
e === j.CHORE && (t ? a = `${e}: ${t}` : a = await Fe(`${e}: `)), await L(Ne(), a, "utf-8"), s || i ? n.succeed("提交信息已生成(↓),可以进行提交了!") : n.warn("AI生成提交信息失败,已使用默认模板(↓),可以进行提交了!"), console.log(S.yellow(a));
|
|
1082
1082
|
}
|
|
1083
1083
|
async function ha(e) {
|
|
1084
1084
|
const t = await T({
|
|
@@ -1086,23 +1086,23 @@ async function ha(e) {
|
|
|
1086
1086
|
choices: [
|
|
1087
1087
|
{
|
|
1088
1088
|
name: "feat - 业务需求/功能开发/BUG修复",
|
|
1089
|
-
value:
|
|
1089
|
+
value: j.FEAT
|
|
1090
1090
|
},
|
|
1091
1091
|
{
|
|
1092
1092
|
name: "fix - bug修复",
|
|
1093
|
-
value:
|
|
1093
|
+
value: j.FIX
|
|
1094
1094
|
},
|
|
1095
1095
|
{
|
|
1096
1096
|
name: "refactor - 技术重构/性能优化/代码规范",
|
|
1097
|
-
value:
|
|
1097
|
+
value: j.REFACTOR
|
|
1098
1098
|
},
|
|
1099
1099
|
{
|
|
1100
1100
|
name: "chore - 其他",
|
|
1101
|
-
value:
|
|
1101
|
+
value: j.CHORE
|
|
1102
1102
|
}
|
|
1103
1103
|
]
|
|
1104
1104
|
});
|
|
1105
|
-
if ([
|
|
1105
|
+
if ([j.FEAT, j.REFACTOR].includes(t)) {
|
|
1106
1106
|
const i = await fa();
|
|
1107
1107
|
if (!i.length)
|
|
1108
1108
|
return V("🤷 暂无开发任务");
|
|
@@ -1115,9 +1115,9 @@ async function ha(e) {
|
|
|
1115
1115
|
})),
|
|
1116
1116
|
pageSize: i.length
|
|
1117
1117
|
});
|
|
1118
|
-
await Ee(
|
|
1118
|
+
await Ee(j.FEAT, n, e);
|
|
1119
1119
|
}
|
|
1120
|
-
if (t ===
|
|
1120
|
+
if (t === j.FIX) {
|
|
1121
1121
|
const i = await ga();
|
|
1122
1122
|
if (!i.length)
|
|
1123
1123
|
return V("🤷 暂无BUG");
|
|
@@ -1130,14 +1130,14 @@ async function ha(e) {
|
|
|
1130
1130
|
})),
|
|
1131
1131
|
pageSize: i.length
|
|
1132
1132
|
});
|
|
1133
|
-
await Ee(
|
|
1133
|
+
await Ee(j.FIX, n, e);
|
|
1134
1134
|
}
|
|
1135
|
-
if (t ===
|
|
1135
|
+
if (t === j.CHORE) {
|
|
1136
1136
|
let i = "";
|
|
1137
|
-
e && (i = await
|
|
1137
|
+
e && (i = await F({
|
|
1138
1138
|
message: "请输入commit msg:",
|
|
1139
1139
|
validate: (n) => n.length === 0 ? "请输入commit msg" : !0
|
|
1140
|
-
}), i = i.trim()), await Ee(
|
|
1140
|
+
}), i = i.trim()), await Ee(j.CHORE, i);
|
|
1141
1141
|
}
|
|
1142
1142
|
process.exit(0);
|
|
1143
1143
|
}
|
|
@@ -1170,17 +1170,17 @@ async function wa() {
|
|
|
1170
1170
|
name: O.find((H) => H.id === te)?.name
|
|
1171
1171
|
};
|
|
1172
1172
|
}, n = async () => {
|
|
1173
|
-
e.projectName = await
|
|
1173
|
+
e.projectName = await F({
|
|
1174
1174
|
message: "请输入项目名称",
|
|
1175
1175
|
validate: (O) => la(O, e.group?.name || "")
|
|
1176
|
-
}), e.projectName = e.projectName.trim(), e.projectDesc = await
|
|
1176
|
+
}), e.projectName = e.projectName.trim(), e.projectDesc = await F({
|
|
1177
1177
|
message: "请输入项目描述",
|
|
1178
1178
|
validate: pa
|
|
1179
1179
|
}), e.projectDesc = e.projectDesc.trim();
|
|
1180
1180
|
};
|
|
1181
1181
|
await t(), await i(), await n();
|
|
1182
1182
|
const a = `${fe}/${e.group?.name}/${e.projectName}.git`, s = w("模版初始化中").start();
|
|
1183
|
-
await p(`git clone --depth=1 ${e.tplUrl}`), await
|
|
1183
|
+
await p(`git clone --depth=1 ${e.tplUrl}`), await _e(e.tplName, e.projectName), P.cd(e.projectName), P.rm("-rf", ".git"), await p(`git init --initial-branch=${y.MASTER}`), await p(`git remote add origin ${a}`), await p(`git config user.name ${k("gitName")}`), await p(`git config user.email ${k("gitEmail")}`);
|
|
1184
1184
|
const o = Ae();
|
|
1185
1185
|
li({
|
|
1186
1186
|
...o,
|
|
@@ -1202,7 +1202,7 @@ async function wa() {
|
|
|
1202
1202
|
visibility: "private",
|
|
1203
1203
|
namespace_id: e.group?.id
|
|
1204
1204
|
});
|
|
1205
|
-
await p(`git push -u origin ${y.MASTER}`), await p(`git push origin HEAD:${y.MASTER} --tags`), c.succeed(`项目已推送到远程,地址: ${
|
|
1205
|
+
await p(`git push -u origin ${y.MASTER}`), await p(`git push origin HEAD:${y.MASTER} --tags`), c.succeed(`项目已推送到远程,地址: ${S.blue(a)}`);
|
|
1206
1206
|
const d = w("初始化分支中").start(), f = `feat_init_${tt()}`, g = [y.DEV, y.TEST, y.RELEASE, f], h = await Promise.allSettled(
|
|
1207
1207
|
g.map(
|
|
1208
1208
|
(O) => Li({
|
|
@@ -1214,9 +1214,9 @@ async function wa() {
|
|
|
1214
1214
|
), E = [];
|
|
1215
1215
|
h.forEach(({ status: O }, te) => {
|
|
1216
1216
|
O === "fulfilled" && E.push(g[te]);
|
|
1217
|
-
}), await p("git pull"), E.includes(f) ? (await p(`git checkout -b ${f} origin/${f}`), d.succeed(`项目已切换到初始分支: ${
|
|
1217
|
+
}), await p("git pull"), E.includes(f) ? (await p(`git checkout -b ${f} origin/${f}`), d.succeed(`项目已切换到初始分支: ${S.blue(f)}`)) : d.warn("开发分支检出失败!项目当前在主分支,请自行检出开发分支。");
|
|
1218
1218
|
const ee = `cd ${e.projectName} && z start`;
|
|
1219
|
-
console.log(`输入 ${
|
|
1219
|
+
console.log(`输入 ${S.green(ee)} 开始开发吧~`), process.exit(0);
|
|
1220
1220
|
} catch (e) {
|
|
1221
1221
|
l(e);
|
|
1222
1222
|
}
|
|
@@ -1284,7 +1284,7 @@ async function va(e) {
|
|
|
1284
1284
|
]
|
|
1285
1285
|
}
|
|
1286
1286
|
}), c = `${q("K8SWebDomain")}/youshou-local/clusters/youshou-local/devops/${o.namespace}/pipelines/${r.pipelineRef.name}/branch/${r.scm.refName}/run/${o.name}/task-status`;
|
|
1287
|
-
t.succeed("部署任务创建完成"), console.log(`如有需要,可在k8s中查看 ${
|
|
1287
|
+
t.succeed("部署任务创建完成"), console.log(`如有需要,可在k8s中查看 ${S.blue(c)}`), process.exit(0);
|
|
1288
1288
|
} catch (o) {
|
|
1289
1289
|
t.fail("部署任务创建失败"), l(o);
|
|
1290
1290
|
}
|
|
@@ -1405,7 +1405,7 @@ async function ba(e, t) {
|
|
|
1405
1405
|
);
|
|
1406
1406
|
if (s || l(`分支${e.sourceBranch}上不存在新的commit,不需要合并。`), await p(
|
|
1407
1407
|
`git branch --contains ${n} -r ${i}`
|
|
1408
|
-
) || (console.log(
|
|
1408
|
+
) || (console.log(S.yellow("注意:当前分支上不存在远程主分支最新代码,将在自动合入后继续。")), await lt(y.MASTER, e.sourceBranch, e)), t === y.MASTER) {
|
|
1409
1409
|
const r = s.split(`
|
|
1410
1410
|
`).filter((f) => f), c = await p(`git log -b origin/${b.TEST} -1 --format=%H`), d = (await p(
|
|
1411
1411
|
`git log ${n}...${c} -b origin/${b.TEST}`
|
|
@@ -1420,7 +1420,7 @@ async function Aa(e, t) {
|
|
|
1420
1420
|
Object.values(y).includes(i.sourceBranch) && l(`当前分支${i.sourceBranch}不可作为源分支合并到目标分支。`);
|
|
1421
1421
|
const a = (await Pi(i.id)).filter((c) => ![i.sourceBranch].includes(c.name)).map((c) => {
|
|
1422
1422
|
let u = c.name;
|
|
1423
|
-
return Object.values(y).includes(u) && (u =
|
|
1423
|
+
return Object.values(y).includes(u) && (u = S.bold.blue(u)), {
|
|
1424
1424
|
name: u,
|
|
1425
1425
|
value: c.name
|
|
1426
1426
|
};
|
|
@@ -1449,7 +1449,7 @@ async function Aa(e, t) {
|
|
|
1449
1449
|
}
|
|
1450
1450
|
D.command("merge").alias("m").description("合并当前分支到指定远程分支,并部署。").argument("[branch]", "目标分支名称").option("--deploy-platform <platform>", `合并成功后要部署的平台。可选值:${Object.values(G).join("/")}`).option("--deploy-skip-selection-notification", "部署时,是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").option("--keep-branch-after-merge-master", "在合并到主分支之后,是否保留分支。默认否").action((...e) => z(Aa, ...e));
|
|
1451
1451
|
D.command("deploy").alias("d").description("部署到指定环境").argument("[branchName]", `部署环境。可选值:${Object.values(y).join("/")}`).option("--platform <platform>", `部署平台。可选值:${Object.values(G).join("/")}`).option("--module <module>", "部署模块。Java项目适用,填入要部署的模块名称").option("--skip-selection-notification", "是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").action((...e) => z(ut, ...e));
|
|
1452
|
-
async function
|
|
1452
|
+
async function ja() {
|
|
1453
1453
|
try {
|
|
1454
1454
|
await p("java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml .", {
|
|
1455
1455
|
silent: !1
|
|
@@ -1458,7 +1458,7 @@ async function Sa() {
|
|
|
1458
1458
|
l("checkstyle执行出错"), process.exit(1);
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function Sa() {
|
|
1462
1462
|
const e = me();
|
|
1463
1463
|
if (e["lint-staged"])
|
|
1464
1464
|
return e["lint-staged"];
|
|
@@ -1469,7 +1469,7 @@ async function Ta() {
|
|
|
1469
1469
|
await kt({
|
|
1470
1470
|
concurrent: 4,
|
|
1471
1471
|
debug: !1,
|
|
1472
|
-
config:
|
|
1472
|
+
config: Sa(),
|
|
1473
1473
|
quiet: !0,
|
|
1474
1474
|
relative: !0
|
|
1475
1475
|
}) ? (e.succeed("代码风格检测通过!"), process.exit(0)) : (e.fail("代码风格检测未通过!"), process.exit(1));
|
|
@@ -1481,7 +1481,7 @@ function Ea(e) {
|
|
|
1481
1481
|
if (t.length === 1)
|
|
1482
1482
|
return "body前缺少「: 」";
|
|
1483
1483
|
const i = t[0];
|
|
1484
|
-
return /^(feat|fix|refactor)/.test(i) ? /\(\d+(?:,\d+)*\)/.test(i) ? !0 : "ID缺少或者格式不正确。" : /^(chore|ci)/.test(i) ? [
|
|
1484
|
+
return /^(feat|fix|refactor)/.test(i) ? /\(\d+(?:,\d+)*\)/.test(i) ? !0 : "ID缺少或者格式不正确。" : /^(chore|ci)/.test(i) ? [j.CHORE, j.CI].includes(i) ? !0 : "chore/ci类型无需填写ID。" : j.Break === i ? !0 : "不存在的提交类型。";
|
|
1485
1485
|
}
|
|
1486
1486
|
async function ka() {
|
|
1487
1487
|
const e = await ke(m.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = w("提交信息格式校验中...").start(), i = Ea(e);
|
|
@@ -1602,7 +1602,7 @@ async function Da(e, t) {
|
|
|
1602
1602
|
choices: a
|
|
1603
1603
|
});
|
|
1604
1604
|
}
|
|
1605
|
-
n === "commit-msg" ? await ka() : n === "commit-files" ? await Ta() : n === "prettier" ? await Ia() : n === "eslint" && i.language === $.JAVASCRIPT ? await Ra(t) : n === "type-check" && i.language === $.JAVASCRIPT ? xa() : n === "dependency-check" && i.language === $.JAVASCRIPT ? await Ca() : n === "checkstyle" && i.language === $.JAVA && await
|
|
1605
|
+
n === "commit-msg" ? await ka() : n === "commit-files" ? await Ta() : n === "prettier" ? await Ia() : n === "eslint" && i.language === $.JAVASCRIPT ? await Ra(t) : n === "type-check" && i.language === $.JAVASCRIPT ? xa() : n === "dependency-check" && i.language === $.JAVASCRIPT ? await Ca() : n === "checkstyle" && i.language === $.JAVA && await ja();
|
|
1606
1606
|
}
|
|
1607
1607
|
D.command("run").alias("r").description("执行 eslint / prettier / type-check / dependency-check / checkstyle。").argument(
|
|
1608
1608
|
"[type]",
|
|
@@ -1699,7 +1699,7 @@ async function we(e, t, i, n) {
|
|
|
1699
1699
|
if (a === s)
|
|
1700
1700
|
return !0;
|
|
1701
1701
|
const o = m.dirname(e), r = m.join(o, s);
|
|
1702
|
-
return await Kt(e) ? await
|
|
1702
|
+
return await Kt(e) ? await _e(e, r) : (await p(`git mv "${e}" "${r}"`), await p("git add .")), !0;
|
|
1703
1703
|
} catch (a) {
|
|
1704
1704
|
return l(`重命名文件夹失败: ${e} -> ${t}。${a}`), !1;
|
|
1705
1705
|
}
|
|
@@ -1726,7 +1726,7 @@ async function gt(e) {
|
|
|
1726
1726
|
if (e)
|
|
1727
1727
|
Number.isNaN(Number(e)) && l("请输入正确的产品ID"), t.id = Number(e);
|
|
1728
1728
|
else {
|
|
1729
|
-
const i = await
|
|
1729
|
+
const i = await Bi();
|
|
1730
1730
|
t.id = await T({
|
|
1731
1731
|
message: "请选择产品",
|
|
1732
1732
|
choices: i.map((n) => ({
|
|
@@ -1735,7 +1735,7 @@ async function gt(e) {
|
|
|
1735
1735
|
}))
|
|
1736
1736
|
});
|
|
1737
1737
|
}
|
|
1738
|
-
return t.name = await
|
|
1738
|
+
return t.name = await Ji(t.id), t.path = m.join(mt, W("module", t.name, String(t.id))), t;
|
|
1739
1739
|
}
|
|
1740
1740
|
async function Le(e) {
|
|
1741
1741
|
return (await ft(mt)).find((i) => Number(i.id) === e.id);
|
|
@@ -1746,7 +1746,7 @@ async function ht(e, t) {
|
|
|
1746
1746
|
priority: e.pri,
|
|
1747
1747
|
steps: []
|
|
1748
1748
|
};
|
|
1749
|
-
i.steps = await
|
|
1749
|
+
i.steps = await _i(e.id), I.writeJSONSync(t, i, {
|
|
1750
1750
|
spaces: 2
|
|
1751
1751
|
});
|
|
1752
1752
|
}
|
|
@@ -1771,12 +1771,12 @@ function Pe(e) {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
return [];
|
|
1773
1773
|
}
|
|
1774
|
-
async function
|
|
1774
|
+
async function je(e, t) {
|
|
1775
1775
|
ne(), Q(), await pe();
|
|
1776
1776
|
let i;
|
|
1777
1777
|
t ? ([R.MODULE, R.CASE].includes(t) || l(`不支持的参数${t}。参数值应为 ${R.MODULE} 或者 ${R.CASE}。`), i = t) : i = await T({
|
|
1778
1778
|
message: `请选择要${e}的数据类型`,
|
|
1779
|
-
choices:
|
|
1779
|
+
choices: Bt
|
|
1780
1780
|
});
|
|
1781
1781
|
const n = i === R.MODULE ? "模块" : R.CASE === i ? "用例" : "";
|
|
1782
1782
|
return {
|
|
@@ -1784,7 +1784,7 @@ async function Se(e, t) {
|
|
|
1784
1784
|
typeStr: n
|
|
1785
1785
|
};
|
|
1786
1786
|
}
|
|
1787
|
-
async function
|
|
1787
|
+
async function Se(e) {
|
|
1788
1788
|
const t = await gt(e), i = await Le(t);
|
|
1789
1789
|
return i || l(`本地未找到产品【${t.name}[${t.id}]】`), {
|
|
1790
1790
|
product: t,
|
|
@@ -1796,7 +1796,7 @@ async function Oa(e, t, i) {
|
|
|
1796
1796
|
const a = Pe(i);
|
|
1797
1797
|
let s = await X(t.path);
|
|
1798
1798
|
e.text = "获取远程用例列表...";
|
|
1799
|
-
const o = await
|
|
1799
|
+
const o = await Fi(t.id, a);
|
|
1800
1800
|
e.text = "本地用例同步中...";
|
|
1801
1801
|
for (const r of o) {
|
|
1802
1802
|
let c;
|
|
@@ -1822,7 +1822,7 @@ async function Ma(e, t) {
|
|
|
1822
1822
|
e.text = "本地同步模块中...", await Pa(n || [], t.path);
|
|
1823
1823
|
}
|
|
1824
1824
|
async function za(e, t) {
|
|
1825
|
-
const { type: i, typeStr: n } = await
|
|
1825
|
+
const { type: i, typeStr: n } = await je("拉取", e), a = await gt(t.productId), s = w(`${n}同步中...`).start();
|
|
1826
1826
|
if (R.MODULE === i && await Ma(s, a), R.CASE === i && await Oa(s, a, t.caseIds), s.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await p("git status -s")) {
|
|
1827
1827
|
const o = w("代码提交中...").start();
|
|
1828
1828
|
try {
|
|
@@ -1833,8 +1833,8 @@ async function za(e, t) {
|
|
|
1833
1833
|
}
|
|
1834
1834
|
}
|
|
1835
1835
|
D.command("qa-pull").alias("qp").description("将禅道中的模块或者用例同步到本地").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "type=case时,可传指定用例ID(可传N个,逗号隔开);不传则为产品下全部用例").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(za, ...e));
|
|
1836
|
-
async function
|
|
1837
|
-
let n = await
|
|
1836
|
+
async function Ba(e, t, i) {
|
|
1837
|
+
let n = await F({
|
|
1838
1838
|
message: "请输入你要创建的用例的前置条件(可不填)"
|
|
1839
1839
|
});
|
|
1840
1840
|
n = n.trim();
|
|
@@ -1865,7 +1865,7 @@ async function _a(e, t, i) {
|
|
|
1865
1865
|
o
|
|
1866
1866
|
), a.succeed(`用例【[${o}】创建完成 🎉`), o);
|
|
1867
1867
|
}
|
|
1868
|
-
async function
|
|
1868
|
+
async function Ja(e, t, i) {
|
|
1869
1869
|
const n = w(`模块【${i}】开始创建...`).start();
|
|
1870
1870
|
n.text = "远程模块创建中...";
|
|
1871
1871
|
const a = await Ui({
|
|
@@ -1882,7 +1882,7 @@ async function Ba(e, t, i) {
|
|
|
1882
1882
|
recursive: !0
|
|
1883
1883
|
}), n.succeed(`模块【${s}】创建完成 🎉`);
|
|
1884
1884
|
}
|
|
1885
|
-
function
|
|
1885
|
+
function Fa(e) {
|
|
1886
1886
|
function t(n) {
|
|
1887
1887
|
if (!n.children || n.children.length === 0) return;
|
|
1888
1888
|
const a = n.children[0];
|
|
@@ -1906,18 +1906,18 @@ function Ja(e) {
|
|
|
1906
1906
|
}
|
|
1907
1907
|
return i(e);
|
|
1908
1908
|
}
|
|
1909
|
-
async function
|
|
1910
|
-
const { type: i, typeStr: n } = await
|
|
1909
|
+
async function _a(e, t) {
|
|
1910
|
+
const { type: i, typeStr: n } = await je("创建", e), { product: a, localProduct: s } = await Se(t.productId), o = await st(a.id), r = await Fa(o), c = W("module", r.label, String(r.value)), d = (await X(a.path, { hasRoot: !0 })).find((h) => h.name === c);
|
|
1911
1911
|
if (!d?.path || !v(d.path))
|
|
1912
1912
|
return l(`本地不存在${c}模块`);
|
|
1913
|
-
let f = await
|
|
1913
|
+
let f = await F({
|
|
1914
1914
|
message: `请输入你要创建的${n}名称`,
|
|
1915
1915
|
required: !0,
|
|
1916
1916
|
validate: (h) => h.length > 0 && h.length < 255
|
|
1917
1917
|
});
|
|
1918
1918
|
f = f.trim();
|
|
1919
1919
|
let g = "";
|
|
1920
|
-
if (R.MODULE === i && await
|
|
1920
|
+
if (R.MODULE === i && await Ja(s, d, f), R.CASE === i && (g = await Ba(s, d, f)), !t.disableAutoCommit && R.CASE === i) {
|
|
1921
1921
|
const h = w("代码提交中...").start();
|
|
1922
1922
|
try {
|
|
1923
1923
|
await p(`git add . && git commit -m "chore: 创建了用例${m.basename(g)}"`), h.succeed("代码已提交 ✅");
|
|
@@ -1926,7 +1926,7 @@ async function Fa(e, t) {
|
|
|
1926
1926
|
}
|
|
1927
1927
|
}
|
|
1928
1928
|
}
|
|
1929
|
-
D.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(
|
|
1929
|
+
D.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(_a, ...e));
|
|
1930
1930
|
async function Ua(e, t) {
|
|
1931
1931
|
const n = (await X(e.path)).filter((r) => r.type === "case");
|
|
1932
1932
|
let a = [];
|
|
@@ -1999,7 +1999,7 @@ async function Ga(e, t) {
|
|
|
1999
1999
|
return s.succeed("模块删除完成"), o;
|
|
2000
2000
|
}
|
|
2001
2001
|
async function Va(e, t) {
|
|
2002
|
-
const { type: i, typeStr: n } = await
|
|
2002
|
+
const { type: i, typeStr: n } = await je("删除", e), { localProduct: a } = await Se(t.productId), s = Pe(t.targetIds);
|
|
2003
2003
|
let o = [];
|
|
2004
2004
|
if (R.MODULE === i ? o = await Ga(a, s) : R.CASE === i && (o = await Ua(a, s)), !t.disableAutoCommit && await p("git status -s")) {
|
|
2005
2005
|
const r = w("代码提交中...").start();
|
|
@@ -2037,7 +2037,7 @@ async function Wa(e, t) {
|
|
|
2037
2037
|
}
|
|
2038
2038
|
});
|
|
2039
2039
|
}
|
|
2040
|
-
let s = await
|
|
2040
|
+
let s = await F({
|
|
2041
2041
|
message: "修改用例名称",
|
|
2042
2042
|
default: a.displayName,
|
|
2043
2043
|
required: !0,
|
|
@@ -2079,7 +2079,7 @@ async function Wa(e, t) {
|
|
|
2079
2079
|
{ spaces: 2 }
|
|
2080
2080
|
), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = I.readJsonSync(m.join(a.path, "config.json"));
|
|
2081
2081
|
let d;
|
|
2082
|
-
t.casePrecondition ? d = t.casePrecondition : (d = await
|
|
2082
|
+
t.casePrecondition ? d = t.casePrecondition : (d = await F({
|
|
2083
2083
|
message: "修改用例前置条件",
|
|
2084
2084
|
default: r.precondition,
|
|
2085
2085
|
prefill: "editable"
|
|
@@ -2123,7 +2123,7 @@ async function qa(e, t) {
|
|
|
2123
2123
|
}
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
|
-
let s = await
|
|
2126
|
+
let s = await F({
|
|
2127
2127
|
message: "修改模块名称",
|
|
2128
2128
|
default: a.displayName,
|
|
2129
2129
|
required: !0,
|
|
@@ -2138,7 +2138,7 @@ async function qa(e, t) {
|
|
|
2138
2138
|
}), await we(a.path, s, "module", String(a.id)) && o.succeed(`模块重命名成功: ${a.displayName} -> ${s}`)) : o.succeed("模块名称无变动"), a.id;
|
|
2139
2139
|
}
|
|
2140
2140
|
async function Ha(e, t) {
|
|
2141
|
-
const { type: i, typeStr: n } = await
|
|
2141
|
+
const { type: i, typeStr: n } = await je("修改", e), { localProduct: a } = await Se(t.productId);
|
|
2142
2142
|
let s;
|
|
2143
2143
|
if (R.MODULE === i ? s = await qa(a, t) : R.CASE === i && (s = await Wa(a, t)), !t.disableAutoCommit && await p("git status -s")) {
|
|
2144
2144
|
const o = w("代码提交中...").start();
|
|
@@ -2172,7 +2172,7 @@ async function Za(e, t) {
|
|
|
2172
2172
|
}
|
|
2173
2173
|
async function Ka(e) {
|
|
2174
2174
|
ne(), Q();
|
|
2175
|
-
const { localProduct: t } = await
|
|
2175
|
+
const { localProduct: t } = await Se(e.productId);
|
|
2176
2176
|
let i = [];
|
|
2177
2177
|
const a = (await X(t.path)).filter((c) => c.type === "case");
|
|
2178
2178
|
if (e.all)
|
|
@@ -2282,7 +2282,7 @@ async function Xa() {
|
|
|
2282
2282
|
n = await Promise.race([
|
|
2283
2283
|
s,
|
|
2284
2284
|
p(`npm view ${ie.name} version --registry https://registry.npmmirror.com/`)
|
|
2285
|
-
]), n !== a && n !== ie.version && (console.log(`${
|
|
2285
|
+
]), n !== a && n !== ie.version && (console.log(`${S.blue(ie.name)}本地版本为${ie.version},低于线上版本${n},开始升级`), await pt(n)), ue("latestCheckVersionTimestamp", Date.now()), se();
|
|
2286
2286
|
} catch (a) {
|
|
2287
2287
|
console.log("升级出错!请重试,或者手动升级"), l(a);
|
|
2288
2288
|
}
|
|
@@ -2300,5 +2300,5 @@ async function Qa() {
|
|
|
2300
2300
|
async function en() {
|
|
2301
2301
|
Ya(), await Qa();
|
|
2302
2302
|
}
|
|
2303
|
-
D.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${
|
|
2303
|
+
D.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${S.blue(He)}`).usage("<command> [options]").hook("preAction", en).version(ie.version, "-v, --version", "当前版本号").helpOption("-h, --help", "帮助").showHelpAfterError("可以使用z -h查看帮助。");
|
|
2304
2304
|
D.parse();
|