cli-z-develop 0.12.0 → 0.12.2
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 +124 -122
- 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.2", 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,27 @@ async function ga() {
|
|
|
1059
1060
|
}
|
|
1060
1061
|
})) : [];
|
|
1061
1062
|
}
|
|
1062
|
-
async function
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
type: "commit-message",
|
|
1063
|
+
async function Fe(e) {
|
|
1064
|
+
const t = await p("git diff HEAD");
|
|
1065
|
+
t || l("git暂存区没有内容,请先git add添加文件到暂存区");
|
|
1066
|
+
const i = await ia({
|
|
1067
|
+
type: "commit-message-v2",
|
|
1067
1068
|
input: t
|
|
1068
1069
|
// modelName: "qwen-turbo",
|
|
1069
1070
|
});
|
|
1071
|
+
return e + i;
|
|
1070
1072
|
}
|
|
1071
1073
|
async function Ee(e, t, i) {
|
|
1072
1074
|
const n = w("🤖 生成提交信息中...").start();
|
|
1073
1075
|
let a = "", s = !0;
|
|
1074
|
-
if ([
|
|
1076
|
+
if ([j.FEAT, j.FIX, j.REFACTOR].includes(e)) {
|
|
1075
1077
|
const o = t.map((r) => r.value).join(",");
|
|
1076
|
-
if (i || (a = await
|
|
1078
|
+
if (i || (a = await Fe(`${e}(${o}): `)), !a) {
|
|
1077
1079
|
const r = t.map((c) => c.name).join(";");
|
|
1078
1080
|
a = `${e}(${o}): ${r}`, s = !1;
|
|
1079
1081
|
}
|
|
1080
1082
|
}
|
|
1081
|
-
e ===
|
|
1083
|
+
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
1084
|
}
|
|
1083
1085
|
async function ha(e) {
|
|
1084
1086
|
const t = await T({
|
|
@@ -1086,23 +1088,23 @@ async function ha(e) {
|
|
|
1086
1088
|
choices: [
|
|
1087
1089
|
{
|
|
1088
1090
|
name: "feat - 业务需求/功能开发/BUG修复",
|
|
1089
|
-
value:
|
|
1091
|
+
value: j.FEAT
|
|
1090
1092
|
},
|
|
1091
1093
|
{
|
|
1092
1094
|
name: "fix - bug修复",
|
|
1093
|
-
value:
|
|
1095
|
+
value: j.FIX
|
|
1094
1096
|
},
|
|
1095
1097
|
{
|
|
1096
1098
|
name: "refactor - 技术重构/性能优化/代码规范",
|
|
1097
|
-
value:
|
|
1099
|
+
value: j.REFACTOR
|
|
1098
1100
|
},
|
|
1099
1101
|
{
|
|
1100
1102
|
name: "chore - 其他",
|
|
1101
|
-
value:
|
|
1103
|
+
value: j.CHORE
|
|
1102
1104
|
}
|
|
1103
1105
|
]
|
|
1104
1106
|
});
|
|
1105
|
-
if ([
|
|
1107
|
+
if ([j.FEAT, j.REFACTOR].includes(t)) {
|
|
1106
1108
|
const i = await fa();
|
|
1107
1109
|
if (!i.length)
|
|
1108
1110
|
return V("🤷 暂无开发任务");
|
|
@@ -1115,9 +1117,9 @@ async function ha(e) {
|
|
|
1115
1117
|
})),
|
|
1116
1118
|
pageSize: i.length
|
|
1117
1119
|
});
|
|
1118
|
-
await Ee(
|
|
1120
|
+
await Ee(j.FEAT, n, e);
|
|
1119
1121
|
}
|
|
1120
|
-
if (t ===
|
|
1122
|
+
if (t === j.FIX) {
|
|
1121
1123
|
const i = await ga();
|
|
1122
1124
|
if (!i.length)
|
|
1123
1125
|
return V("🤷 暂无BUG");
|
|
@@ -1130,14 +1132,14 @@ async function ha(e) {
|
|
|
1130
1132
|
})),
|
|
1131
1133
|
pageSize: i.length
|
|
1132
1134
|
});
|
|
1133
|
-
await Ee(
|
|
1135
|
+
await Ee(j.FIX, n, e);
|
|
1134
1136
|
}
|
|
1135
|
-
if (t ===
|
|
1137
|
+
if (t === j.CHORE) {
|
|
1136
1138
|
let i = "";
|
|
1137
|
-
e && (i = await
|
|
1139
|
+
e && (i = await F({
|
|
1138
1140
|
message: "请输入commit msg:",
|
|
1139
1141
|
validate: (n) => n.length === 0 ? "请输入commit msg" : !0
|
|
1140
|
-
}), i = i.trim()), await Ee(
|
|
1142
|
+
}), i = i.trim()), await Ee(j.CHORE, i);
|
|
1141
1143
|
}
|
|
1142
1144
|
process.exit(0);
|
|
1143
1145
|
}
|
|
@@ -1170,17 +1172,17 @@ async function wa() {
|
|
|
1170
1172
|
name: O.find((H) => H.id === te)?.name
|
|
1171
1173
|
};
|
|
1172
1174
|
}, n = async () => {
|
|
1173
|
-
e.projectName = await
|
|
1175
|
+
e.projectName = await F({
|
|
1174
1176
|
message: "请输入项目名称",
|
|
1175
1177
|
validate: (O) => la(O, e.group?.name || "")
|
|
1176
|
-
}), e.projectName = e.projectName.trim(), e.projectDesc = await
|
|
1178
|
+
}), e.projectName = e.projectName.trim(), e.projectDesc = await F({
|
|
1177
1179
|
message: "请输入项目描述",
|
|
1178
1180
|
validate: pa
|
|
1179
1181
|
}), e.projectDesc = e.projectDesc.trim();
|
|
1180
1182
|
};
|
|
1181
1183
|
await t(), await i(), await n();
|
|
1182
1184
|
const a = `${fe}/${e.group?.name}/${e.projectName}.git`, s = w("模版初始化中").start();
|
|
1183
|
-
await p(`git clone --depth=1 ${e.tplUrl}`), await
|
|
1185
|
+
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
1186
|
const o = Ae();
|
|
1185
1187
|
li({
|
|
1186
1188
|
...o,
|
|
@@ -1202,7 +1204,7 @@ async function wa() {
|
|
|
1202
1204
|
visibility: "private",
|
|
1203
1205
|
namespace_id: e.group?.id
|
|
1204
1206
|
});
|
|
1205
|
-
await p(`git push -u origin ${y.MASTER}`), await p(`git push origin HEAD:${y.MASTER} --tags`), c.succeed(`项目已推送到远程,地址: ${
|
|
1207
|
+
await p(`git push -u origin ${y.MASTER}`), await p(`git push origin HEAD:${y.MASTER} --tags`), c.succeed(`项目已推送到远程,地址: ${S.blue(a)}`);
|
|
1206
1208
|
const d = w("初始化分支中").start(), f = `feat_init_${tt()}`, g = [y.DEV, y.TEST, y.RELEASE, f], h = await Promise.allSettled(
|
|
1207
1209
|
g.map(
|
|
1208
1210
|
(O) => Li({
|
|
@@ -1214,9 +1216,9 @@ async function wa() {
|
|
|
1214
1216
|
), E = [];
|
|
1215
1217
|
h.forEach(({ status: O }, te) => {
|
|
1216
1218
|
O === "fulfilled" && E.push(g[te]);
|
|
1217
|
-
}), await p("git pull"), E.includes(f) ? (await p(`git checkout -b ${f} origin/${f}`), d.succeed(`项目已切换到初始分支: ${
|
|
1219
|
+
}), await p("git pull"), E.includes(f) ? (await p(`git checkout -b ${f} origin/${f}`), d.succeed(`项目已切换到初始分支: ${S.blue(f)}`)) : d.warn("开发分支检出失败!项目当前在主分支,请自行检出开发分支。");
|
|
1218
1220
|
const ee = `cd ${e.projectName} && z start`;
|
|
1219
|
-
console.log(`输入 ${
|
|
1221
|
+
console.log(`输入 ${S.green(ee)} 开始开发吧~`), process.exit(0);
|
|
1220
1222
|
} catch (e) {
|
|
1221
1223
|
l(e);
|
|
1222
1224
|
}
|
|
@@ -1254,7 +1256,7 @@ async function ya(e, t) {
|
|
|
1254
1256
|
/* Project */
|
|
1255
1257
|
}
|
|
1256
1258
|
]
|
|
1257
|
-
}), i === "project" ? await wa() : (ne(), Q(), i === "branch" ? (await pe(), await da(t)) : i === "commit-msg" && (await p("git status -s") ? await ha(t.commitMessageCloseAi) : l("
|
|
1259
|
+
}), i === "project" ? await wa() : (ne(), Q(), i === "branch" ? (await pe(), await da(t)) : i === "commit-msg" && (await p("git status -s") ? await ha(t.commitMessageCloseAi) : l("没有要变动的文件,无法生成提交信息")));
|
|
1258
1260
|
}
|
|
1259
1261
|
D.command("create").alias("c").description("创建项目/分支/提交信息").argument("[type]", "可选值为project|pr, branch|b, commit-msg|cm").option("--branch-type <type>", `分支类型。可选值:${Object.values(de).join(", ")}`).option("--branch-purpose <purpose>", "创建分支的目的").option("--commit-message-close-ai", "创建提交信息时,是否关闭AI生成").action((...e) => z(ya, ...e));
|
|
1260
1262
|
function $a(e) {
|
|
@@ -1284,7 +1286,7 @@ async function va(e) {
|
|
|
1284
1286
|
]
|
|
1285
1287
|
}
|
|
1286
1288
|
}), 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中查看 ${
|
|
1289
|
+
t.succeed("部署任务创建完成"), console.log(`如有需要,可在k8s中查看 ${S.blue(c)}`), process.exit(0);
|
|
1288
1290
|
} catch (o) {
|
|
1289
1291
|
t.fail("部署任务创建失败"), l(o);
|
|
1290
1292
|
}
|
|
@@ -1405,7 +1407,7 @@ async function ba(e, t) {
|
|
|
1405
1407
|
);
|
|
1406
1408
|
if (s || l(`分支${e.sourceBranch}上不存在新的commit,不需要合并。`), await p(
|
|
1407
1409
|
`git branch --contains ${n} -r ${i}`
|
|
1408
|
-
) || (console.log(
|
|
1410
|
+
) || (console.log(S.yellow("注意:当前分支上不存在远程主分支最新代码,将在自动合入后继续。")), await lt(y.MASTER, e.sourceBranch, e)), t === y.MASTER) {
|
|
1409
1411
|
const r = s.split(`
|
|
1410
1412
|
`).filter((f) => f), c = await p(`git log -b origin/${b.TEST} -1 --format=%H`), d = (await p(
|
|
1411
1413
|
`git log ${n}...${c} -b origin/${b.TEST}`
|
|
@@ -1420,7 +1422,7 @@ async function Aa(e, t) {
|
|
|
1420
1422
|
Object.values(y).includes(i.sourceBranch) && l(`当前分支${i.sourceBranch}不可作为源分支合并到目标分支。`);
|
|
1421
1423
|
const a = (await Pi(i.id)).filter((c) => ![i.sourceBranch].includes(c.name)).map((c) => {
|
|
1422
1424
|
let u = c.name;
|
|
1423
|
-
return Object.values(y).includes(u) && (u =
|
|
1425
|
+
return Object.values(y).includes(u) && (u = S.bold.blue(u)), {
|
|
1424
1426
|
name: u,
|
|
1425
1427
|
value: c.name
|
|
1426
1428
|
};
|
|
@@ -1449,7 +1451,7 @@ async function Aa(e, t) {
|
|
|
1449
1451
|
}
|
|
1450
1452
|
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
1453
|
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
|
|
1454
|
+
async function ja() {
|
|
1453
1455
|
try {
|
|
1454
1456
|
await p("java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml .", {
|
|
1455
1457
|
silent: !1
|
|
@@ -1458,7 +1460,7 @@ async function Sa() {
|
|
|
1458
1460
|
l("checkstyle执行出错"), process.exit(1);
|
|
1459
1461
|
}
|
|
1460
1462
|
}
|
|
1461
|
-
function
|
|
1463
|
+
function Sa() {
|
|
1462
1464
|
const e = me();
|
|
1463
1465
|
if (e["lint-staged"])
|
|
1464
1466
|
return e["lint-staged"];
|
|
@@ -1469,7 +1471,7 @@ async function Ta() {
|
|
|
1469
1471
|
await kt({
|
|
1470
1472
|
concurrent: 4,
|
|
1471
1473
|
debug: !1,
|
|
1472
|
-
config:
|
|
1474
|
+
config: Sa(),
|
|
1473
1475
|
quiet: !0,
|
|
1474
1476
|
relative: !0
|
|
1475
1477
|
}) ? (e.succeed("代码风格检测通过!"), process.exit(0)) : (e.fail("代码风格检测未通过!"), process.exit(1));
|
|
@@ -1481,7 +1483,7 @@ function Ea(e) {
|
|
|
1481
1483
|
if (t.length === 1)
|
|
1482
1484
|
return "body前缺少「: 」";
|
|
1483
1485
|
const i = t[0];
|
|
1484
|
-
return /^(feat|fix|refactor)/.test(i) ? /\(\d+(?:,\d+)*\)/.test(i) ? !0 : "ID缺少或者格式不正确。" : /^(chore|ci)/.test(i) ? [
|
|
1486
|
+
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
1487
|
}
|
|
1486
1488
|
async function ka() {
|
|
1487
1489
|
const e = await ke(m.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = w("提交信息格式校验中...").start(), i = Ea(e);
|
|
@@ -1602,7 +1604,7 @@ async function Da(e, t) {
|
|
|
1602
1604
|
choices: a
|
|
1603
1605
|
});
|
|
1604
1606
|
}
|
|
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
|
|
1607
|
+
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
1608
|
}
|
|
1607
1609
|
D.command("run").alias("r").description("执行 eslint / prettier / type-check / dependency-check / checkstyle。").argument(
|
|
1608
1610
|
"[type]",
|
|
@@ -1699,7 +1701,7 @@ async function we(e, t, i, n) {
|
|
|
1699
1701
|
if (a === s)
|
|
1700
1702
|
return !0;
|
|
1701
1703
|
const o = m.dirname(e), r = m.join(o, s);
|
|
1702
|
-
return await Kt(e) ? await
|
|
1704
|
+
return await Kt(e) ? await _e(e, r) : (await p(`git mv "${e}" "${r}"`), await p("git add .")), !0;
|
|
1703
1705
|
} catch (a) {
|
|
1704
1706
|
return l(`重命名文件夹失败: ${e} -> ${t}。${a}`), !1;
|
|
1705
1707
|
}
|
|
@@ -1726,7 +1728,7 @@ async function gt(e) {
|
|
|
1726
1728
|
if (e)
|
|
1727
1729
|
Number.isNaN(Number(e)) && l("请输入正确的产品ID"), t.id = Number(e);
|
|
1728
1730
|
else {
|
|
1729
|
-
const i = await
|
|
1731
|
+
const i = await Bi();
|
|
1730
1732
|
t.id = await T({
|
|
1731
1733
|
message: "请选择产品",
|
|
1732
1734
|
choices: i.map((n) => ({
|
|
@@ -1735,7 +1737,7 @@ async function gt(e) {
|
|
|
1735
1737
|
}))
|
|
1736
1738
|
});
|
|
1737
1739
|
}
|
|
1738
|
-
return t.name = await
|
|
1740
|
+
return t.name = await Ji(t.id), t.path = m.join(mt, W("module", t.name, String(t.id))), t;
|
|
1739
1741
|
}
|
|
1740
1742
|
async function Le(e) {
|
|
1741
1743
|
return (await ft(mt)).find((i) => Number(i.id) === e.id);
|
|
@@ -1746,7 +1748,7 @@ async function ht(e, t) {
|
|
|
1746
1748
|
priority: e.pri,
|
|
1747
1749
|
steps: []
|
|
1748
1750
|
};
|
|
1749
|
-
i.steps = await
|
|
1751
|
+
i.steps = await _i(e.id), I.writeJSONSync(t, i, {
|
|
1750
1752
|
spaces: 2
|
|
1751
1753
|
});
|
|
1752
1754
|
}
|
|
@@ -1771,12 +1773,12 @@ function Pe(e) {
|
|
|
1771
1773
|
}
|
|
1772
1774
|
return [];
|
|
1773
1775
|
}
|
|
1774
|
-
async function
|
|
1776
|
+
async function je(e, t) {
|
|
1775
1777
|
ne(), Q(), await pe();
|
|
1776
1778
|
let i;
|
|
1777
1779
|
t ? ([R.MODULE, R.CASE].includes(t) || l(`不支持的参数${t}。参数值应为 ${R.MODULE} 或者 ${R.CASE}。`), i = t) : i = await T({
|
|
1778
1780
|
message: `请选择要${e}的数据类型`,
|
|
1779
|
-
choices:
|
|
1781
|
+
choices: Bt
|
|
1780
1782
|
});
|
|
1781
1783
|
const n = i === R.MODULE ? "模块" : R.CASE === i ? "用例" : "";
|
|
1782
1784
|
return {
|
|
@@ -1784,7 +1786,7 @@ async function Se(e, t) {
|
|
|
1784
1786
|
typeStr: n
|
|
1785
1787
|
};
|
|
1786
1788
|
}
|
|
1787
|
-
async function
|
|
1789
|
+
async function Se(e) {
|
|
1788
1790
|
const t = await gt(e), i = await Le(t);
|
|
1789
1791
|
return i || l(`本地未找到产品【${t.name}[${t.id}]】`), {
|
|
1790
1792
|
product: t,
|
|
@@ -1796,7 +1798,7 @@ async function Oa(e, t, i) {
|
|
|
1796
1798
|
const a = Pe(i);
|
|
1797
1799
|
let s = await X(t.path);
|
|
1798
1800
|
e.text = "获取远程用例列表...";
|
|
1799
|
-
const o = await
|
|
1801
|
+
const o = await Fi(t.id, a);
|
|
1800
1802
|
e.text = "本地用例同步中...";
|
|
1801
1803
|
for (const r of o) {
|
|
1802
1804
|
let c;
|
|
@@ -1822,7 +1824,7 @@ async function Ma(e, t) {
|
|
|
1822
1824
|
e.text = "本地同步模块中...", await Pa(n || [], t.path);
|
|
1823
1825
|
}
|
|
1824
1826
|
async function za(e, t) {
|
|
1825
|
-
const { type: i, typeStr: n } = await
|
|
1827
|
+
const { type: i, typeStr: n } = await je("拉取", e), a = await gt(t.productId), s = w(`${n}同步中...`).start();
|
|
1826
1828
|
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
1829
|
const o = w("代码提交中...").start();
|
|
1828
1830
|
try {
|
|
@@ -1833,8 +1835,8 @@ async function za(e, t) {
|
|
|
1833
1835
|
}
|
|
1834
1836
|
}
|
|
1835
1837
|
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
|
|
1838
|
+
async function Ba(e, t, i) {
|
|
1839
|
+
let n = await F({
|
|
1838
1840
|
message: "请输入你要创建的用例的前置条件(可不填)"
|
|
1839
1841
|
});
|
|
1840
1842
|
n = n.trim();
|
|
@@ -1865,7 +1867,7 @@ async function _a(e, t, i) {
|
|
|
1865
1867
|
o
|
|
1866
1868
|
), a.succeed(`用例【[${o}】创建完成 🎉`), o);
|
|
1867
1869
|
}
|
|
1868
|
-
async function
|
|
1870
|
+
async function Ja(e, t, i) {
|
|
1869
1871
|
const n = w(`模块【${i}】开始创建...`).start();
|
|
1870
1872
|
n.text = "远程模块创建中...";
|
|
1871
1873
|
const a = await Ui({
|
|
@@ -1882,7 +1884,7 @@ async function Ba(e, t, i) {
|
|
|
1882
1884
|
recursive: !0
|
|
1883
1885
|
}), n.succeed(`模块【${s}】创建完成 🎉`);
|
|
1884
1886
|
}
|
|
1885
|
-
function
|
|
1887
|
+
function Fa(e) {
|
|
1886
1888
|
function t(n) {
|
|
1887
1889
|
if (!n.children || n.children.length === 0) return;
|
|
1888
1890
|
const a = n.children[0];
|
|
@@ -1906,18 +1908,18 @@ function Ja(e) {
|
|
|
1906
1908
|
}
|
|
1907
1909
|
return i(e);
|
|
1908
1910
|
}
|
|
1909
|
-
async function
|
|
1910
|
-
const { type: i, typeStr: n } = await
|
|
1911
|
+
async function _a(e, t) {
|
|
1912
|
+
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
1913
|
if (!d?.path || !v(d.path))
|
|
1912
1914
|
return l(`本地不存在${c}模块`);
|
|
1913
|
-
let f = await
|
|
1915
|
+
let f = await F({
|
|
1914
1916
|
message: `请输入你要创建的${n}名称`,
|
|
1915
1917
|
required: !0,
|
|
1916
1918
|
validate: (h) => h.length > 0 && h.length < 255
|
|
1917
1919
|
});
|
|
1918
1920
|
f = f.trim();
|
|
1919
1921
|
let g = "";
|
|
1920
|
-
if (R.MODULE === i && await
|
|
1922
|
+
if (R.MODULE === i && await Ja(s, d, f), R.CASE === i && (g = await Ba(s, d, f)), !t.disableAutoCommit && R.CASE === i) {
|
|
1921
1923
|
const h = w("代码提交中...").start();
|
|
1922
1924
|
try {
|
|
1923
1925
|
await p(`git add . && git commit -m "chore: 创建了用例${m.basename(g)}"`), h.succeed("代码已提交 ✅");
|
|
@@ -1926,7 +1928,7 @@ async function Fa(e, t) {
|
|
|
1926
1928
|
}
|
|
1927
1929
|
}
|
|
1928
1930
|
}
|
|
1929
|
-
D.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(
|
|
1931
|
+
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
1932
|
async function Ua(e, t) {
|
|
1931
1933
|
const n = (await X(e.path)).filter((r) => r.type === "case");
|
|
1932
1934
|
let a = [];
|
|
@@ -1999,7 +2001,7 @@ async function Ga(e, t) {
|
|
|
1999
2001
|
return s.succeed("模块删除完成"), o;
|
|
2000
2002
|
}
|
|
2001
2003
|
async function Va(e, t) {
|
|
2002
|
-
const { type: i, typeStr: n } = await
|
|
2004
|
+
const { type: i, typeStr: n } = await je("删除", e), { localProduct: a } = await Se(t.productId), s = Pe(t.targetIds);
|
|
2003
2005
|
let o = [];
|
|
2004
2006
|
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
2007
|
const r = w("代码提交中...").start();
|
|
@@ -2037,7 +2039,7 @@ async function Wa(e, t) {
|
|
|
2037
2039
|
}
|
|
2038
2040
|
});
|
|
2039
2041
|
}
|
|
2040
|
-
let s = await
|
|
2042
|
+
let s = await F({
|
|
2041
2043
|
message: "修改用例名称",
|
|
2042
2044
|
default: a.displayName,
|
|
2043
2045
|
required: !0,
|
|
@@ -2079,7 +2081,7 @@ async function Wa(e, t) {
|
|
|
2079
2081
|
{ spaces: 2 }
|
|
2080
2082
|
), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = I.readJsonSync(m.join(a.path, "config.json"));
|
|
2081
2083
|
let d;
|
|
2082
|
-
t.casePrecondition ? d = t.casePrecondition : (d = await
|
|
2084
|
+
t.casePrecondition ? d = t.casePrecondition : (d = await F({
|
|
2083
2085
|
message: "修改用例前置条件",
|
|
2084
2086
|
default: r.precondition,
|
|
2085
2087
|
prefill: "editable"
|
|
@@ -2123,7 +2125,7 @@ async function qa(e, t) {
|
|
|
2123
2125
|
}
|
|
2124
2126
|
});
|
|
2125
2127
|
}
|
|
2126
|
-
let s = await
|
|
2128
|
+
let s = await F({
|
|
2127
2129
|
message: "修改模块名称",
|
|
2128
2130
|
default: a.displayName,
|
|
2129
2131
|
required: !0,
|
|
@@ -2138,7 +2140,7 @@ async function qa(e, t) {
|
|
|
2138
2140
|
}), await we(a.path, s, "module", String(a.id)) && o.succeed(`模块重命名成功: ${a.displayName} -> ${s}`)) : o.succeed("模块名称无变动"), a.id;
|
|
2139
2141
|
}
|
|
2140
2142
|
async function Ha(e, t) {
|
|
2141
|
-
const { type: i, typeStr: n } = await
|
|
2143
|
+
const { type: i, typeStr: n } = await je("修改", e), { localProduct: a } = await Se(t.productId);
|
|
2142
2144
|
let s;
|
|
2143
2145
|
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
2146
|
const o = w("代码提交中...").start();
|
|
@@ -2172,7 +2174,7 @@ async function Za(e, t) {
|
|
|
2172
2174
|
}
|
|
2173
2175
|
async function Ka(e) {
|
|
2174
2176
|
ne(), Q();
|
|
2175
|
-
const { localProduct: t } = await
|
|
2177
|
+
const { localProduct: t } = await Se(e.productId);
|
|
2176
2178
|
let i = [];
|
|
2177
2179
|
const a = (await X(t.path)).filter((c) => c.type === "case");
|
|
2178
2180
|
if (e.all)
|
|
@@ -2282,7 +2284,7 @@ async function Xa() {
|
|
|
2282
2284
|
n = await Promise.race([
|
|
2283
2285
|
s,
|
|
2284
2286
|
p(`npm view ${ie.name} version --registry https://registry.npmmirror.com/`)
|
|
2285
|
-
]), n !== a && n !== ie.version && (console.log(`${
|
|
2287
|
+
]), n !== a && n !== ie.version && (console.log(`${S.blue(ie.name)}本地版本为${ie.version},低于线上版本${n},开始升级`), await pt(n)), ue("latestCheckVersionTimestamp", Date.now()), se();
|
|
2286
2288
|
} catch (a) {
|
|
2287
2289
|
console.log("升级出错!请重试,或者手动升级"), l(a);
|
|
2288
2290
|
}
|
|
@@ -2300,5 +2302,5 @@ async function Qa() {
|
|
|
2300
2302
|
async function en() {
|
|
2301
2303
|
Ya(), await Qa();
|
|
2302
2304
|
}
|
|
2303
|
-
D.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${
|
|
2305
|
+
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
2306
|
D.parse();
|