mine-auto-cli 2.6.2 → 2.6.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 +94 -148
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,72 +1,18 @@
1
- import { program as u } from "commander";
1
+ import { program as d } from "commander";
2
2
  import l from "chalk";
3
- import { readFileSync as y, writeFileSync as b, existsSync as j, readdirSync as ce, cpSync as ae, rmSync as le } from "fs";
4
- import { join as g, resolve as w } from "path";
3
+ import { readFileSync as y, writeFileSync as j, existsSync as w, readdirSync as ie, cpSync as ae, rmSync as le } from "fs";
4
+ import { join as g, resolve as b } from "path";
5
5
  import H from "log-symbols";
6
6
  import pe from "ora";
7
7
  import { execSync as N } from "child_process";
8
8
  import me from "js-yaml";
9
- import de from "strip-json-comments";
10
- import ue from "pacote";
9
+ import ue from "strip-json-comments";
10
+ import de from "pacote";
11
11
  import { parseRange as V } from "semver-utils";
12
12
  import ge from "download-git-repo";
13
13
  import A from "inquirer";
14
14
  import fe from "update-notifier";
15
- const K = "mine-auto-cli", Q = "2.6.2", he = "./dist/index.js", ye = "./dist/index.js", $e = "module", ve = {
16
- auto: "bin/mine-auto-cli.js"
17
- }, be = {
18
- name: "biaov",
19
- email: "biaov@qq.com",
20
- url: "https://biaov.cn"
21
- }, je = "一个将多个命令简化成一个命令的工具 😆", we = {
22
- start: "npm run dev",
23
- dev: "npm run build -- --watch",
24
- build: "vite build",
25
- prettier: "prettier --write '**/*.{js,ts,md,json}'",
26
- tag: "node scripts/tag"
27
- }, Se = {
28
- registry: "https://registry.npmjs.org/",
29
- "engine-strict": !0,
30
- provenance: !0
31
- }, ke = {
32
- node: ">=22.11"
33
- }, Ce = [
34
- "auto",
35
- "cli",
36
- "vite",
37
- "typescript"
38
- ], xe = {
39
- type: "git",
40
- url: "git+https://github.com/biaov/mine-auto-cli.git"
41
- }, Oe = "https://github.com/biaov/mine-auto-cli.git", Ne = {
42
- url: "https://github.com/biaov/mine-auto-cli/issues"
43
- }, Je = "ISC", Pe = [
44
- {
45
- name: "biaov",
46
- email: "biaov@qq.com"
47
- }
48
- ], De = {
49
- chalk: "^5.4.1",
50
- commander: "^13.0.0",
51
- "download-git-repo": "^3.0.2",
52
- inquirer: "^12.3.2",
53
- "js-yaml": "^4.1.0",
54
- "log-symbols": "^7.0.0",
55
- ora: "^8.1.1",
56
- pacote: "^21.0.0",
57
- "semver-utils": "^1.1.4",
58
- "strip-json-comments": "^5.0.1",
59
- "update-notifier": "^7.3.1"
60
- }, Ee = {
61
- "@types/js-yaml": "^4.0.9",
62
- "@types/node": "^22.10.6",
63
- "@types/pacote": "^11.1.8",
64
- "@types/semver-utils": "^1.1.3",
65
- "@types/update-notifier": "^6.0.8",
66
- prettier: "^3.4.2",
67
- typescript: "^5.7.3",
68
- vite: "^5.4.11"
69
- }, O = {
15
+ const K = "mine-auto-cli", Q = "2.6.3", he = "./dist/index.js", ye = "./dist/index.js", $e = "module", ve = { auto: "bin/mine-auto-cli.js" }, je = { name: "biaov", email: "biaov@qq.com", url: "https://biaov.cn" }, we = "一个将多个命令简化成一个命令的工具 😆", be = { start: "npm run dev", dev: "npm run build -- --watch", build: "vite build", prettier: "prettier --write '**/*.{js,ts,md,json}'", tag: "node scripts/tag" }, Se = { registry: "https://registry.npmjs.org/", "engine-strict": !0, provenance: !0 }, ke = { node: ">=22.11" }, Ce = ["auto", "cli", "vite", "typescript"], xe = { type: "git", url: "git+https://github.com/biaov/mine-auto-cli.git" }, Oe = "https://github.com/biaov/mine-auto-cli.git", Ne = { url: "https://github.com/biaov/mine-auto-cli/issues" }, Je = "ISC", Pe = [{ name: "biaov", email: "biaov@qq.com" }], De = { chalk: "^5.4.1", commander: "^14.0.0", "download-git-repo": "^3.0.2", inquirer: "^12.6.3", "js-yaml": "^4.1.0", "log-symbols": "^7.0.1", ora: "^8.2.0", pacote: "^21.0.0", "semver-utils": "^1.1.4", "strip-json-comments": "^5.0.2", "update-notifier": "^7.3.1" }, Ee = { "@types/js-yaml": "^4.0.9", "@types/node": "^22.15.21", "@types/pacote": "^11.1.8", "@types/semver-utils": "^1.1.3", "@types/update-notifier": "^6.0.8", prettier: "^3.5.3", typescript: "^5.8.3", vite: "^6.3.5" }, O = {
70
16
  name: K,
71
17
  private: !1,
72
18
  version: Q,
@@ -74,9 +20,9 @@ const K = "mine-auto-cli", Q = "2.6.2", he = "./dist/index.js", ye = "./dist/ind
74
20
  main: ye,
75
21
  type: $e,
76
22
  bin: ve,
77
- author: be,
78
- description: je,
79
- scripts: we,
23
+ author: je,
24
+ description: we,
25
+ scripts: be,
80
26
  publishConfig: Se,
81
27
  engines: ke,
82
28
  keywords: Ce,
@@ -102,25 +48,25 @@ const K = "mine-auto-cli", Q = "2.6.2", he = "./dist/index.js", ye = "./dist/ind
102
48
  }, Ve = (e) => ["git add -A", `git commit -m ${e}`, "git push"], Me = (e, t) => [`npm run ${e}`, "git add -A", `git commit -m ${t}`, "git push"], Ie = async (e, t = "打包") => {
103
49
  a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(), Me(e, t).map(W), f("全部命令执行完成"), a();
104
50
  }, F = (e) => {
105
- a(), J(`\`${e}\` 命令错误,请检查你的命令`), a(), u.help();
51
+ a(), J(`\`${e}\` 命令错误,请检查你的命令`), a(), d.help();
106
52
  }, R = (e) => {
107
- const t = ["package.json", "README.md"].map((i) => {
108
- const r = g(process.cwd(), i), c = y(r).toString();
109
- return { path: r, content: c };
53
+ const t = ["package.json", "README.md"].map((c) => {
54
+ const r = g(process.cwd(), c), i = y(r).toString();
55
+ return { path: r, content: i };
110
56
  }), [o, n] = t, s = JSON.parse(o.content);
111
57
  if (e)
112
58
  s.version = e;
113
59
  else {
114
- const i = s.version.split(".").reduce((r, c, p, m) => r + (p === m.length - 1 ? +c + 1 : `${c}.`), "");
115
- s.version = i;
60
+ const c = s.version.split(".").reduce((r, i, p, m) => r + (p === m.length - 1 ? +i + 1 : `${i}.`), "");
61
+ s.version = c;
116
62
  }
117
- b(o.path, JSON.stringify(s, null, 2)), n.content = n.content.replace(/version\-v.+\-blue/, () => `version-v${s.version}-blue`), b(n.path, n.content);
63
+ j(o.path, JSON.stringify(s, null, 2)), n.content = n.content.replace(/version\-v.+\-blue/, () => `version-v${s.version}-blue`), j(n.path, n.content);
118
64
  }, Le = async (e) => {
119
65
  const t = e.split("version")[1];
120
66
  if (!t) return F(e);
121
67
  const o = JSON.parse(y(g(process.cwd(), "package.json")).toString());
122
68
  if (t === "++") {
123
- const s = o.version.split(".").reduce((i, r, c, p) => i + (c === p.length - 1 ? +r + 1 : `${r}.`), "");
69
+ const s = o.version.split(".").reduce((c, r, i, p) => c + (i === p.length - 1 ? +r + 1 : `${r}.`), "");
124
70
  R(s), a(), f("命令执行完成");
125
71
  return;
126
72
  }
@@ -129,7 +75,7 @@ const K = "mine-auto-cli", Q = "2.6.2", he = "./dist/index.js", ye = "./dist/ind
129
75
  }, Ae = (e, t) => {
130
76
  if (e.includes("build")) return Ie(e, t);
131
77
  if (e.includes("version")) return Le(e);
132
- J(l.hex("#f56c6c")(`\`auto ${e}${t ? ` ${t}` : ""}\` 命令不存在`)), u.help();
78
+ J(l.hex("#f56c6c")(`\`auto ${e}${t ? ` ${t}` : ""}\` 命令不存在`)), d.help();
133
79
  }, v = "https://gitee.com/biaovorg/project-template.git", Fe = {
134
80
  vue: v,
135
81
  react: v,
@@ -140,21 +86,21 @@ const K = "mine-auto-cli", Q = "2.6.2", he = "./dist/index.js", ye = "./dist/ind
140
86
  }, Re = Object.keys(Fe);
141
87
  Re.reduce((e, t, o) => e + (o ? ", " : "") + t, "");
142
88
  const h = (e = "jsonc") => `auto-cli.${e}`;
143
- w(import.meta.dirname, "./presetData.json");
89
+ b(import.meta.dirname, "./presetData.json");
144
90
  const X = (e, t = !1) => {
145
- if (!j(e)) return t ? {} : "";
91
+ if (!w(e)) return t ? {} : "";
146
92
  const o = y(e).toString();
147
- return t ? JSON.parse(de(o)) : o;
93
+ return t ? JSON.parse(ue(o)) : o;
148
94
  }, Te = (e) => {
149
- if (!j(e)) return {};
95
+ if (!w(e)) return {};
150
96
  const t = y(e).toString();
151
97
  try {
152
98
  return me.load(t);
153
99
  } catch {
154
100
  return {};
155
101
  }
156
- }, Z = (e = !1) => X(w(import.meta.dirname, h()), e), ee = () => {
157
- const [e, t] = [h(), h("yml")].map((n) => w(process.cwd(), n)), o = Z(!0);
102
+ }, Z = (e = !1) => X(b(import.meta.dirname, h()), e), ee = () => {
103
+ const [e, t] = [h(), h("yml")].map((n) => b(process.cwd(), n)), o = Z(!0);
158
104
  try {
159
105
  Object.assign(o, Te(t), X(e, !0));
160
106
  } catch {
@@ -167,52 +113,52 @@ const X = (e, t = !1) => {
167
113
  `, "") : o;
168
114
  }, Ue = ({ yml: e, uncomment: t, force: o }) => {
169
115
  a();
170
- const n = h(e ? "yml" : "jsonc"), s = w(process.cwd(), n);
171
- if (j(s) && !o) {
116
+ const n = h(e ? "yml" : "jsonc"), s = b(process.cwd(), n);
117
+ if (w(s) && !o) {
172
118
  a(l.yellow(`${n} 文件已存在`)), a(), a(l.yellow(`文件目录 ${s}`));
173
119
  return;
174
120
  }
175
- b(s, qe(n, t)), f(`${n} 文件创建成功`), a(), a(l.green(`文件目录 ${s}`));
121
+ j(s, qe(n, t)), f(`${n} 文件创建成功`), a(), a(l.green(`文件目录 ${s}`));
176
122
  };
177
- u.command("init").option("-f, --force", `强制替换 ${h()} 文件内容`, !1).option("-unc, --uncomment", `取消生成 ${h()} 带注释`, !1).option("-y, --yml", `生成 ${h("yml")} 文件`, !1).description("初始化配置文件").action(Ue);
123
+ d.command("init").option("-f, --force", `强制替换 ${h()} 文件内容`, !1).option("--unc, --uncomment", `取消生成 ${h()} 带注释`, !1).option("-y, --yml", `生成 ${h("yml")} 文件`, !1).description("初始化配置文件").action(Ue);
178
124
  const Ge = async (e = "更新代码") => {
179
125
  a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(), Ve(e).forEach(W), f("全部命令执行完成"), a();
180
126
  };
181
- u.command("git [描述]").description("简化 Git 提交命令").action(Ge);
127
+ d.command("git [描述]").description("简化 Git 提交命令").action(Ge);
182
128
  const T = ["dist", "node_modules", ".git", "miniprogram_npm"];
183
129
  let P = 0, te = !1, M = !1, ne = 20;
184
130
  const q = ({ prev: e, i: t, index: o, arr: n, curText: s }) => {
185
- const i = Array.from({ length: t }).reduce((m) => m + `${t === 1 && o === n.length - 1 ? "└ " : "│ "} `, ""), r = e + i, c = (i + s).length, p = Array.from({ length: ne + P - c }).reduce((m) => `${m}-`, " ");
186
- return !te && (P = Math.max(P, c)), `${r}${s}${M ? p : ""}
131
+ const c = Array.from({ length: t }).reduce((m) => m + `${t === 1 && o === n.length - 1 ? "└ " : "│ "} `, ""), r = e + c, i = (c + s).length, p = Array.from({ length: ne + P - i }).reduce((m) => `${m}-`, " ");
132
+ return !te && (P = Math.max(P, i)), `${r}${s}${M ? p : ""}
187
133
  `;
188
- }, I = (e, t = 0) => e.reduce((o, n, s, i) => {
134
+ }, I = (e, t = 0) => e.reduce((o, n, s, c) => {
189
135
  let r;
190
- return n.children ? (r = `├── ${n.name}`, q({ prev: o, i: t, index: s, arr: i, curText: r }) + I(n.children, t + 1)) : (r = `${s === i.length - 1 ? "└── " : "├── "}${n.name}`, q({ prev: o, i: t, index: s, arr: i, curText: r }));
191
- }, ""), U = (e) => ce(e, { withFileTypes: !0 }).sort((t, o) => +o.isDirectory() - +t.isDirectory()), _e = ({ line: e, name: t }) => {
136
+ return n.children ? (r = `├── ${n.name}`, q({ prev: o, i: t, index: s, arr: c, curText: r }) + I(n.children, t + 1)) : (r = `${s === c.length - 1 ? "└── " : "├── "}${n.name}`, q({ prev: o, i: t, index: s, arr: c, curText: r }));
137
+ }, ""), U = (e) => ie(e, { withFileTypes: !0 }).sort((t, o) => +o.isDirectory() - +t.isDirectory()), _e = ({ line: e, name: t }) => {
192
138
  M = !!e, typeof e == "string" && (ne = +e);
193
139
  const o = process.cwd(), n = g(o, ".gitignore");
194
- if (j(n)) {
140
+ if (w(n)) {
195
141
  const p = y(n).toString().split(`\r
196
142
  `);
197
143
  T.push(...p);
198
144
  }
199
145
  const s = o.split("\\").at(-1), r = U(o).map((p) => {
200
- const { name: m } = p, d = { name: m };
201
- return !T.includes(m) && p.isDirectory() && (d.children = U(g(p.path, m)).map(({ name: S }) => ({ name: S }))), d;
202
- }), c = [{ name: s, children: r }];
203
- M && (I(c), te = !0), b(g(o, `${typeof t == "string" && t || "directory"}.md`), I(c));
146
+ const { name: m } = p, u = { name: m };
147
+ return !T.includes(m) && p.isDirectory() && (u.children = U(g(p.path, m)).map(({ name: S }) => ({ name: S }))), u;
148
+ }), i = [{ name: s, children: r }];
149
+ M && (I(i), te = !0), j(g(o, `${typeof t == "string" && t || "directory"}.md`), I(i));
204
150
  };
205
- u.command("mkdir").option("-l, --line [数量]", "数量", !1).option("-n, --name [文件名称]", "文件名称", !1).option("-d, --depth [深度值]", "深度值", "3").description("生成目录结构文件").action(_e);
206
- const k = ee(), [D] = ["package.json"].map((e) => w(process.cwd(), e)), Be = (e, t) => {
207
- const o = Array.from({ length: t }, (r, c) => c < e ? "=" : " ").join(""), n = ~~(e / t * 100), s = `\r查找进度:[${o}] ${e}/${t} ${n}%\r`, i = e === t ? l.green(s) : l.yellow(s);
208
- process.stdout.write(i);
151
+ d.command("mkdir").option("-l, --line [数量]", "数量", !1).option("-n, --name [文件名称]", "文件名称", !1).option("-d, --depth [深度值]", "深度值", "3").description("生成目录结构文件").action(_e);
152
+ const k = ee(), [D] = ["package.json"].map((e) => b(process.cwd(), e)), Be = (e, t) => {
153
+ const o = Array.from({ length: t }, (r, i) => i < e ? "=" : " ").join(""), n = ~~(e / t * 100), s = `\r查找进度:[${o}] ${e}/${t} ${n}%\r`, c = e === t ? l.green(s) : l.yellow(s);
154
+ process.stdout.write(c);
209
155
  }, Ye = (e, t, o) => {
210
156
  let n = "latest";
211
- k.resolve.some((i) => {
212
- const r = i.lastIndexOf("@");
157
+ k.resolve.some((c) => {
158
+ const r = c.lastIndexOf("@");
213
159
  if (r <= 0) return !0;
214
- const c = i.slice(0, r), p = i.slice(r + 1);
215
- if (e === c)
160
+ const i = c.slice(0, r), p = c.slice(r + 1);
161
+ if (e === i)
216
162
  return n = p, !0;
217
163
  });
218
164
  const s = k.prefix + o[n];
@@ -221,52 +167,52 @@ const k = ee(), [D] = ["package.json"].map((e) => w(process.cwd(), e)), Be = (e,
221
167
  const [{ major: t = 0, minor: o = 0, patch: n = 0, release: s = "" }] = V(e);
222
168
  return [+t, +o, +n, s];
223
169
  }, Ke = (e, t) => {
224
- const [o, n, s, i] = G(e), [r, c, p, m] = G(t);
225
- return r > o ? l.red(t) : r < o ? !1 : c > n ? `${r}.${l.yellow(c)}.${l.yellow(p)}` : c < n ? !1 : p > s ? `${r}.${c}.${l.green(p)}` : p === s && m && m !== i ? `${r}.${c}.${p}-${l.green(m)}` : !1;
170
+ const [o, n, s, c] = G(e), [r, i, p, m] = G(t);
171
+ return r > o ? l.red(t) : r < o ? !1 : i > n ? `${r}.${l.yellow(i)}.${l.yellow(p)}` : i < n ? !1 : p > s ? `${r}.${i}.${l.green(p)}` : p === s && m && m !== c ? `${r}.${i}.${p}-${l.green(m)}` : !1;
226
172
  }, Qe = (e) => {
227
173
  const t = {};
228
174
  e.forEach((n) => {
229
- Object.entries(n).forEach(([s, i]) => {
230
- t[s] = Math.max(i.length, t[s] ?? 0);
175
+ Object.entries(n).forEach(([s, c]) => {
176
+ t[s] = Math.max(c.length, t[s] ?? 0);
231
177
  });
232
178
  }), e.unshift({ name: "包名", value: "版本", newVersion: "新版本", tag: "标签" });
233
179
  const o = [];
234
- e.forEach(({ name: n, value: s, newVersion: i, tag: r }, c) => {
235
- const [p, m, d, S] = Object.entries({ name: n, value: s, newVersion: i, tag: r }).map(([C, ie]) => ze(He(ie, c), t[C]));
180
+ e.forEach(({ name: n, value: s, newVersion: c, tag: r }, i) => {
181
+ const [p, m, u, S] = Object.entries({ name: n, value: s, newVersion: c, tag: r }).map(([C, ce]) => ze(He(ce, i), t[C]));
236
182
  let $ = l.yellow("→"), L = !0;
237
- if (c) {
238
- const C = Ke(s, i);
239
- C ? i = C : L = !1;
183
+ if (i) {
184
+ const C = Ke(s, c);
185
+ C ? c = C : L = !1;
240
186
  } else
241
- n = l.green(n), s = l.green(s), i = l.green(i), r = l.green(r), $ = " ";
242
- const re = `${n + p} ${m + s} ${$} ${d + i} ${S + r}`;
187
+ n = l.green(n), s = l.green(s), c = l.green(c), r = l.green(r), $ = " ";
188
+ const re = `${n + p} ${m + s} ${$} ${u + c} ${S + r}`;
243
189
  L && o.push(re);
244
190
  }), o.length > 1 ? o.forEach(a) : f("所有版本已是最新");
245
191
  }, We = async (e, t, o) => {
246
192
  a();
247
193
  let n = 0;
248
- const s = [], i = Object.entries(e), r = i.map(async ([c, p]) => {
249
- const m = await ue.packument(c, { registry: k.registry }), d = Ye(c, p, m["dist-tags"]);
250
- s.push(d), t.forEach((S) => {
194
+ const s = [], c = Object.entries(e), r = c.map(async ([i, p]) => {
195
+ const m = await de.packument(i, { registry: k.registry }), u = Ye(i, p, m["dist-tags"]);
196
+ s.push(u), t.forEach((S) => {
251
197
  const $ = o[S];
252
- $ && $[c] && ($[c] = d.newVersion);
253
- }), n++, await Be(n, i.length);
198
+ $ && $[i] && ($[i] = u.newVersion);
199
+ }), n++, await Be(n, c.length);
254
200
  });
255
201
  return await Promise.all(r), a(), a(), s;
256
202
  }, Xe = async ({ update: e }) => {
257
- if (!j(D)) return J("package.json 文件不存在");
258
- const t = e || k.check, o = y(D).toString(), n = JSON.parse(o), s = ["dependencies", "devDependencies", "optionalDependencies"], i = {}, r = JSON.parse(o);
203
+ if (!w(D)) return J("package.json 文件不存在");
204
+ const t = e || k.check, o = y(D).toString(), n = JSON.parse(o), s = ["dependencies", "devDependencies", "optionalDependencies"], c = {}, r = JSON.parse(o);
259
205
  s.forEach((p) => {
260
- n[p] && Object.entries(n[p]).forEach(([m, d]) => {
261
- !k.reject.includes(m) && (i[m] = d);
206
+ n[p] && Object.entries(n[p]).forEach(([m, u]) => {
207
+ !k.reject.includes(m) && (c[m] = u);
262
208
  });
263
209
  });
264
- const c = await We(i, s, r);
265
- t ? (b(D, JSON.stringify(r, null, 2)), f("文件 package.json 已更新"), a()) : Qe(c);
210
+ const i = await We(c, s, r);
211
+ t ? (j(D, JSON.stringify(r, null, 2)), f("文件 package.json 已更新"), a()) : Qe(i);
266
212
  };
267
- u.command("check").option("-u, --update", "更新 package.json 依赖内容", !1).description("升级 package.json 依赖版本").action(Xe);
268
- const Ze = ee(), oe = "comment.md", et = ["package.json", oe], [_, B] = et.map((e) => w(process.cwd(), e)), tt = () => {
269
- if (!j(_)) return J("package.json 文件不存在");
213
+ d.command("check").option("-u, --update", "更新 package.json 依赖内容", !1).description("升级 package.json 依赖版本").action(Xe);
214
+ const Ze = ee(), oe = "comment.md", et = ["package.json", oe], [_, B] = et.map((e) => b(process.cwd(), e)), tt = () => {
215
+ if (!w(_)) return J("package.json 文件不存在");
270
216
  const e = y(_).toString(), t = JSON.parse(e), o = ["dependencies", "devDependencies", "optionalDependencies"];
271
217
  let n = `### 依赖解析
272
218
 
@@ -274,25 +220,25 @@ const Ze = ee(), oe = "comment.md", et = ["package.json", oe], [_, B] = et.map((
274
220
  o.forEach((s) => {
275
221
  t[s] && (n += `#### ${s}
276
222
 
277
- `, Object.keys(t[s]).forEach((i) => {
278
- n += `- \`${i}\`: ${Ze.comment[i] || ""}
223
+ `, Object.keys(t[s]).forEach((c) => {
224
+ n += `- \`${c}\`: ${Ze.comment[c] || ""}
279
225
  `;
280
226
  }), n += `
281
227
  `);
282
- }), n = n.slice(0, -1), b(B, n), a(), f(`${oe} 文件创建成功`), a(), a(l.green(`文件目录 ${B}`));
228
+ }), n = n.slice(0, -1), j(B, n), a(), f(`${oe} 文件创建成功`), a(), a(l.green(`文件目录 ${B}`));
283
229
  };
284
- u.command("comment").description("生成依赖注释文件").action(tt);
230
+ d.command("comment").description("生成依赖注释文件").action(tt);
285
231
  const Y = { recursive: !0, force: !0 }, nt = () => {
286
232
  const e = `${+/* @__PURE__ */ new Date()}`, t = g(process.cwd()), o = g(t, e);
287
233
  ge("direct:https://gitee.com/biaovorg/vscode-config.git#master", o, { clone: !0 }, async (n) => {
288
234
  !n && ae(g(o, ".vscode"), g(t, ".vscode"), Y), le(o, Y);
289
235
  });
290
236
  };
291
- u.command("vscode-config").description("更新 .vscode 配置文件").action(nt);
237
+ d.command("vscode-config").description("更新 .vscode 配置文件").action(nt);
292
238
  const se = (e, t, o) => {
293
- const n = Object.entries(t), s = n.findIndex(([c]) => e === c), [i, r] = n[s];
239
+ const n = Object.entries(t), s = n.findIndex(([i]) => e === i), [c, r] = n[s];
294
240
  if (r) {
295
- if (o[i] === r) return s === n.length - 1 ? !0 : se(n[s + 1][0], t, o);
241
+ if (o[c] === r) return s === n.length - 1 ? !0 : se(n[s + 1][0], t, o);
296
242
  } else
297
243
  return !0;
298
244
  }, z = (e) => {
@@ -300,26 +246,26 @@ const se = (e, t, o) => {
300
246
  }, E = (e) => {
301
247
  e && N(`nvm install ${e}`);
302
248
  }, ot = (e, t) => {
303
- const o = N("nvm ls").toString(), n = V(o), [{ major: s, minor: i, patch: r }] = V(e), c = [], p = n.find((m) => {
249
+ const o = N("nvm ls").toString(), n = V(o), [{ major: s, minor: c, patch: r }] = V(e), i = [], p = n.find((m) => {
304
250
  if (m.major === s)
305
- return c.push(m), se("minor", { minor: i, patch: r }, m);
251
+ return i.push(m), se("minor", { minor: c, patch: r }, m);
306
252
  });
307
253
  if (p)
308
254
  z(p.semver);
309
- else if (a(), a(l.red(`输入的版本 ${e} 不存在`)), a(), c.length) {
310
- const m = c.map((d) => d.semver);
255
+ else if (a(), a(l.red(`输入的版本 ${e} 不存在`)), a(), i.length) {
256
+ const m = i.map((u) => u.semver);
311
257
  A.prompt({
312
258
  type: "list",
313
259
  name: "preset",
314
260
  message: "请选择相似版本或输入版本进行安装:",
315
261
  choices: [...m, e, "取消"]
316
- }).then(({ preset: d }) => {
317
- if (d !== "取消")
318
- if (d === e) {
262
+ }).then(({ preset: u }) => {
263
+ if (u !== "取消")
264
+ if (u === e) {
319
265
  if (!r) return;
320
- E(d);
266
+ E(u);
321
267
  } else
322
- z(d);
268
+ z(u);
323
269
  });
324
270
  } else {
325
271
  if (!r) return;
@@ -336,14 +282,14 @@ const se = (e, t, o) => {
336
282
  });
337
283
  }
338
284
  };
339
- u.command("node [版本号]").option("-i, --install", "是否安装此版本", !1).description("切换 node 版本,默认选择第一个版本").action(ot);
340
- u.usage("[commands] [options]").version(Q, "-v, --version", "输出版本号").helpOption("-h, --help", "输出所有命令");
341
- u.command("build[:环境] [描述]").description("简化打包提交命令");
342
- u.command("version<[++]|[@<版本号>]>").description("例如:version++ 或者 version@1.0.0;自动更新 package.json 版本号,自动更新 `README.md` 中的 `version-v<version>-blue` 图标版本");
343
- u.arguments("<cmd> [env]").action((e, t) => {
285
+ d.command("node [版本号]").option("-i, --install", "是否安装此版本", !1).description("切换 node 版本,默认选择第一个版本").action(ot);
286
+ d.usage("[commands] [options]").version(Q, "-v, --version", "输出版本号").helpOption("-h, --help", "输出所有命令");
287
+ d.command("build[:环境] [描述]").description("简化打包提交命令");
288
+ d.command("version<[++]|[@<版本号>]>").description("例如:version++ 或者 version@1.0.0;自动更新 package.json 版本号,自动更新 `README.md` 中的 `version-v<version>-blue` 图标版本");
289
+ d.arguments("<cmd> [env]").action((e, t) => {
344
290
  Ae(e, t);
345
291
  });
346
- process.argv.length < 3 ? u.help() : u.parse(process.argv);
292
+ process.argv.length < 3 ? d.help() : d.parse(process.argv);
347
293
  const x = fe({ pkg: O, updateCheckInterval: 1e3 * 1 });
348
294
  if (x.update && x.update.latest !== O.version) {
349
295
  let e = "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mine-auto-cli",
3
3
  "private": false,
4
- "version": "2.6.2",
4
+ "version": "2.6.3",
5
5
  "exports": "./dist/index.js",
6
6
  "main": "./dist/index.js",
7
7
  "type": "module",
@@ -46,15 +46,15 @@
46
46
  ],
47
47
  "dependencies": {
48
48
  "chalk": "^5.4.1",
49
- "commander": "^13.0.0",
49
+ "commander": "^14.0.0",
50
50
  "download-git-repo": "^3.0.2",
51
- "inquirer": "^12.3.2",
51
+ "inquirer": "^12.6.3",
52
52
  "js-yaml": "^4.1.0",
53
- "log-symbols": "^7.0.0",
54
- "ora": "^8.1.1",
53
+ "log-symbols": "^7.0.1",
54
+ "ora": "^8.2.0",
55
55
  "pacote": "^21.0.0",
56
56
  "semver-utils": "^1.1.4",
57
- "strip-json-comments": "^5.0.1",
57
+ "strip-json-comments": "^5.0.2",
58
58
  "update-notifier": "^7.3.1"
59
59
  },
60
60
  "devDependencies": {}