@done-coding/cli-config 0.1.14-alpha.0 → 0.1.14-alpha.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/es/cli.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-c3a8e382.js";
2
+ import { c as m } from "./index-6be7f8d5.js";
3
3
  import "@done-coding/cli-utils";
4
4
  import "node:fs";
5
5
  import "node:path";
6
- import "node:child_process";
7
6
  m();
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { readConfigFile as B, outputConsole as i, getPackageJson as Q, getRelyPkgVersion as X, getConfigFileCommonOptions as Y, readCliModuleAssetsConfig as Z, xPrompts as w, addPackageConfig as ee, addHuskyHooks as te, createSubcommand as J, getRootScriptName as ne, createMainCommand as oe } from "@done-coding/cli-utils";
3
- import k, { existsSync as C } from "node:fs";
2
+ import { readConfigFile as B, outputConsole as i, getPackageJson as Q, getRelyPkgVersion as X, getConfigFileCommonOptions as Y, readCliModuleAssetsConfig as Z, execSyncHijack as k, xPrompts as w, addPackageConfig as ee, addHuskyHooks as te, createSubcommand as H, getRootScriptName as ne, createMainCommand as oe } from "@done-coding/cli-utils";
3
+ import N, { existsSync as C } from "node:fs";
4
4
  import g from "node:path";
5
- import { execSync as N } from "node:child_process";
6
5
  var y = /* @__PURE__ */ ((e) => (e.CHECK = "check", e.ADD = "add", e))(y || {}), m = /* @__PURE__ */ ((e) => (e.ESLINT = "eslint", e.PRETTIER = "prettier", e.COMMITLINT = "commitlint", e.LSLINT = "ls-lint", e.MERGELINT = "merge-lint", e))(m || {});
