@done-coding/cli-component 0.4.9 → 0.4.10-alpha.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/es/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-578b8ec1.js";
2
+ import { c as m } from "./index-26ea3160.js";
3
3
  import "node:path";
4
4
  import "node:fs";
5
5
  import "@done-coding/cli-utils";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import p from "node:path";
3
3
  import u from "node:fs";
4
- import { log as m, json5 as F, getLogText as $, xPrompts as w, createSubcommand as O, getRootScriptName as V, createMainCommand as J } from "@done-coding/cli-utils";
4
+ import { log as m, json5 as F, getLogText as h, xPrompts as w, createSubcommand as O, getRootScriptName as V, createMainCommand as J } from "@done-coding/cli-utils";
5
5
  import x from "lodash.upperfirst";
6
6
  import S from "lodash.camelcase";
7
7
  import v from "lodash.kebabcase";
@@ -17,7 +17,7 @@ const _ = (e, t) => {
17
17
  保留名称: ${n.join(",")}`), process.exit(1)) : !0;
18
18
  }, g = {
19
19
  name: "@done-coding/cli-component",
20
- version: "0.4.9",
20
+ version: "0.4.10-alpha.1",
21
21
  description: "组件命令行工具",
22
22
  bin: {
23
23
  "dc-component": "es/cli.mjs"
@@ -30,13 +30,13 @@ const _ = (e, t) => {
30
30
  execDir: process.cwd(),
31
31
  templateDir: N()
32
32
  }), D = (e) => {
33
- const { series: t, name: n } = e, o = x(S(n)), i = T(o), a = v(o), s = t ? x(S(t)) : "", c = s ? `${s}${o}` : "", d = v(c);
33
+ const { series: t, name: n } = e, o = x(S(n)), c = T(o), a = v(o), s = t ? x(S(t)) : "", i = s ? `${s}${o}` : "", d = v(i);
34
34
  return {
35
35
  series: s,
36
36
  name: o,
37
- nameLowerFirst: i,
37
+ nameLowerFirst: c,
38
38
  nameKebab: a,
39
- fullName: c,
39
+ fullName: i,
40
40
  fullNameKebab: d,
41
41
  cls: d
42
42
  };
@@ -44,7 +44,7 @@ const _ = (e, t) => {
44
44
  $: "$",
45
45
  ...I(),
46
46
  ...D(e)
47
- }), h = () => {
47
+ }), $ = () => {
48
48
  const e = p.resolve(N(), "index.json");
49
49
  if (!u.existsSync(e))
50
50
  return m.error(`模块入口文件不存在: ${e}`), process.exit(1);
@@ -57,10 +57,10 @@ const _ = (e, t) => {
57
57
  );
58
58
  if (!u.existsSync(o))
59
59
  return m.error(`配置文件不存在: ${o}`), process.exit(1);
60
- const i = F.parse(u.readFileSync(o, "utf-8")), a = I();
61
- return i.componentDir = f(i.componentDir)(a), u.existsSync(i.componentDir) || u.mkdirSync(i.componentDir, {
60
+ const c = F.parse(u.readFileSync(o, "utf-8")), a = I();
61
+ return c.componentDir = f(c.componentDir)(a), u.existsSync(c.componentDir) || u.mkdirSync(c.componentDir, {
62
62
  recursive: !0
63
- }), i;
63
+ }), c;
64
64
  }, R = async ({
65
65
  name: e,
66
66
  config: t,
@@ -71,8 +71,8 @@ const _ = (e, t) => {
71
71
  const o = Z({
72
72
  ...t,
73
73
  name: e
74
- }), i = process.cwd(), a = JSON.stringify(o);
75
- for (const { entry: s, index: c } of t.list) {
74
+ }), c = process.cwd(), a = JSON.stringify(o);
75
+ for (const { entry: s, index: i } of t.list) {
76
76
  const d = {
77
77
  envData: a,
78
78
  rollback: n === l.REMOVE,
@@ -81,7 +81,7 @@ const _ = (e, t) => {
81
81
  rollbackDelAskAsYes: !0,
82
82
  dealMarkdown: !0,
83
83
  batch: !1,
84
- rootDir: i
84
+ rootDir: c
85
85
  };
86
86
  if (s) {
87
87
  const r = s;
@@ -93,11 +93,11 @@ const _ = (e, t) => {
93
93
  };
94
94
  await C(b);
95
95
  }
96
- if (c) {
97
- const r = c;
96
+ if (i) {
97
+ const r = i;
98
98
  r != null && r.input && (r.input = f(r.input)(o)), r != null && r.output && (r.output = f(r.output)(o));
99
99
  const b = {
100
- ...c,
100
+ ...i,
101
101
  mode: E.OVERWRITE,
102
102
  ...d
103
103
  };
@@ -119,37 +119,37 @@ const _ = (e, t) => {
119
119
  }), y = (e) => {
120
120
  const { componentDir: t, nameExcludes: n } = e;
121
121
  return u.statSync(t).isDirectory() ? u.readdirSync(t).map((s) => {
122
- const c = p.join(t, s);
123
- return u.statSync(c).isDirectory() ? (m.info("filePath:", c, p.basename(c)), p.basename(c)) : "";
122
+ const i = p.join(t, s);
123
+ return u.statSync(i).isDirectory() ? (m.info("filePath:", i, p.basename(i)), p.basename(i)) : "";
124
124
  }).filter((s) => !(!s || n.includes(s))) : (m.error("组件源码路径不是目录"), process.exit(1));
125
125
  }, k = async ({
126
126
  outputJson: e,
127
127
  outputPath: t
128
128
  }) => {
129
129
  m.stage("展示列表");
130
- const n = h(), o = y(n), i = t || n.nameListJsonOutputPath, a = o.map((s) => {
131
- const { name: c, fullName: d } = D({
130
+ const n = $(), o = y(n), c = t || n.nameListJsonOutputPath, a = o.map((s) => {
131
+ const { name: i, fullName: d } = D({
132
132
  ...n,
133
133
  name: s
134
134
  });
135
135
  return {
136
- name: c,
136
+ name: i,
137
137
  nameKebab: s,
138
138
  fullName: d
139
139
  };
140
140
  });
141
- if (console.table(
142
- a.map(({ name: s, fullName: c, nameKebab: d }) => ({
143
- [$.success("名称")]: s,
144
- [$.success("带系列名称")]: c,
145
- [$.success("绝对路径")]: p.resolve(
141
+ if (m.table(
142
+ a.map(({ name: s, fullName: i, nameKebab: d }) => ({
143
+ [h.success("名称")]: s,
144
+ [h.success("带系列名称")]: i,
145
+ [h.success("绝对路径")]: p.resolve(
146
146
  n.componentDir,
147
147
  d
148
148
  )
149
149
  }))
150
- ), e && i) {
151
- const s = p.resolve(i), c = p.dirname(s);
152
- u.existsSync(c) || u.mkdirSync(c, { recursive: !0 }), m.stage(`输出组件名列表到${s}`), u.writeFileSync(s, JSON.stringify(a, null, 2));
150
+ ), e && c) {
151
+ const s = p.resolve(c), i = p.dirname(s);
152
+ u.existsSync(i) || u.mkdirSync(i, { recursive: !0 }), m.stage(`输出组件名列表到${s}`), u.writeFileSync(s, JSON.stringify(a, null, 2));
153
153
  }
154
154
  }, U = {
155
155
  command: l.LIST,
@@ -171,10 +171,10 @@ const _ = (e, t) => {
171
171
  name: "name",
172
172
  message: "请输入组件名"
173
173
  })).name;
174
- const n = h();
174
+ const n = $();
175
175
  _(t, n);
176
- const { series: o } = n, i = await y(n);
177
- for (let a of i)
176
+ const { series: o } = n, c = await y(n);
177
+ for (let a of c)
178
178
  if (D({
179
179
  series: o,
180
180
  name: t
@@ -199,7 +199,7 @@ const _ = (e, t) => {
199
199
  name: e
200
200
  }) => {
201
201
  m.stage("移除组件");
202
- const t = h(), n = await y(t);
202
+ const t = $(), n = await y(t);
203
203
  if (n.length === 0)
204
204
  return m.error("组件列表为空"), process.exit(1);
205
205
  let o;
@@ -209,10 +209,10 @@ const _ = (e, t) => {
209
209
  message: "请选择要移除的组件",
210
210
  choices: n.map((a) => ({ title: a, value: a }))
211
211
  })).name;
212
- const { series: i } = t;
212
+ const { series: c } = t;
213
213
  for (let a of n)
214
214
  if (D({
215
- series: i,
215
+ series: c,
216
216
  name: o
217
217
  }).nameKebab === a) {
218
218
  await R({
@@ -228,7 +228,7 @@ const _ = (e, t) => {
228
228
  describe: "删除一个组件",
229
229
  positionals: q(),
230
230
  handler: M
231
- }, ie = async (e, t) => {
231
+ }, ce = async (e, t) => {
232
232
  switch (e) {
233
233
  case l.ADD:
234
234
  return A(t);
@@ -265,5 +265,5 @@ export {
265
265
  l as S,
266
266
  ue as a,
267
267
  me as c,
268
- ie as h
268
+ ce as h
269
269
  };
package/es/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { S as u, a as b, h as c } from "./index-578b8ec1.js";
2
+ import { S as u, a as b, h as c } from "./index-26ea3160.js";
3
3
  import "node:path";
4
4
  import "node:fs";
5
5
  import "@done-coding/cli-utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-component",
3
- "version": "0.4.9",
3
+ "version": "0.4.10-alpha.1",
4
4
  "description": "组件命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -41,7 +41,7 @@
41
41
  "license": "MIT",
42
42
  "sideEffects": false,
43
43
  "devDependencies": {
44
- "@done-coding/cli-inject": "0.5.20",
44
+ "@done-coding/cli-inject": "0.5.21-alpha.1",
45
45
  "@types/lodash.camelcase": "^4.3.8",
46
46
  "@types/lodash.kebabcase": "^4.1.8",
47
47
  "@types/lodash.lowerfirst": "^4.3.8",
@@ -50,7 +50,7 @@
50
50
  "@types/node": "^18.0.0",
51
51
  "@types/yargs": "^17.0.28",
52
52
  "rimraf": "^6.0.1",
53
- "typescript": "^5.2.2",
53
+ "typescript": "^5.8.3",
54
54
  "vite": "^4.4.11",
55
55
  "vite-plugin-dts": "^3.6.0"
56
56
  },
@@ -58,13 +58,13 @@
58
58
  "node": ">=18.0.0"
59
59
  },
60
60
  "dependencies": {
61
- "@done-coding/cli-template": "0.8.7",
62
- "@done-coding/cli-utils": "0.8.1",
61
+ "@done-coding/cli-template": "0.8.8-alpha.1",
62
+ "@done-coding/cli-utils": "0.8.2-alpha.1",
63
63
  "lodash.camelcase": "^4.3.0",
64
64
  "lodash.kebabcase": "^4.1.1",
65
65
  "lodash.lowerfirst": "^4.3.1",
66
66
  "lodash.template": "^4.5.0",
67
67
  "lodash.upperfirst": "^4.3.1"
68
68
  },
69
- "gitHead": "0930f800167c04a86b56eae9741872dd51bec0c6"
69
+ "gitHead": "660e39fc523e4eba1ea621e3c59122f98015a2de"
70
70
  }