cli-z-develop 0.16.0 → 0.16.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 +57 -57
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,9 +9,9 @@ import ra from "dayjs";
|
|
|
9
9
|
import N from "shelljs";
|
|
10
10
|
import oa, { tmpdir as ca } from "node:os";
|
|
11
11
|
import et from "child_process";
|
|
12
|
-
import { confirm as
|
|
12
|
+
import { confirm as Le, select as k, input as F, password as la, checkbox as Re, number as tt } from "@inquirer/prompts";
|
|
13
13
|
import y from "ora";
|
|
14
|
-
import
|
|
14
|
+
import L from "fs-extra";
|
|
15
15
|
import ua from "open";
|
|
16
16
|
import { select as W } from "inquirer-select-pro";
|
|
17
17
|
import pa from "lint-staged";
|
|
@@ -73,7 +73,7 @@ const ja = {
|
|
|
73
73
|
}, Ae = "http://git.cxlqd.com", ka = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
|
|
74
74
|
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 || {});
|
|
75
75
|
const Ea = "fe-biz7tvsd", At = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
|
|
76
|
-
var
|
|
76
|
+
var C = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(C || {});
|
|
77
77
|
const Ia = [
|
|
78
78
|
{
|
|
79
79
|
name: "模块",
|
|
@@ -85,7 +85,7 @@ const Ia = [
|
|
|
85
85
|
value: "case"
|
|
86
86
|
/* CASE */
|
|
87
87
|
}
|
|
88
|
-
], Ra = 150 * 1024, at = 0.8 * 1024 * 1024, _e = ",",
|
|
88
|
+
], Ra = 150 * 1024, at = 0.8 * 1024 * 1024, _e = ",", Ca = ".z", La = "develop-config.json", K = ".z", xa = ".commit-msg-tpl", Pa = "project.json";
|
|
89
89
|
function x(e = "") {
|
|
90
90
|
return f.join(K, e);
|
|
91
91
|
}
|
|
@@ -99,10 +99,10 @@ function St() {
|
|
|
99
99
|
et.spawnSync("git", ["config", "core.hooksPath", x()]), et.spawnSync("git", ["config", "commit.template", Se()]);
|
|
100
100
|
}
|
|
101
101
|
function Ne(e = "") {
|
|
102
|
-
return f.resolve(oa.homedir(),
|
|
102
|
+
return f.resolve(oa.homedir(), Ca, e);
|
|
103
103
|
}
|
|
104
104
|
function xe() {
|
|
105
|
-
return Ne(
|
|
105
|
+
return Ne(La);
|
|
106
106
|
}
|
|
107
107
|
function Da() {
|
|
108
108
|
return T(Ne());
|
|
@@ -274,7 +274,7 @@ const Ga = {
|
|
|
274
274
|
"**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix",
|
|
275
275
|
"**/*.md": "markdownlint --fix"
|
|
276
276
|
}
|
|
277
|
-
}, Ua = "cli-z-develop", Va = "0.16.
|
|
277
|
+
}, Ua = "cli-z-develop", Va = "0.16.1", Wa = "技术团队开发流程管理工具", Ha = "dist/index.js", qa = { z: "bin/z.js", "z-develop": "bin/z.js" }, Za = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", test: "bun src/main.ts", "test:debug": "DEBUG=true bun src/main.ts", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", "build:w": "vite build --watch", 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" }, Ka = "module", Ya = "z", Xa = { "@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" }, Qa = { "@inquirer/prompts": "^8.4.1", "@lonely9/api-generate": "^0.2.13", axios: "^1.15.0", chalk: "^5.6.2", "cli-highlight": "^2.1.11", commander: "^14.0.3", dayjs: "^1.11.20", eslint: "^9.39.2", "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", open: "^11.0.2", ora: "^9.3.0", "p-limit": "^7.3.0", prettier: "^3.8.2", semver: "^7.7.4", shelljs: "^0.10.0" }, ce = {
|
|
278
278
|
name: Ua,
|
|
279
279
|
version: Va,
|
|
280
280
|
description: Wa,
|
|
@@ -333,7 +333,7 @@ function We() {
|
|
|
333
333
|
if (q)
|
|
334
334
|
return q;
|
|
335
335
|
const e = f.join("package.json");
|
|
336
|
-
return T(e) || m(`当前目录(${N.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), q =
|
|
336
|
+
return T(e) || m(`当前目录(${N.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), q = L.readJsonSync(e), q;
|
|
337
337
|
}
|
|
338
338
|
function V() {
|
|
339
339
|
if (Z)
|
|
@@ -341,19 +341,19 @@ function V() {
|
|
|
341
341
|
const e = bt();
|
|
342
342
|
return T(e) || m(
|
|
343
343
|
`当前目录(${N.pwd()})不存在${e}文件,请在项目根目录执行该命令,或者初始化项目(z init .)。`
|
|
344
|
-
), Z =
|
|
344
|
+
), Z = L.readJsonSync(e), Z;
|
|
345
345
|
}
|
|
346
346
|
function Et(e) {
|
|
347
347
|
Z ? Z = {
|
|
348
348
|
...Z,
|
|
349
349
|
...e
|
|
350
|
-
} : Z = e,
|
|
350
|
+
} : Z = e, L.writeJSONSync(bt(), Z, { spaces: 2 });
|
|
351
351
|
}
|
|
352
352
|
function es(e) {
|
|
353
353
|
q ? q = {
|
|
354
354
|
...q,
|
|
355
355
|
...e
|
|
356
|
-
} : q = e,
|
|
356
|
+
} : q = e, L.writeJSONSync(f.join("package.json"), q, { spaces: 2 });
|
|
357
357
|
}
|
|
358
358
|
const ae = {
|
|
359
359
|
id: 0,
|
|
@@ -365,7 +365,7 @@ const ae = {
|
|
|
365
365
|
async function ts() {
|
|
366
366
|
if (!ae.id)
|
|
367
367
|
try {
|
|
368
|
-
const e = V(), t = se(e.repository.url), a = await
|
|
368
|
+
const e = V(), t = se(e.repository.url), a = await Ct(t);
|
|
369
369
|
ae.id = a.id, ae.path = t, ae.group = a.namespace.full_path, ae.mergeRequestUrl = `${a.web_url}/merge_requests`;
|
|
370
370
|
} catch (e) {
|
|
371
371
|
m(e);
|
|
@@ -373,7 +373,7 @@ async function ts() {
|
|
|
373
373
|
return ae.sourceBranch || (ae.sourceBranch = await p("git branch --show-current")), ae;
|
|
374
374
|
}
|
|
375
375
|
function X() {
|
|
376
|
-
|
|
376
|
+
L.writeJSONSync(
|
|
377
377
|
xe(),
|
|
378
378
|
{
|
|
379
379
|
main: be(),
|
|
@@ -718,7 +718,7 @@ async function Is() {
|
|
|
718
718
|
return E("zenTaoToken", t), X(), t;
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
async function
|
|
721
|
+
async function Ce(e) {
|
|
722
722
|
const t = await ne({
|
|
723
723
|
...e,
|
|
724
724
|
headers: {
|
|
@@ -731,14 +731,14 @@ async function Le(e) {
|
|
|
731
731
|
return JSON.parse(a.data);
|
|
732
732
|
}
|
|
733
733
|
if (typeof t == "object")
|
|
734
|
-
return t.error === "Unauthorized" || t.data.indexOf("<script>") < 0 ? (E("zenTaoToken", ""),
|
|
734
|
+
return t.error === "Unauthorized" || t.data.indexOf("<script>") < 0 ? (E("zenTaoToken", ""), Ce({
|
|
735
735
|
...e
|
|
736
736
|
})) : t;
|
|
737
737
|
} else {
|
|
738
738
|
const { status: a, data: n } = t;
|
|
739
739
|
if (a === "success") {
|
|
740
740
|
const s = JSON.parse(n);
|
|
741
|
-
return s.title === "用户登录" ? (E("zenTaoToken", ""),
|
|
741
|
+
return s.title === "用户登录" ? (E("zenTaoToken", ""), Ce({
|
|
742
742
|
...e
|
|
743
743
|
})) : s;
|
|
744
744
|
} else
|
|
@@ -764,7 +764,7 @@ async function Rs() {
|
|
|
764
764
|
return E("k8sToken", a), X(), a;
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
async function
|
|
767
|
+
async function Cs(e, t) {
|
|
768
768
|
try {
|
|
769
769
|
const a = Xt(t, { mode: 493 });
|
|
770
770
|
return (await me({
|
|
@@ -782,7 +782,7 @@ async function Ls(e, t) {
|
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
const J = () => `${Ae}/api/v4`, z = (e) => `${J()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
|
|
785
|
-
function
|
|
785
|
+
function Ls() {
|
|
786
786
|
return S({
|
|
787
787
|
url: z("src/data/template-projects.json")
|
|
788
788
|
});
|
|
@@ -864,7 +864,7 @@ function Vs(e) {
|
|
|
864
864
|
data: e
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Ct(e) {
|
|
868
868
|
return S({
|
|
869
869
|
url: `${J()}/projects/${e}`
|
|
870
870
|
});
|
|
@@ -918,7 +918,7 @@ function Xs(e) {
|
|
|
918
918
|
}
|
|
919
919
|
function Qs() {
|
|
920
920
|
const e = Ne("fe-groups.json");
|
|
921
|
-
return T(e) ?
|
|
921
|
+
return T(e) ? L.readJSONSync(e) : { groups: [] };
|
|
922
922
|
}
|
|
923
923
|
async function en() {
|
|
924
924
|
const e = await Us(), t = ka.map((a) => {
|
|
@@ -929,7 +929,7 @@ async function en() {
|
|
|
929
929
|
description: n.description
|
|
930
930
|
} : !1;
|
|
931
931
|
}).filter((a) => !!a);
|
|
932
|
-
|
|
932
|
+
L.writeJSONSync(Ne("fe-groups.json"), { groups: t }, { spaces: 2 });
|
|
933
933
|
}
|
|
934
934
|
function tn(e, t) {
|
|
935
935
|
const a = [];
|
|
@@ -947,7 +947,7 @@ function tn(e, t) {
|
|
|
947
947
|
weWorkListCache: n.sort((i, o) => o.usageCount - i.usageCount)
|
|
948
948
|
}), X();
|
|
949
949
|
}
|
|
950
|
-
async function
|
|
950
|
+
async function Lt() {
|
|
951
951
|
const t = (await ss()).filter((i) => [1, 2, 3, 4, 5].includes(i.title)).map((i) => ({
|
|
952
952
|
name: `${i.nick} - ${ja[i.title]}`,
|
|
953
953
|
value: i.weWorkUserId
|
|
@@ -961,7 +961,7 @@ async function Ct() {
|
|
|
961
961
|
}), s.sort((i, o) => o.usageCount - i.usageCount);
|
|
962
962
|
}
|
|
963
963
|
async function xt(e, t, a) {
|
|
964
|
-
const n = await
|
|
964
|
+
const n = await Lt();
|
|
965
965
|
let s = await W({
|
|
966
966
|
message: e,
|
|
967
967
|
loop: !0,
|
|
@@ -991,7 +991,7 @@ async function an(e, t, a) {
|
|
|
991
991
|
}
|
|
992
992
|
async function sn() {
|
|
993
993
|
try {
|
|
994
|
-
Nt() && (await
|
|
994
|
+
Nt() && (await Le({
|
|
995
995
|
message: "系统中已存在z的配置文件,确认重新配置?"
|
|
996
996
|
}) ? N.rm("-rf", xe()) : process.exit(0)), await fe(Ne(), { recursive: !0 });
|
|
997
997
|
const t = await k({
|
|
@@ -1022,7 +1022,7 @@ async function sn() {
|
|
|
1022
1022
|
n = n.trim(), E("jobType", t), E("ldapAccount", a), E("ldapPassword", n);
|
|
1023
1023
|
const s = await He();
|
|
1024
1024
|
Pe(s);
|
|
1025
|
-
const i = await
|
|
1025
|
+
const i = await Lt(), o = await xt("请选择你自己(用于企微通知):", (u) => u.length > 1 ? "只能选一个" : u.length < 1 ? "请选一个" : !0), { name: r, value: c } = i.find((u) => u.value === o[0]);
|
|
1026
1026
|
E({
|
|
1027
1027
|
weWorkName: r,
|
|
1028
1028
|
weWorkUserId: c
|
|
@@ -1068,7 +1068,7 @@ async function rn() {
|
|
|
1068
1068
|
mode: 493
|
|
1069
1069
|
}
|
|
1070
1070
|
), await _(x(".prettierignore"), await Ms(), { mode: 493 }), await _(x("tsconfig.node.json"), await Os(), { mode: 493 }), await _(x("tsconfig.browser.json"), await Ds(), { mode: 493 })), e === $.JAVA) {
|
|
1071
|
-
await
|
|
1071
|
+
await Cs(`${re("FECDNDomain")}/file/vgnlfbfHRF.jar`, x("checkstyle.jar")), await _(x("checkstyle.xml"), await Fs(), { mode: 493 });
|
|
1072
1072
|
const t = f.join("package.json");
|
|
1073
1073
|
T(t) || await _(t, JSON.stringify({ version: "0.0.1" }, null, 2), {
|
|
1074
1074
|
mode: 493
|
|
@@ -1103,12 +1103,12 @@ async function on(e, t) {
|
|
|
1103
1103
|
}));
|
|
1104
1104
|
let s = t;
|
|
1105
1105
|
if (!s) {
|
|
1106
|
-
const o = se(a), r = await
|
|
1106
|
+
const o = se(a), r = await Ct(o);
|
|
1107
1107
|
if (!r)
|
|
1108
1108
|
return m(`未找到项目,请确认项目${a}是否存在,或者当前账号权限`);
|
|
1109
1109
|
s = r.namespace.full_path;
|
|
1110
1110
|
}
|
|
1111
|
-
let i = await
|
|
1111
|
+
let i = await Le({
|
|
1112
1112
|
message: "是否允许直接推送代码到环境分支?默认否",
|
|
1113
1113
|
default: !1
|
|
1114
1114
|
});
|
|
@@ -1130,7 +1130,7 @@ async function on(e, t) {
|
|
|
1130
1130
|
});
|
|
1131
1131
|
}
|
|
1132
1132
|
async function qe(e, t) {
|
|
1133
|
-
e ? N.rm("-rf", K) : T(x()) && (await
|
|
1133
|
+
e ? N.rm("-rf", K) : T(x()) && (await Le({
|
|
1134
1134
|
message: `当前项目中已存在配置文件夹${K},确认重新配置?`
|
|
1135
1135
|
}) ? N.rm("-rf", K) : process.exit(0)), await fe(x(), { recursive: !0 }), await on(e, t);
|
|
1136
1136
|
const a = y("项目初始化中...").start();
|
|
@@ -1187,7 +1187,7 @@ async function dn(e) {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
const Pt = (e) => `${re("ZenTaoDomain")}${e}`;
|
|
1189
1189
|
async function fn() {
|
|
1190
|
-
const e = await
|
|
1190
|
+
const e = await Ce({
|
|
1191
1191
|
url: Pt("/my-work-task.json?tid=mrrferp8"),
|
|
1192
1192
|
method: "get"
|
|
1193
1193
|
});
|
|
@@ -1200,7 +1200,7 @@ async function fn() {
|
|
|
1200
1200
|
})) : [];
|
|
1201
1201
|
}
|
|
1202
1202
|
async function gn() {
|
|
1203
|
-
const e = await
|
|
1203
|
+
const e = await Ce({
|
|
1204
1204
|
url: Pt("/my-work-bug.json?tid=mrrferp8"),
|
|
1205
1205
|
method: "get"
|
|
1206
1206
|
});
|
|
@@ -1327,7 +1327,7 @@ async function hn({ commitMessageCloseAi: e, commitMessageUseChoreType: t }) {
|
|
|
1327
1327
|
async function wn() {
|
|
1328
1328
|
try {
|
|
1329
1329
|
const e = {}, t = async () => {
|
|
1330
|
-
const D = jt(), { projects: oe } = await
|
|
1330
|
+
const D = jt(), { projects: oe } = await Ls(), te = oe.map((le) => {
|
|
1331
1331
|
const Qe = {
|
|
1332
1332
|
name: `${le.name} [${le.desc}]`,
|
|
1333
1333
|
value: le.name,
|
|
@@ -1373,7 +1373,7 @@ async function wn() {
|
|
|
1373
1373
|
...o.scripts,
|
|
1374
1374
|
prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'"
|
|
1375
1375
|
}
|
|
1376
|
-
}), await
|
|
1376
|
+
}), await L.writeFile(f.resolve("README.md"), Ja(e.projectName, e.projectDesc)), i.succeed("模版初始化完成"), await qe(e.tplLanguage, e.group?.name);
|
|
1377
1377
|
const r = y("依赖安装中").start();
|
|
1378
1378
|
await p("npm install --registry https://registry.npmmirror.com/"), r.succeed("依赖安装完成");
|
|
1379
1379
|
const c = y("项目推送中").start();
|
|
@@ -1490,7 +1490,7 @@ const bn = async () => {
|
|
|
1490
1490
|
executionId: Number(n),
|
|
1491
1491
|
ldapAccount: I("ldapAccount")
|
|
1492
1492
|
}), t.succeed("创建或更新执行构建成功");
|
|
1493
|
-
}, Nn = [w.
|
|
1493
|
+
}, Nn = [w.TEST, w.MASTER];
|
|
1494
1494
|
async function Ot(e, t) {
|
|
1495
1495
|
ee(), H();
|
|
1496
1496
|
let a = e, n = t.platform;
|
|
@@ -1709,7 +1709,7 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
|
|
|
1709
1709
|
...i,
|
|
1710
1710
|
name: `${i.value}${i.hasRemote && i.hasLocal ? "(本地/远程)" : i.hasRemote ? "(远程)" : "(本地)"}`
|
|
1711
1711
|
})).sort((i, o) => i.value.localeCompare(o.value));
|
|
1712
|
-
},
|
|
1712
|
+
}, Cn = (e) => W({
|
|
1713
1713
|
message: "请选择需要删除的分支",
|
|
1714
1714
|
options: (t) => t ? e.filter((a) => a.name.includes(t)) : e,
|
|
1715
1715
|
pageSize: 20,
|
|
@@ -1723,7 +1723,7 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
|
|
|
1723
1723
|
renderSelectedOptions: (t) => t.map((a) => a.value).join(", ")
|
|
1724
1724
|
}
|
|
1725
1725
|
}
|
|
1726
|
-
}),
|
|
1726
|
+
}), Ln = async (e) => (await p(`git branch --list ${e}`)).trim() !== "", xn = (e) => {
|
|
1727
1727
|
Ve(`git push origin --delete ${e}`);
|
|
1728
1728
|
}, Pn = (e) => {
|
|
1729
1729
|
Ve(`git branch -d ${e}`);
|
|
@@ -1734,8 +1734,8 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
|
|
|
1734
1734
|
G(`未查询到已合并到 ${Ee} 的可删除分支`);
|
|
1735
1735
|
return;
|
|
1736
1736
|
}
|
|
1737
|
-
const a = await
|
|
1738
|
-
if (!await
|
|
1737
|
+
const a = await Cn(t);
|
|
1738
|
+
if (!await Le({
|
|
1739
1739
|
message: `确认删除选中的 ${a.length} 个分支对应的远程分支和本地分支?`,
|
|
1740
1740
|
default: !1
|
|
1741
1741
|
})) {
|
|
@@ -1750,7 +1750,7 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
|
|
|
1750
1750
|
g && i.push(d);
|
|
1751
1751
|
continue;
|
|
1752
1752
|
}
|
|
1753
|
-
!g || !await
|
|
1753
|
+
!g || !await Ln(d) || (u.text = `正在删除本地分支 ${d}...`, Pn(d), r.push(d));
|
|
1754
1754
|
}
|
|
1755
1755
|
} catch (l) {
|
|
1756
1756
|
throw u.fail("删除分支失败"), l;
|
|
@@ -2177,17 +2177,17 @@ async function Ut(e, t) {
|
|
|
2177
2177
|
priority: e.pri,
|
|
2178
2178
|
steps: []
|
|
2179
2179
|
};
|
|
2180
|
-
a.steps = await os(e.id),
|
|
2180
|
+
a.steps = await os(e.id), L.writeJSONSync(t, a, {
|
|
2181
2181
|
spaces: 2
|
|
2182
2182
|
});
|
|
2183
2183
|
}
|
|
2184
2184
|
async function Vt(e, t) {
|
|
2185
2185
|
await fe(t, {
|
|
2186
2186
|
recursive: !0
|
|
2187
|
-
}), await Ut(e, f.join(t, "config.json")),
|
|
2187
|
+
}), await Ut(e, f.join(t, "config.json")), L.ensureFileSync(f.join(t, "data.yaml")), await _(
|
|
2188
2188
|
f.join(t, "data.yaml"),
|
|
2189
2189
|
T(f.resolve(K, "data.yaml")) ? await ze(f.resolve(K, "data.yaml")) : await zs()
|
|
2190
|
-
),
|
|
2190
|
+
), L.ensureFileSync(f.join(t, "main.py")), await _(
|
|
2191
2191
|
f.join(t, "main.py"),
|
|
2192
2192
|
T(f.resolve(K, "main.py")) ? await ze(f.resolve(K, "main.py")) : await _s()
|
|
2193
2193
|
);
|
|
@@ -2205,11 +2205,11 @@ function Ye(e) {
|
|
|
2205
2205
|
async function De(e, t) {
|
|
2206
2206
|
ee(), H(), await ge();
|
|
2207
2207
|
let a;
|
|
2208
|
-
t ? ([
|
|
2208
|
+
t ? ([C.MODULE, C.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${C.MODULE} 或者 ${C.CASE}。`), a = t) : a = await k({
|
|
2209
2209
|
message: `请选择要${e}的数据类型`,
|
|
2210
2210
|
choices: Ia
|
|
2211
2211
|
});
|
|
2212
|
-
const n = a ===
|
|
2212
|
+
const n = a === C.MODULE ? "模块" : C.CASE === a ? "用例" : "";
|
|
2213
2213
|
return {
|
|
2214
2214
|
type: a,
|
|
2215
2215
|
typeStr: n
|
|
@@ -2254,7 +2254,7 @@ async function ii(e, t) {
|
|
|
2254
2254
|
}
|
|
2255
2255
|
async function ri(e, t) {
|
|
2256
2256
|
const { type: a, typeStr: n } = await De("拉取", e), s = await Gt(t.productId), i = y(`${n}同步中...`).start();
|
|
2257
|
-
if (
|
|
2257
|
+
if (C.MODULE === a && await ii(i, s), C.CASE === a && await ni(i, s, t.caseIds), i.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await p("git status -s")) {
|
|
2258
2258
|
const o = y("代码提交中...").start();
|
|
2259
2259
|
try {
|
|
2260
2260
|
await p(`git add . && git commit -m "chore: 同步禅道${n}数据"`), o.succeed("代码已提交 ✅");
|
|
@@ -2348,7 +2348,7 @@ async function ui(e, t) {
|
|
|
2348
2348
|
});
|
|
2349
2349
|
d = d.trim();
|
|
2350
2350
|
let g = "";
|
|
2351
|
-
if (
|
|
2351
|
+
if (C.MODULE === a && await ci(i, l, d), C.CASE === a && (g = await oi(i, l, d)), !t.disableAutoCommit && C.CASE === a) {
|
|
2352
2352
|
const h = y("代码提交中...").start();
|
|
2353
2353
|
try {
|
|
2354
2354
|
await p(`git add . && git commit -m "chore: 创建了用例${f.basename(g)}"`), h.succeed("代码已提交 ✅");
|
|
@@ -2432,7 +2432,7 @@ async function mi(e, t) {
|
|
|
2432
2432
|
async function di(e, t) {
|
|
2433
2433
|
const { type: a, typeStr: n } = await De("删除", e), { localProduct: s } = await Oe(t.productId), i = Ye(t.targetIds);
|
|
2434
2434
|
let o = [];
|
|
2435
|
-
if (
|
|
2435
|
+
if (C.MODULE === a ? o = await mi(s, i) : C.CASE === a && (o = await pi(s, i)), !t.disableAutoCommit && await p("git status -s")) {
|
|
2436
2436
|
const r = y("代码提交中...").start();
|
|
2437
2437
|
try {
|
|
2438
2438
|
await p(`git add . && git commit -m 'chore: 删除了一些${n}(${o.join(", ")})'`), r.succeed("代码已提交 ✅");
|
|
@@ -2481,7 +2481,7 @@ async function fi(e, t) {
|
|
|
2481
2481
|
id: Number(s.id),
|
|
2482
2482
|
name: i
|
|
2483
2483
|
}), await Te(s.path, i, "case", String(s.id)) && o.succeed(`用例重命名成功: ${s.displayName} -> ${i}`), s.displayName = i, s.path = f.join(f.dirname(s.path), Q("case", i, String(s.id)))) : o.succeed("用例名称无变动");
|
|
2484
|
-
let r =
|
|
2484
|
+
let r = L.readJsonSync(f.join(s.path, "config.json")), c;
|
|
2485
2485
|
t.casePriority ? Number.isInteger(t.casePriority) && Number(t.casePriority) > 0 && Number(t.casePriority) < 6 ? c = Number(t.casePriority) : c = await tt({
|
|
2486
2486
|
message: "修改用例优先级",
|
|
2487
2487
|
min: 1,
|
|
@@ -2501,14 +2501,14 @@ async function fi(e, t) {
|
|
|
2501
2501
|
c !== r.priority ? (await gs({
|
|
2502
2502
|
id: Number(s.id),
|
|
2503
2503
|
priority: c
|
|
2504
|
-
}),
|
|
2504
|
+
}), L.writeJSONSync(
|
|
2505
2505
|
f.join(s.path, "config.json"),
|
|
2506
2506
|
{
|
|
2507
2507
|
...r,
|
|
2508
2508
|
priority: c
|
|
2509
2509
|
},
|
|
2510
2510
|
{ spaces: 2 }
|
|
2511
|
-
), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r =
|
|
2511
|
+
), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = L.readJsonSync(f.join(s.path, "config.json"));
|
|
2512
2512
|
let l;
|
|
2513
2513
|
t.casePrecondition ? l = t.casePrecondition : (l = await F({
|
|
2514
2514
|
message: "修改用例前置条件",
|
|
@@ -2519,7 +2519,7 @@ async function fi(e, t) {
|
|
|
2519
2519
|
return l !== r.precondition ? (await hs({
|
|
2520
2520
|
id: Number(s.id),
|
|
2521
2521
|
precondition: l
|
|
2522
|
-
}),
|
|
2522
|
+
}), L.writeJSONSync(
|
|
2523
2523
|
f.join(s.path, "config.json"),
|
|
2524
2524
|
{
|
|
2525
2525
|
...r,
|
|
@@ -2571,7 +2571,7 @@ async function gi(e, t) {
|
|
|
2571
2571
|
async function hi(e, t) {
|
|
2572
2572
|
const { type: a, typeStr: n } = await De("修改", e), { localProduct: s } = await Oe(t.productId);
|
|
2573
2573
|
let i;
|
|
2574
|
-
if (
|
|
2574
|
+
if (C.MODULE === a ? i = await gi(s, t) : C.CASE === a && (i = await fi(s, t)), !t.disableAutoCommit && await p("git status -s")) {
|
|
2575
2575
|
const o = y("代码提交中...").start();
|
|
2576
2576
|
try {
|
|
2577
2577
|
await p(`git add . && git commit -m 'chore: 修改了一个${n}(${i})'`), o.succeed("代码已提交 ✅");
|
|
@@ -2961,15 +2961,15 @@ class Ri extends Wt {
|
|
|
2961
2961
|
}
|
|
2962
2962
|
}
|
|
2963
2963
|
}
|
|
2964
|
-
const
|
|
2964
|
+
const Ci = (e) => {
|
|
2965
2965
|
switch (e) {
|
|
2966
2966
|
case $.JAVASCRIPT:
|
|
2967
2967
|
return Ri;
|
|
2968
2968
|
case $.PYTHON:
|
|
2969
2969
|
return Ei;
|
|
2970
2970
|
}
|
|
2971
|
-
},
|
|
2972
|
-
const { apiType: t } = e, a =
|
|
2971
|
+
}, Li = async (e) => {
|
|
2972
|
+
const { apiType: t } = e, a = Ci(t);
|
|
2973
2973
|
a ? await new a().generateApi(e) : m(`不支持 ${t} 语言`);
|
|
2974
2974
|
};
|
|
2975
2975
|
async function xi(e) {
|
|
@@ -2980,7 +2980,7 @@ async function xi(e) {
|
|
|
2980
2980
|
env: r,
|
|
2981
2981
|
skipSwaggerValidate: s
|
|
2982
2982
|
}), u = await ji();
|
|
2983
|
-
await
|
|
2983
|
+
await Li({
|
|
2984
2984
|
remoteSwaggerJsons: c,
|
|
2985
2985
|
...e,
|
|
2986
2986
|
scope: u,
|
|
@@ -3173,7 +3173,7 @@ async function Hi() {
|
|
|
3173
3173
|
const e = ba(process.argv.slice(2));
|
|
3174
3174
|
if (!(e.h || e.help || e.v || e.version) && !(["init", "i"].includes(e._[0]) && ![".", "prepare"].includes(e._[1])))
|
|
3175
3175
|
if (Nt()) {
|
|
3176
|
-
const t =
|
|
3176
|
+
const t = L.readJSONSync(xe());
|
|
3177
3177
|
E(t.profile), de(t.main), Pe(t.constants), await Wi();
|
|
3178
3178
|
} else
|
|
3179
3179
|
m(`请先初始化z-develop(执行 z i)。更多见${At}`);
|