cli-z-develop 0.10.2 → 0.10.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 +27 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import jt from "node:os";
11
11
  import Le from "child_process";
12
12
  import { confirm as _e, select as E, input as _, password as At, checkbox as Pe, number as Oe } from "@inquirer/prompts";
13
13
  import w from "ora";
14
- import j from "fs-extra";
14
+ import S from "fs-extra";
15
15
  import { select as re } from "inquirer-select-pro";
16
16
  import Et from "lint-staged";
17
17
  import Tt from "semver";
@@ -67,7 +67,7 @@ const Dt = {
67
67
  }, me = "http://git.cxlqd.com", Lt = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
68
68
  var b = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e.CHORE = "chore", e.CI = "ci", e.Break = "BREAKING CHANGE", e))(b || {});
69
69
  const Pt = "fe-biz7tvsd", We = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
70
- var S = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(S || {});
70
+ var j = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(j || {});
71
71
  const Ot = [
72
72
  {
73
73
  name: "模块",
@@ -314,7 +314,7 @@ dist/
314
314
  "Method": "接口类型",
315
315
  "Expected": "期望结果"
316
316
  }
317
- ]`, Xt = "# from assets", ei = "cli-z-develop", ti = "0.10.2", ii = "技术团队开发流程管理工具", ai = "dist/index.js", ni = { z: "bin/z.js", "z-develop": "bin/z.js" }, si = { 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" }, ri = "module", oi = "z", ci = { "@lonely9/eslint-config-team": "^1.3.5", "@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.53.0", "@typescript-eslint/parser": "^8.53.0", eslint: "^9.39.2", jiti: "^2.6.1", prettier: "^3.7.4", typescript: "^5.9.3", vite: "^7.3.1", "vue-tsc": "^3.2.2" }, ui = { "@inquirer/prompts": "^8.2.0", axios: "^1.13.6", chalk: "^5.6.2", commander: "^14.0.2", dayjs: "^1.11.19", "fs-extra": "^11.3.3", "inquirer-select-pro": "^1.0.0-alpha.9", "lint-staged": "^16.2.7", minimist: "^1.2.8", "npm-check-updates": "^19.3.1", ora: "^9.0.0", semver: "^7.7.3", shelljs: "^0.10.0" }, Q = {
317
+ ]`, Xt = "# from assets", ei = "cli-z-develop", ti = "0.10.3", ii = "技术团队开发流程管理工具", ai = "dist/index.js", ni = { z: "bin/z.js", "z-develop": "bin/z.js" }, si = { 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" }, ri = "module", oi = "z", ci = { "@lonely9/eslint-config-team": "^1.3.5", "@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.53.0", "@typescript-eslint/parser": "^8.53.0", eslint: "^9.39.2", jiti: "^2.6.1", prettier: "^3.7.4", typescript: "^5.9.3", vite: "^7.3.1", "vue-tsc": "^3.2.2" }, ui = { "@inquirer/prompts": "^8.2.0", axios: "^1.13.6", chalk: "^5.6.2", commander: "^14.0.2", dayjs: "^1.11.19", "fs-extra": "^11.3.3", "inquirer-select-pro": "^1.0.0-alpha.9", "lint-staged": "^16.2.7", minimist: "^1.2.8", "npm-check-updates": "^19.3.1", ora: "^9.0.0", semver: "^7.7.3", shelljs: "^0.10.0" }, Q = {
318
318
  name: ei,
319
319
  version: ti,
320
320
  description: ii,
@@ -372,7 +372,7 @@ function $e() {
372
372
  if (B)
373
373
  return B;
374
374
  const e = l.join("package.json");
375
- return $(e) || m(`当前目录(${x.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), B = j.readJsonSync(e), B;
375
+ return $(e) || m(`当前目录(${x.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), B = S.readJsonSync(e), B;
376
376
  }
377
377
  function Ee() {
378
378
  if (U)
@@ -380,19 +380,19 @@ function Ee() {
380
380
  const e = Ae();
381
381
  return $(e) || m(
382
382
  `当前目录(${x.pwd()})不存在${e}文件,请在项目根目录执行该命令,或者初始化项目(z init .)。`
383
- ), U = j.readJsonSync(e), U;
383
+ ), U = S.readJsonSync(e), U;
384
384
  }
385
385
  function li(e) {
386
386
  U ? U = {
387
387
  ...U,
388
388
  ...e
389
- } : U = e, j.writeJSONSync(Ae(), U, { spaces: 2 });
389
+ } : U = e, S.writeJSONSync(Ae(), U, { spaces: 2 });
390
390
  }
391
391
  function mi(e) {
392
392
  B ? B = {
393
393
  ...B,
394
394
  ...e
395
- } : B = e, j.writeJSONSync(l.join("package.json"), B, { spaces: 2 });
395
+ } : B = e, S.writeJSONSync(l.join("package.json"), B, { spaces: 2 });
396
396
  }
397
397
  const V = {
398
398
  id: 0,
@@ -412,7 +412,7 @@ async function pi() {
412
412
  return V.sourceBranch || (V.sourceBranch = await u("git branch --show-current")), V;
413
413
  }
414
414
  function te() {
415
- j.writeJSONSync(
415
+ S.writeJSONSync(
416
416
  ye(),
417
417
  {
418
418
  main: pe(),
@@ -643,7 +643,7 @@ function Ti(e) {
643
643
  }
644
644
  function ki() {
645
645
  const e = de("fe-groups.json");
646
- return $(e) ? j.readJSONSync(e) : { groups: [] };
646
+ return $(e) ? S.readJSONSync(e) : { groups: [] };
647
647
  }
648
648
  async function Ci() {
649
649
  const e = await $i(), t = Lt.map((i) => {
@@ -654,7 +654,7 @@ async function Ci() {
654
654
  description: n.description
655
655
  } : !1;
656
656
  }).filter((i) => !!i);
657
- j.writeJSONSync(de("fe-groups.json"), { groups: t }, { spaces: 2 });
657
+ S.writeJSONSync(de("fe-groups.json"), { groups: t }, { spaces: 2 });
658
658
  }
659
659
  async function T(e) {
660
660
  const t = `${ee("FEServerDomain")}/api`, { data: i } = await Z({
@@ -1209,7 +1209,7 @@ async function ra() {
1209
1209
  ...o.scripts,
1210
1210
  prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'"
1211
1211
  }
1212
- }), await j.writeFile(l.resolve("README.md"), Ht(e.projectName, e.projectDesc)), s.succeed("模版初始化完成"), await Ce(e.tplLanguage, e.group?.name);
1212
+ }), await S.writeFile(l.resolve("README.md"), Ht(e.projectName, e.projectDesc)), s.succeed("模版初始化完成"), await Ce(e.tplLanguage, e.group?.name);
1213
1213
  const r = w("依赖安装中").start();
1214
1214
  await u("npm install --registry https://registry.npmmirror.com/"), r.succeed("依赖安装完成");
1215
1215
  const c = w("项目推送中").start();
@@ -1443,7 +1443,7 @@ D.command("deploy").alias("d").description("部署到指定环境").argument("[b
1443
1443
  function da() {
1444
1444
  const e = Ae();
1445
1445
  if ($(e)) {
1446
- const t = j.readJsonSync(e);
1446
+ const t = S.readJsonSync(e);
1447
1447
  if (t["lint-staged"])
1448
1448
  return t["lint-staged"];
1449
1449
  throw new Error("未找到lint配置");
@@ -1716,17 +1716,17 @@ async function dt(e, t) {
1716
1716
  priority: e.pri,
1717
1717
  steps: []
1718
1718
  };
1719
- i.steps = await Li(e.id), j.writeJSONSync(t, i, {
1719
+ i.steps = await Li(e.id), S.writeJSONSync(t, i, {
1720
1720
  spaces: 2
1721
1721
  });
1722
1722
  }
1723
1723
  async function ft(e, t) {
1724
1724
  await se(t, {
1725
1725
  recursive: !0
1726
- }), await dt(e, l.join(t, "config.json")), j.ensureFileSync(l.join(t, "data.json")), await M(
1726
+ }), await dt(e, l.join(t, "config.json")), S.ensureFileSync(l.join(t, "data.json")), await M(
1727
1727
  l.join(t, "data.json"),
1728
1728
  $(l.resolve(q, "data.json")) ? await Se(l.resolve(q, "data.json")) : Yt
1729
- ), j.ensureFileSync(l.join(t, "main.py")), await M(
1729
+ ), S.ensureFileSync(l.join(t, "main.py")), await M(
1730
1730
  l.join(t, "main.py"),
1731
1731
  $(l.resolve(q, "main.py")) ? await Se(l.resolve(q, "main.py")) : Xt
1732
1732
  );
@@ -1744,11 +1744,11 @@ function gt(e) {
1744
1744
  async function ve(e, t) {
1745
1745
  oe(), X(), await ce();
1746
1746
  let i;
1747
- t ? ([S.MODULE, S.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${S.MODULE} 或者 ${S.CASE}。`), i = t) : i = await E({
1747
+ t ? ([j.MODULE, j.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${j.MODULE} 或者 ${j.CASE}。`), i = t) : i = await E({
1748
1748
  message: `请选择要${e}的数据类型`,
1749
1749
  choices: Ot
1750
1750
  });
1751
- const n = i === S.MODULE ? "模块" : S.CASE === i ? "用例" : "";
1751
+ const n = i === j.MODULE ? "模块" : j.CASE === i ? "用例" : "";
1752
1752
  return {
1753
1753
  type: i,
1754
1754
  typeStr: n
@@ -1793,7 +1793,7 @@ async function Aa(e, t) {
1793
1793
  }
1794
1794
  async function Ea(e, t) {
1795
1795
  const { type: i, typeStr: n } = await ve("拉取", e), a = await pt(t.productId), s = w(`${n}同步中...`).start();
1796
- if (S.MODULE === i && await Aa(s, a), S.CASE === i && await ja(s, a, t.caseIds), s.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await u("git status -s")) {
1796
+ if (j.MODULE === i && await Aa(s, a), j.CASE === i && await ja(s, a, t.caseIds), s.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await u("git status -s")) {
1797
1797
  const o = w("代码提交中...").start();
1798
1798
  try {
1799
1799
  await u(`git add . && git commit -m "chore: 同步禅道${n}数据"`), o.succeed("代码已提交 ✅");
@@ -1884,7 +1884,7 @@ async function Ra(e, t) {
1884
1884
  validate: (g) => g.length > 0 && g.length < 255
1885
1885
  });
1886
1886
  let f = "";
1887
- if (S.MODULE === i && await ka(s, d, y), S.CASE === i && (f = await Ta(s, d, y)), !t.disableAutoCommit && S.CASE === i) {
1887
+ if (j.MODULE === i && await ka(s, d, y), j.CASE === i && (f = await Ta(s, d, y)), !t.disableAutoCommit && j.CASE === i) {
1888
1888
  const g = w("代码提交中...").start();
1889
1889
  try {
1890
1890
  await u(`git add . && git commit -m "chore: 创建了用例${l.basename(f)}"`), g.succeed("代码已提交 ✅");
@@ -1968,7 +1968,7 @@ async function xa(e, t) {
1968
1968
  async function Da(e, t) {
1969
1969
  const { type: i, typeStr: n } = await ve("删除", e), { localProduct: a } = await xe(t.productId), s = gt(t.targetIds);
1970
1970
  let o = [];
1971
- if (S.MODULE === i ? o = await xa(a, s) : S.CASE === i && (o = await Ia(a, s)), !t.disableAutoCommit && await u("git status -s")) {
1971
+ if (j.MODULE === i ? o = await xa(a, s) : j.CASE === i && (o = await Ia(a, s)), !t.disableAutoCommit && await u("git status -s")) {
1972
1972
  const r = w("代码提交中...").start();
1973
1973
  try {
1974
1974
  await u(`git add . && git commit -m 'chore: 删除了一些${n}(${o.join(", ")})'`), r.succeed("代码已提交 ✅");
@@ -2020,8 +2020,7 @@ async function La(e, t) {
2020
2020
  a.displayName = s, a.path = l.join(l.dirname(a.path), G("case", s, String(a.id))), f && o.succeed(`用例重命名成功: ${a.displayName} -> ${s}`);
2021
2021
  } else
2022
2022
  o.succeed("用例名称无变动");
2023
- const r = j.readJsonSync(l.join(a.path, "config.json"));
2024
- let c;
2023
+ let r = S.readJsonSync(l.join(a.path, "config.json")), c;
2025
2024
  t.casePriority ? Number.isInteger(t.casePriority) && Number(t.casePriority) > 0 && Number(t.casePriority) < 6 ? c = Number(t.casePriority) : c = await Oe({
2026
2025
  message: "修改用例优先级",
2027
2026
  min: 1,
@@ -2041,14 +2040,14 @@ async function La(e, t) {
2041
2040
  c !== r.priority ? (await Ui({
2042
2041
  id: Number(a.id),
2043
2042
  priority: c
2044
- }), j.writeJSONSync(
2043
+ }), S.writeJSONSync(
2045
2044
  l.join(a.path, "config.json"),
2046
2045
  {
2047
2046
  ...r,
2048
2047
  priority: c
2049
2048
  },
2050
2049
  { spaces: 2 }
2051
- ), p.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : p.succeed("用例优先级无变动");
2050
+ ), p.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : p.succeed("用例优先级无变动"), r = S.readJsonSync(l.join(a.path, "config.json"));
2052
2051
  let d;
2053
2052
  t.casePrecondition ? d = t.casePrecondition : d = await _({
2054
2053
  message: "修改用例前置条件",
@@ -2059,14 +2058,14 @@ async function La(e, t) {
2059
2058
  return d !== r.precondition ? (await Ji({
2060
2059
  id: Number(a.id),
2061
2060
  precondition: d
2062
- }), j.writeJSONSync(
2061
+ }), S.writeJSONSync(
2063
2062
  l.join(a.path, "config.json"),
2064
2063
  {
2065
2064
  ...r,
2066
2065
  precondition: d
2067
2066
  },
2068
2067
  { spaces: 2 }
2069
- ), y.succeed(`用例前置条件修改成功:${r.priority} -> ${c}`)) : y.succeed("用例前置条件无变动"), a.id;
2068
+ ), y.succeed(`用例前置条件修改成功:${r.precondition} -> ${d}`)) : y.succeed("用例前置条件无变动"), a.id;
2070
2069
  }
2071
2070
  async function Pa(e, t) {
2072
2071
  const n = (await Y(e.path)).filter((r) => r.type === "module");
@@ -2109,7 +2108,7 @@ async function Pa(e, t) {
2109
2108
  async function Oa(e, t) {
2110
2109
  const { type: i, typeStr: n } = await ve("修改", e), { localProduct: a } = await xe(t.productId);
2111
2110
  let s;
2112
- if (S.MODULE === i ? s = await Pa(a, t) : S.CASE === i && (s = await La(a, t)), !t.disableAutoCommit && await u("git status -s")) {
2111
+ if (j.MODULE === i ? s = await Pa(a, t) : j.CASE === i && (s = await La(a, t)), !t.disableAutoCommit && await u("git status -s")) {
2113
2112
  const o = w("代码提交中...").start();
2114
2113
  try {
2115
2114
  await u(`git add . && git commit -m 'chore: 修改了一个${n}(${s})'`), o.succeed("代码已提交 ✅");
@@ -2147,7 +2146,7 @@ async function Fa() {
2147
2146
  const e = Ct(process.argv.slice(2));
2148
2147
  if (!(e.h || e.help || e.v || e.version) && !(["init", "i"].includes(e._[0]) && ![".", "prepare"].includes(e._[1])))
2149
2148
  if (qe()) {
2150
- const t = j.readJSONSync(ye());
2149
+ const t = S.readJSONSync(ye());
2151
2150
  L(t.profile), ne(t.main), Te(t.constants), await za();
2152
2151
  } else
2153
2152
  m(`请先初始化z-develop(执行 z i)。更多见${We}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-z-develop",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "技术团队开发流程管理工具",
5
5
  "main": "dist/index.js",
6
6
  "bin": {