7
6
  const L = {
8
7
  name: "@done-coding/cli-config",
9
- version: "0.1.14-alpha.0",
8
+ version: "0.1.14-alpha.2",
10
9
  description: "工程化配置命令行工具",
11
10
  bin: {
12
11
  "dc-config": "es/cli.mjs"
@@ -77,7 +76,7 @@ const L = {
77
76
  ],
78
77
  [m.LSLINT]: [`.${n}.yaml`, `.${n}.yml`],
79
78
  [m.MERGELINT]: [".done-coding/git.json"]
80
- }, me = (e, t) => t.filter((o) => C(g.resolve(e, o))), _ = (e) => e.filter((t) => {
79
+ }, me = (e, t) => t.filter((o) => C(g.resolve(e, o))), J = (e) => e.filter((t) => {
81
80
  const o = I.includes(t);
82
81
  return o || i.warn(
83
82
  `当前不支持${t}的配置检测, 支持的类型有${I.join(
@@ -88,7 +87,7 @@ const L = {
88
87
  config: e,
89
88
  rootDir: t
90
89
  }) => {
91
- const { moduleList: o = [] } = e, s = _(o);
90
+ const { moduleList: o = [] } = e, s = J(o);
92
91
  i.stage(`开始获取${s.join(", ")}配置信息...`);
93
92
  const r = Q({ rootDir: t });
94
93
  return s.reduce(
@@ -112,7 +111,7 @@ const L = {
112
111
  },
113
112
  {}
114
113
  );
115
- }, H = () => ({
114
+ }, _ = () => ({
116
115
  ...Y({
117
116
  configPathDefault: ce
118
117
  }),
@@ -135,12 +134,12 @@ ${JSON.stringify(o, null, 2)}`), {
135
134
  }, ue = {
136
135
  command: y.CHECK,
137
136
  describe: "检测工程化配置",
138
- options: H(),
137
+ options: _(),
139
138
  handler: E
140
139
  }, {
141
140
  cliConfig: { moduleName: fe }
142
141
  } = L, ge = () => ({
143
- ...H(),
142
+ ..._(),
144
143
  commitGit: {
145
144
  type: "boolean",
146
145
  alias: "g",
@@ -206,10 +205,13 @@ ${JSON.stringify(o, null, 2)}`), {
206
205
  }, ye = ({ rootDir: e, list: t }) => {
207
206
  i.stage(`开始安装依赖包: ${JSON.stringify(t, null, 2)}`);
208
207
  const o = g.resolve(e, "pnpm-workspace.yaml"), s = C(o);
209
- N(`pnpm add -D ${s ? "-w" : ""} ${t.join(" ")}`, {
210
- cwd: e,
211
- stdio: "inherit"
212
- });
208
+ k(
209
+ `pnpm add -D ${s ? "-w" : ""} ${t.join(" ")}`,
210
+ {
211
+ cwd: e,
212
+ stdio: "inherit"
213
+ }
214
+ );
213
215
  }, Le = async ({
214
216
  hooksConfig: e,
215
217
  argv: t
@@ -279,7 +281,7 @@ ${JSON.stringify($, null, 2)}`), await ee({
279
281
  throw new Error(
280
282
  `${o} 预设列表文件 ${s} 不存在`
281
283
  );
282
- const r = k.readFileSync(s, "utf-8");
284
+ const r = N.readFileSync(s, "utf-8");
283
285
  return JSON.parse(
284
286
  r
285
287
  );
@@ -291,7 +293,7 @@ ${JSON.stringify($, null, 2)}`), await ee({
291
293
  return e;
292
294
  }
293
295
  }, b = async (e) => {
294
- const { config: t, info: o } = await E(e), { moduleList: s = [] } = t, a = _(s).filter((c) => {
296
+ const { config: t, info: o } = await E(e), { moduleList: s = [] } = t, a = J(s).filter((c) => {
295
297
  const u = o[c];
296
298
  return u ? (i.skip(`
297
299
  检测到 ${c} 已配置, ${JSON.stringify(u, null, 2)},
@@ -346,7 +348,7 @@ ${JSON.stringify($, null, 2)}`), await ee({
346
348
  `开始复制 ${A} -> ${h}`
347
349
  );
348
350
  const R = g.dirname(h);
349
- k.existsSync(R) || k.mkdirSync(R, { recursive: !0 }), k.copyFileSync(A, h), i.success(
351
+ N.existsSync(R) || N.mkdirSync(R, { recursive: !0 }), N.copyFileSync(A, h), i.success(
350
352
  `添加 ${d} 配置成功, 路径: ${h}`
351
353
  ), p.push(...W), P.push(q), T.push(...z);
352
354
  }
@@ -356,7 +358,7 @@ ${JSON.stringify($, null, 2)}`), await ee({
356
358
  list: [...new Set(p)]
357
359
  });
358
360
  for (let d of T)
359
- i.stage(`运行脚本: ${d}`), N(d, { cwd: $, stdio: "inherit" });
361
+ i.stage(`运行脚本: ${d}`), k(d, { cwd: $, stdio: "inherit" });
360
362
  await Promise.all(P.map((d) => d()));
361
363
  }
362
364
  });
@@ -368,7 +370,7 @@ ${JSON.stringify($, null, 2)}`), await ee({
368
370
  message: "请输入提交信息",
369
371
  initial: `chore: 添加 ${a.join(", ")} 工程化配置`
370
372
  });
371
- N("git add .", { cwd: f, stdio: "inherit" }), N(`git commit -m "${c}"`, {
373
+ k("git add .", { cwd: f, stdio: "inherit" }), k(`git commit -m "${c}"`, {
372
374
  cwd: f,
373
375
  stdio: "inherit"
374
376
  });
@@ -378,7 +380,7 @@ ${JSON.stringify($, null, 2)}`), await ee({
378
380
  describe: "添加工程化配置",
379
381
  options: ge(),
380
382
  handler: b
381
- }, Se = async (e, t) => {
383
+ }, Ee = async (e, t) => {
382
384
  switch (e) {
383
385
  case y.CHECK:
384
386
  return E(t);
@@ -390,7 +392,7 @@ ${JSON.stringify($, null, 2)}`), await ee({
390
392
  }, { version: Ie, description: je } = L, G = {
391
393
  describe: je,
392
394
  version: Ie,
393
- subcommands: [ue, Ne].map(J),
395
+ subcommands: [ue, Ne].map(H),
394
396
  demandCommandCount: 1,
395
397
  rootScriptName: ne({ packageJson: L })
396
398
  }, {
@@ -398,17 +400,17 @@ ${JSON.stringify($, null, 2)}`), await ee({
398
400
  } = L, x = (e = !1) => {
399
401
  const t = e ? O : void 0, o = `$0${e ? ` ${O}` : ""} <command> [options]`;
400
402
  return { command: t, usage: o };
401
- }, Pe = async () => oe({
403
+ }, Se = async () => oe({
402
404
  ...G,
403
405
  ...x()
404
- }), Te = () => J({
406
+ }), Pe = () => H({
405
407
  ...G,
406
408
  ...x(!0)
407
409
  });
408
410
  export {
409
411
  m as C,
410
412
  y as S,
411
- Te as a,
412
- Pe as c,
413
- Se as h
413
+ Pe as a,
414
+ Se as c,
415
+ Ee as h
414
416
  };
package/es/index.mjs CHANGED
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { C as i, S as s, a as t, h as u } from "./index-c3a8e382.js";
2
+ import { C as e, S as s, a as u, h as d } from "./index-6be7f8d5.js";
3
3
  import "@done-coding/cli-utils";
4
4
  import "node:fs";
5
5
  import "node:path";
6
- import "node:child_process";
7
6
  export {
8
- i as ConfigModuleEnum,
7
+ e as ConfigModuleEnum,
9
8
  s as SubcommandEnum,
10
- t as crateAsSubcommand,
11
- u as handler
9
+ u as crateAsSubcommand,
10
+ d as handler
12
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-config",
3
- "version": "0.1.14-alpha.0",
3
+ "version": "0.1.14-alpha.2",
4
4
  "description": "工程化配置命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -38,7 +38,7 @@
38
38
  "license": "MIT",
39
39
  "sideEffects": false,
40
40
  "devDependencies": {
41
- "@done-coding/cli-inject": "0.5.22-alpha.0",
41
+ "@done-coding/cli-inject": "0.5.22-alpha.2",
42
42
  "@types/node": "^18.0.0",
43
43
  "@types/yargs": "^17.0.28",
44
44
  "typescript": "^5.8.3",
@@ -46,10 +46,10 @@
46
46
  "vite-plugin-dts": "^3.6.0"
47
47
  },
48
48
  "dependencies": {
49
- "@done-coding/cli-utils": "0.8.3-alpha.0"
49
+ "@done-coding/cli-utils": "0.8.3-alpha.2"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=18.0.0"
53
53
  },
54
- "gitHead": "906b7683d9e4dc75fb07806b12e5507827122a16"
54
+ "gitHead": "57548a940adaa810d2d0c870df54d5013a86bfed"
55
55
  }