cli-z-develop 0.16.2 → 0.16.3

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.
Files changed (2) hide show
  1. package/dist/index.js +67 -60
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,11 +9,11 @@ import ca from "dayjs";
9
9
  import N from "shelljs";
10
10
  import la, { tmpdir as ua } from "node:os";
11
11
  import tt from "child_process";
12
- import { confirm as Le, select as k, input as F, password as pa, checkbox as Re, number as at } from "@inquirer/prompts";
12
+ import { confirm as Le, select as E, input as F, password as pa, checkbox as Re, number as at } from "@inquirer/prompts";
13
13
  import y from "ora";
14
14
  import L from "fs-extra";
15
15
  import ma from "open";
16
- import { select as W } from "inquirer-select-pro";
16
+ import { select as V } from "inquirer-select-pro";
17
17
  import da from "lint-staged";
18
18
  import fa from "semver";
19
19
  import { run as ga } from "npm-check-updates";
@@ -274,7 +274,7 @@ const Va = {
274
274
  "**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix",
275
275
  "**/*.md": "markdownlint --fix"
276
276
  }
277
- }, Wa = "cli-z-develop", Ha = "0.16.2", qa = "技术团队开发流程管理工具", Za = "dist/index.js", Ka = { z: "bin/z.js", "z-develop": "bin/z.js" }, Ya = { 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" }, Xa = "module", Qa = "z", es = { "@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" }, ts = { "@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 = {
277
+ }, Wa = "cli-z-develop", Ha = "0.16.3", qa = "技术团队开发流程管理工具", Za = "dist/index.js", Ka = { z: "bin/z.js", "z-develop": "bin/z.js" }, Ya = { 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" }, Xa = "module", Qa = "z", es = { "@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" }, ts = { "@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: Wa,
279
279
  version: Ha,
280
280
  description: qa,
@@ -335,7 +335,7 @@ function We() {
335
335
  const e = f.join("package.json");
336
336
  return j(e) || m(`当前目录(${N.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), q = L.readJsonSync(e), q;
337
337
  }
338
- function V() {
338
+ function W() {
339
339
  if (Z)
340
340
  return Z;
341
341
  const e = St();
@@ -365,7 +365,7 @@ const ae = {
365
365
  async function ss() {
366
366
  if (!ae.id)
367
367
  try {
368
- const e = V(), t = se(e.repository.url), a = await Lt(t);
368
+ const e = W(), t = se(e.repository.url), a = await Lt(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);
@@ -385,7 +385,7 @@ function X() {
385
385
  }
386
386
  );
387
387
  }
388
- function E(e, t) {
388
+ function k(e, t) {
389
389
  t !== void 0 ? M.profile[e] = t : M.profile = {
390
390
  ...M.profile,
391
391
  ...e
@@ -618,7 +618,7 @@ class Rs {
618
618
  */
619
619
  saveToken(t) {
620
620
  const a = Date.now() + t.expires_in * 1e3;
621
- E("gitToken", this.generateBearerToken(t.access_token, t.token_type)), E("gitLabRefreshToken", t.refresh_token), E("gitTokenExpiry", a), X();
621
+ k("gitToken", this.generateBearerToken(t.access_token, t.token_type)), k("gitLabRefreshToken", t.refresh_token), k("gitTokenExpiry", a), X();
622
622
  }
623
623
  /**
624
624
  * 使用 refresh_token 刷新 Access Token
@@ -660,7 +660,7 @@ class Rs {
660
660
  try {
661
661
  return await this.refreshAccessToken(n);
662
662
  } catch {
663
- console.log(A.yellow("⚠️ Token 刷新失败,需要重新授权")), E("gitToken", ""), E("gitLabRefreshToken", ""), E("gitTokenExpiry", ""), X();
663
+ console.log(A.yellow("⚠️ Token 刷新失败,需要重新授权")), k("gitToken", ""), k("gitLabRefreshToken", ""), k("gitTokenExpiry", ""), X();
664
664
  }
665
665
  return await this.auth();
666
666
  }
@@ -693,7 +693,7 @@ async function S(e) {
693
693
  });
694
694
  } catch (t) {
695
695
  if (t instanceof gt && t.response?.status === 401)
696
- return console.log(A.yellow("⚠️ GitLab Token 已失效,正在重新授权...")), E("gitToken", ""), E("gitLabRefreshToken", ""), E("gitTokenExpiry", ""), X(), ne({
696
+ return console.log(A.yellow("⚠️ GitLab Token 已失效,正在重新授权...")), k("gitToken", ""), k("gitLabRefreshToken", ""), k("gitTokenExpiry", ""), X(), ne({
697
697
  ...e,
698
698
  headers: {
699
699
  Authorization: await ot.getToken()
@@ -715,7 +715,7 @@ async function Cs() {
715
715
  password: I("ldapPassword")
716
716
  }
717
717
  });
718
- return E("zenTaoToken", t), X(), t;
718
+ return k("zenTaoToken", t), X(), t;
719
719
  }
720
720
  }
721
721
  async function Ce(e) {
@@ -731,14 +731,14 @@ async function Ce(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", ""), Ce({
734
+ return t.error === "Unauthorized" || t.data.indexOf("<script>") < 0 ? (k("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", ""), Ce({
741
+ return s.title === "用户登录" ? (k("zenTaoToken", ""), Ce({
742
742
  ...e
743
743
  })) : s;
744
744
  } else
@@ -761,7 +761,7 @@ async function Ls() {
761
761
  password: I("ldapPassword")
762
762
  }
763
763
  }), a = `Bearer ${t}`;
764
- return E("k8sToken", a), X(), a;
764
+ return k("k8sToken", a), X(), a;
765
765
  }
766
766
  }
767
767
  async function xs(e, t) {
@@ -962,7 +962,7 @@ async function xt() {
962
962
  }
963
963
  async function Pt(e, t, a) {
964
964
  const n = await xt();
965
- let s = await W({
965
+ let s = await V({
966
966
  message: e,
967
967
  loop: !0,
968
968
  pageSize: n.length || 5,
@@ -978,7 +978,7 @@ async function nn(e, t, a) {
978
978
  name: o.name,
979
979
  value: o.url
980
980
  }));
981
- let i = await W({
981
+ let i = await V({
982
982
  message: e,
983
983
  loop: !0,
984
984
  pageSize: s.length || 5,
@@ -994,7 +994,7 @@ async function rn() {
994
994
  jt() && (await Le({
995
995
  message: "系统中已存在z的配置文件,确认重新配置?"
996
996
  }) ? N.rm("-rf", xe()) : process.exit(0)), await fe(Ne(), { recursive: !0 });
997
- const t = await k({
997
+ const t = await E({
998
998
  message: "请选择岗位类型",
999
999
  choices: [
1000
1000
  {
@@ -1019,11 +1019,11 @@ async function rn() {
1019
1019
  message: "请输入LDAP密码:",
1020
1020
  mask: !0
1021
1021
  });
1022
- n = n.trim(), E("jobType", t), E("ldapAccount", a), E("ldapPassword", n);
1022
+ n = n.trim(), k("jobType", t), k("ldapAccount", a), k("ldapPassword", n);
1023
1023
  const s = await He();
1024
1024
  De(s);
1025
1025
  const i = await xt(), o = await Pt("请选择你自己(用于企微通知):", (u) => u.length > 1 ? "只能选一个" : u.length < 1 ? "请选一个" : !0), { name: r, value: c } = i.find((u) => u.value === o[0]);
1026
- E({
1026
+ k({
1027
1027
  weWorkName: r,
1028
1028
  weWorkUserId: c
1029
1029
  });
@@ -1033,7 +1033,7 @@ async function rn() {
1033
1033
  const e = y("配置信息初始化中").start();
1034
1034
  try {
1035
1035
  const t = await Vs();
1036
- E({
1036
+ k({
1037
1037
  gitUserId: t.id,
1038
1038
  gitName: t.name,
1039
1039
  gitEnglishName: t.username,
@@ -1059,7 +1059,7 @@ const ke = (e, t, a) => {
1059
1059
  async function cn() {
1060
1060
  await _(Se(), "", { mode: 493 }), await _(x(".gitignore"), `.commit-msg-tpl
1061
1061
  `, { mode: 493 }), on();
1062
- const { language: e } = V();
1062
+ const { language: e } = W();
1063
1063
  if ([$.JAVASCRIPT, $.MARKDOWN].includes(e) && (await _(
1064
1064
  x(".prettierrc.json"),
1065
1065
  `${JSON.stringify(await _s(), null, 2)}
@@ -1080,7 +1080,7 @@ async function ln(e, t) {
1080
1080
  const a = await p("git remote get-url --push origin");
1081
1081
  a || m("获取项目远程git地址失败,请配置后重试");
1082
1082
  let n = e;
1083
- n || (n = await k({
1083
+ n || (n = await E({
1084
1084
  message: "请选择项目语言",
1085
1085
  choices: [
1086
1086
  {
@@ -1162,7 +1162,7 @@ function fn(e) {
1162
1162
  async function gn(e) {
1163
1163
  ee(), H(), await ge();
1164
1164
  let t, a;
1165
- e.branchType ? t = e.branchType : t = await k({
1165
+ e.branchType ? t = e.branchType : t = await E({
1166
1166
  message: "请选择创建分支的类型",
1167
1167
  choices: [
1168
1168
  {
@@ -1268,7 +1268,7 @@ async function ze(e, t, a) {
1268
1268
  }
1269
1269
  async function yn({ commitMessageCloseAi: e, commitMessageUseChoreType: t }) {
1270
1270
  let a;
1271
- if (t ? a = T.CHORE : a = await k({
1271
+ if (t ? a = T.CHORE : a = await E({
1272
1272
  message: "请选择你要创建的模板类型",
1273
1273
  choices: [
1274
1274
  {
@@ -1334,13 +1334,13 @@ async function $n() {
1334
1334
  disabled: !1
1335
1335
  };
1336
1336
  return D.includes(le.name) && (et.disabled = "目录下已存在同名文件夹"), et;
1337
- }), Kt = await k({
1337
+ }), Kt = await E({
1338
1338
  message: "请选择一个项目模板",
1339
1339
  choices: te
1340
1340
  }), Be = oe.find((le) => le.name === Kt);
1341
1341
  e.tplName = Be.name, e.tplUrl = Be.url, e.tplLanguage = Be.language;
1342
1342
  }, a = async () => {
1343
- const { groups: D } = tn(), oe = await k({
1343
+ const { groups: D } = tn(), oe = await E({
1344
1344
  message: "请选择一个分组",
1345
1345
  choices: D.map((te) => ({
1346
1346
  name: `${te.name} [${te.description}]`,
@@ -1418,7 +1418,7 @@ async function vn(e, t) {
1418
1418
  "commit-msg",
1419
1419
  "cm"
1420
1420
  /* CommitMsgAbbr */
1421
- ].includes(e) ? a = "commit-msg" : m("参数输入错误") : a = await k({
1421
+ ].includes(e) ? a = "commit-msg" : m("参数输入错误") : a = await E({
1422
1422
  message: "请选择你要创建的类型",
1423
1423
  choices: [
1424
1424
  {
@@ -1450,10 +1450,10 @@ const An = async (e) => {
1450
1450
  });
1451
1451
  i.moduleNames.length > 1 ? (o.succeed(`多模块部署任务创建完成,共 ${i.moduleNames.length} 个模块`), o.succeed(`当前已创建首个模块 ${A.blue(i.moduleNames[0])} 的 k8s 地址:`), console.log(A.blue(r)), o.info("后续模块会在前一个模块完成后依次部署,并通过企微通知下发对应地址。")) : (o.succeed("部署任务创建完成"), console.log(`如有需要,可在k8s中查看 ${A.blue(r)}`));
1452
1452
  }, Ze = () => {
1453
- const e = V();
1453
+ const e = W();
1454
1454
  return e.language || m("未找到当前项目的语言类型,请先通过 z . 对项目进行初始化!"), e.language;
1455
1455
  }, Ot = () => {
1456
- const e = V();
1456
+ const e = W();
1457
1457
  return e.repository?.url || m("未找到当前项目的仓库地址,请先通过 z . 对项目进行初始化"), e.repository.url;
1458
1458
  }, Mt = async () => {
1459
1459
  const e = Ot(), t = Ze(), { groups: a } = await Us();
@@ -1470,7 +1470,7 @@ const An = async (e) => {
1470
1470
  };
1471
1471
  function Sn(e, t) {
1472
1472
  const a = We();
1473
- if (V()?.repository?.url || m(".z/project.json中缺少repository.url"), t === Y.H5) {
1473
+ if (W()?.repository?.url || m(".z/project.json中缺少repository.url"), t === Y.H5) {
1474
1474
  const s = `build:${e}`;
1475
1475
  a?.scripts[s] || m(`项目package.json文件scripts不存在命令${s}。`);
1476
1476
  }
@@ -1484,12 +1484,19 @@ const Nn = async () => {
1484
1484
  }
1485
1485
  const t = y("查询禅道执行中...").start(), a = await js(Number(e.zenTaoProductId));
1486
1486
  a.length || (t.fail("查询禅道执行失败"), m(`${e.name} 项目在禅道中未创建执行!`)), t.stop();
1487
- const n = await k({
1487
+ const n = await V({
1488
1488
  message: "请选择执行",
1489
- choices: a.map((s) => ({
1490
- name: s.label,
1491
- value: s.value
1492
- }))
1489
+ options: (s) => {
1490
+ const i = a.map((o) => ({
1491
+ name: o.label,
1492
+ value: o.value
1493
+ }));
1494
+ return s ? i.filter((o) => o.name.includes(s)) : i;
1495
+ },
1496
+ pageSize: 20,
1497
+ loop: !0,
1498
+ multiple: !1,
1499
+ filter: !0
1493
1500
  });
1494
1501
  t.start("创建或更新执行构建..."), await Ts({
1495
1502
  appName: e.name,
@@ -1500,12 +1507,12 @@ const Nn = async () => {
1500
1507
  async function Bt(e, t) {
1501
1508
  ee(), H();
1502
1509
  let a = e, n = t.platform;
1503
- const s = V();
1504
- if (s.language === $.JAVA && (n = Y.SERVER), a && !Object.values(w).includes(a) && m("仅支持发布指定环境分支"), n && !Object.values(Y).includes(n) && m("发布平台错误"), n || (n = await k({
1510
+ const s = W();
1511
+ if (s.language === $.JAVA && (n = Y.SERVER), a && !Object.values(w).includes(a) && m("仅支持发布指定环境分支"), n && !Object.values(Y).includes(n) && m("发布平台错误"), n || (n = await E({
1505
1512
  message: "请选择平台",
1506
1513
  choices: ka
1507
1514
  })), n === Y.NPM && (a = w.MASTER), !a) {
1508
- const l = await k({
1515
+ const l = await E({
1509
1516
  message: "请选择部署环境",
1510
1517
  choices: At
1511
1518
  });
@@ -1536,7 +1543,7 @@ async function Bt(e, t) {
1536
1543
  const v = new Set(t.module.split(Fe));
1537
1544
  g.forEach((R) => v.has(R.value) && o.push(R.value));
1538
1545
  }
1539
- const h = await W({
1546
+ const h = await V({
1540
1547
  message: "请选择部署模块",
1541
1548
  options: (v) => v ? g.filter((R) => R.name.includes(v)) : g,
1542
1549
  pageSize: 20,
@@ -1652,7 +1659,7 @@ async function kn(e, t) {
1652
1659
  };
1653
1660
  });
1654
1661
  let i;
1655
- e && !s.filter((c) => c.value === e).length && m(`未找到目标分支${e}`), e ? i = e : i = await k({
1662
+ e && !s.filter((c) => c.value === e).length && m(`未找到目标分支${e}`), e ? i = e : i = await E({
1656
1663
  message: "请选择要合并到的目标分支:",
1657
1664
  choices: s
1658
1665
  });
@@ -1719,7 +1726,7 @@ const Ie = "origin/", In = Object.values(w).map((e) => `${Ie}${e}`), Rn = Object
1719
1726
  ...i,
1720
1727
  name: `${i.value}${i.hasRemote && i.hasLocal ? "(本地/远程)" : i.hasRemote ? "(远程)" : "(本地)"}`
1721
1728
  })).sort((i, o) => i.value.localeCompare(o.value));
1722
- }, Ln = (e) => W({
1729
+ }, Ln = (e) => V({
1723
1730
  message: "请选择需要删除的分支",
1724
1731
  options: (t) => t ? e.filter((a) => a.name.includes(t)) : e,
1725
1732
  pageSize: 20,
@@ -1795,7 +1802,7 @@ const Ie = "origin/", In = Object.values(w).map((e) => `${Ie}${e}`), Rn = Object
1795
1802
  return [];
1796
1803
  }
1797
1804
  }, _n = async () => {
1798
- const { skipGitPushLimit: e } = V(), t = Object.values(w), a = dt(0, "utf-8");
1805
+ const { skipGitPushLimit: e } = W(), t = Object.values(w), a = dt(0, "utf-8");
1799
1806
  if (!a)
1800
1807
  return;
1801
1808
  const n = a.trim().split(`
@@ -1833,7 +1840,7 @@ const Gn = () => {
1833
1840
  m("禁止执行 rebase,请使用 git merge!");
1834
1841
  };
1835
1842
  function Jn() {
1836
- const e = V();
1843
+ const e = W();
1837
1844
  if (e["lint-staged"])
1838
1845
  return e["lint-staged"];
1839
1846
  throw new Error("未找到lint配置");
@@ -2035,7 +2042,7 @@ const Yn = [
2035
2042
  };
2036
2043
  async function si(e, t) {
2037
2044
  ee(), H();
2038
- const a = V(), n = e ? ai(e) : await k({
2045
+ const a = W(), n = e ? ai(e) : await E({
2039
2046
  message: "请选择你要执行的操作",
2040
2047
  choices: [
2041
2048
  {
@@ -2168,7 +2175,7 @@ async function Vt(e) {
2168
2175
  Number.isNaN(Number(e)) && m("请输入正确的产品ID"), t.id = Number(e);
2169
2176
  else {
2170
2177
  const a = await rs();
2171
- t.id = await k({
2178
+ t.id = await E({
2172
2179
  message: "请选择产品",
2173
2180
  choices: a.map((n) => ({
2174
2181
  name: `${n.label}[${n.value}]`,
@@ -2215,7 +2222,7 @@ function Xe(e) {
2215
2222
  async function Oe(e, t) {
2216
2223
  ee(), H(), await ge();
2217
2224
  let a;
2218
- t ? ([C.MODULE, C.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${C.MODULE} 或者 ${C.CASE}。`), a = t) : a = await k({
2225
+ t ? ([C.MODULE, C.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${C.MODULE} 或者 ${C.CASE}。`), a = t) : a = await E({
2219
2226
  message: `请选择要${e}的数据类型`,
2220
2227
  choices: Ca
2221
2228
  });
@@ -2336,7 +2343,7 @@ function ui(e) {
2336
2343
  });
2337
2344
  }
2338
2345
  async function a(n, s = []) {
2339
- const i = s.length ? `请选择层级(当前:${s.join(" / ")})` : "请选择层级", o = await k({
2346
+ const i = s.length ? `请选择层级(当前:${s.join(" / ")})` : "请选择层级", o = await E({
2340
2347
  message: i,
2341
2348
  choices: n.map((r) => ({
2342
2349
  name: `${r.tempTitle ? r.tempTitle : r.label} ${r.children?.length ? "(有子级)" : ""}`,
@@ -2384,7 +2391,7 @@ async function mi(e, t) {
2384
2391
  },
2385
2392
  name: c.path.replace(f.resolve(e.path), "")
2386
2393
  }));
2387
- s = await W({
2394
+ s = await V({
2388
2395
  message: "选择要删除的用例",
2389
2396
  pageSize: 100,
2390
2397
  loop: !1,
@@ -2419,7 +2426,7 @@ async function di(e, t) {
2419
2426
  },
2420
2427
  name: c.path.replace(f.resolve(e.path), "")
2421
2428
  }));
2422
- s = await W({
2429
+ s = await V({
2423
2430
  message: "选择要删除的模块",
2424
2431
  pageSize: 100,
2425
2432
  loop: !1,
@@ -2467,7 +2474,7 @@ async function gi(e, t) {
2467
2474
  },
2468
2475
  name: h.path.replace(f.resolve(e.path), "")
2469
2476
  }));
2470
- [s] = await W({
2477
+ [s] = await V({
2471
2478
  message: "选择要更新的用例",
2472
2479
  pageSize: 100,
2473
2480
  loop: !1,
@@ -2553,7 +2560,7 @@ async function hi(e, t) {
2553
2560
  },
2554
2561
  name: c.path.replace(f.resolve(e.path), "")
2555
2562
  }));
2556
- [s] = await W({
2563
+ [s] = await V({
2557
2564
  message: "选择要更新的模块",
2558
2565
  pageSize: 100,
2559
2566
  loop: !1,
@@ -2639,7 +2646,7 @@ async function $i(e) {
2639
2646
  },
2640
2647
  name: l.path.replace(f.resolve(t.path), "")
2641
2648
  }));
2642
- a = await W({
2649
+ a = await V({
2643
2650
  message: "选择要执行的用例",
2644
2651
  pageSize: 100,
2645
2652
  loop: !1,
@@ -2662,11 +2669,11 @@ async function $i(e) {
2662
2669
  if (e.executionId)
2663
2670
  Number.isNaN(Number(e.executionId)) && m(`executionId ${e.executionId}不是正整数`), u = Number(e.executionId);
2664
2671
  else {
2665
- const d = await vs(), g = await k({
2672
+ const d = await vs(), g = await E({
2666
2673
  message: "请选择用例执行出错后,BUG所属的项目",
2667
2674
  choices: d.map(({ id: v, name: R }) => ({ name: R, value: v }))
2668
2675
  }), h = await As(g);
2669
- u = await k({
2676
+ u = await E({
2670
2677
  message: "请选择用例执行出错后,BUG所属的执行",
2671
2678
  choices: h.map(({ id: v, name: R }) => ({ name: R, value: v }))
2672
2679
  });
@@ -2706,7 +2713,7 @@ async function $i(e) {
2706
2713
  }
2707
2714
  P.command("qa-exec").alias("qe").description("执行用例").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "可传指定用例ID。可传N个,逗号隔开").option("--all", "执行产品下所有用例").option("--concurrency <concurrency>", "最多并行执行脚本数。默认20").option("--process-step <step>", "不传默认2。 1. 仅在本地返回执行报告; 2. 执行出错的结果提交到禅道用例并提交BUG。").option("--env <env>", "环境变量,会作为参数传递给执行脚本。默认production").option("--execution-id <executionId>", "提bug时,要关联的禅道执行ID").option("--build-id <buildId>", "提bug时,要关联的禅道执行构建ID。默认主干(trunk)").action((...e) => B($i, ...e));
2708
2715
  const vi = async () => {
2709
- const { projects: e } = await Os(), t = V();
2716
+ const { projects: e } = await Os(), t = W();
2710
2717
  if (t.serverProjectURL) {
2711
2718
  const n = e.find(
2712
2719
  (s) => Pe(s.url, t.serverProjectURL)
@@ -2717,7 +2724,7 @@ const vi = async () => {
2717
2724
  moduleList: n.modules || []
2718
2725
  };
2719
2726
  }
2720
- const a = await k({
2727
+ const a = await E({
2721
2728
  message: "请选择本项目对应的服务端项目",
2722
2729
  choices: e.map((n) => ({
2723
2730
  name: `${n.name}(${n.url})`,
@@ -2743,7 +2750,7 @@ const vi = async () => {
2743
2750
  loop: !0
2744
2751
  });
2745
2752
  return n?.length ? n : e.map((s) => s.name);
2746
- }, pt = [O.DEV, O.TEST], bi = async (e) => e && pt.includes(e.trim()) ? e : await k({
2753
+ }, pt = [O.DEV, O.TEST], bi = async (e) => e && pt.includes(e.trim()) ? e : await E({
2747
2754
  message: "请选择对应的环境",
2748
2755
  choices: At.filter((t) => pt.includes(t.value))
2749
2756
  }), Qe = (e) => {
@@ -2773,7 +2780,7 @@ ${n.message}`;
2773
2780
  ${e.map(t).join(`
2774
2781
  `)}`;
2775
2782
  }, ji = async (e, t) => {
2776
- const a = Ni(e), n = V(), { groups: s } = await Ct(), i = s.find(
2783
+ const a = Ni(e), n = W(), { groups: s } = await Ct(), i = s.find(
2777
2784
  (c) => c.projects.some((u) => Pe(u, n.serverProjectURL))
2778
2785
  );
2779
2786
  t.fail("API数据解析失败"), i || (t.fail("未找到对应的项目群聊组!"), process.stdout.write(`${A.red(a)}
@@ -2798,7 +2805,7 @@ ${e.map(t).join(`
2798
2805
  (l, d) => l.status === "rejected" ? [{ reason: l.reason, url: o[d] }] : []
2799
2806
  );
2800
2807
  return u.length && await ji(u, r), r.succeed("API数据请求成功"), c.flatMap((l, d) => l.status === "fulfilled" ? [{ serverName: Qe(o[d]), swaggerJson: l.value }] : []);
2801
- }, ki = () => k({
2808
+ }, ki = () => E({
2802
2809
  message: "请选择生成API的范围",
2803
2810
  choices: [
2804
2811
  {
@@ -2819,7 +2826,7 @@ ${e.map(t).join(`
2819
2826
  formatShowToValue: i
2820
2827
  }) => {
2821
2828
  const o = i ? typeof i == "function" ? i : (r) => r.map((c) => String(c.value)).join(", ") : void 0;
2822
- return W({
2829
+ return V({
2823
2830
  message: e,
2824
2831
  pageSize: n,
2825
2832
  clearInputWhenSelected: !0,
@@ -3184,7 +3191,7 @@ async function qi() {
3184
3191
  if (!(e.h || e.help || e.v || e.version) && !(["init", "i"].includes(e._[0]) && ![".", "prepare"].includes(e._[1])))
3185
3192
  if (jt()) {
3186
3193
  const t = L.readJSONSync(xe());
3187
- E(t.profile), de(t.main), De(t.constants), await Hi();
3194
+ k(t.profile), de(t.main), De(t.constants), await Hi();
3188
3195
  } else
3189
3196
  m(`请先初始化z-develop(执行 z i)。更多见${bt}`);
3190
3197
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-z-develop",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "技术团队开发流程管理工具",
5
5
  "main": "dist/index.js",
6
6
  "bin": {