@done-coding/cli-component 0.2.1 → 0.2.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 +1 -1
- package/es/index-ec860b99.js +219 -0
- package/es/index.mjs +1 -1
- package/package.json +3 -3
- package/types/injectInfo.json.d.ts +1 -1
- package/es/index-8e0a0575.js +0 -211
package/es/cli.mjs
CHANGED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import r from "chalk";
|
|
3
|
+
import m from "node:path";
|
|
4
|
+
import u from "node:fs";
|
|
5
|
+
import I from "json5";
|
|
6
|
+
import h from "lodash.upperfirst";
|
|
7
|
+
import x from "lodash.camelcase";
|
|
8
|
+
import E from "lodash.kebabcase";
|
|
9
|
+
import L from "lodash.lowerfirst";
|
|
10
|
+
import d from "lodash.template";
|
|
11
|
+
import w from "prompts";
|
|
12
|
+
import { OutputModeEnum as $, handler as C, onPromptFormStateForSigint as O } from "@done-coding/cli-template";
|
|
13
|
+
import k from "yargs";
|
|
14
|
+
import { hideBin as T } from "yargs/helpers";
|
|
15
|
+
import D from "lodash.curry";
|
|
16
|
+
var i = /* @__PURE__ */ ((e) => (e.ADD = "add", e.REMOVE = "remove", e.LIST = "list", e))(i || {});
|
|
17
|
+
const _ = (e, t) => {
|
|
18
|
+
if (!/^[a-zA-Z]+[a-zA-Z0-9-]*$/.test(e))
|
|
19
|
+
return console.log(r.red("组件名只能包含字母、数字、中划线")), process.exit(1);
|
|
20
|
+
const { nameExcludes: o } = t;
|
|
21
|
+
return o.includes(e) ? (console.log(
|
|
22
|
+
r.red(`组件名: ${e}是保留名称。
|
|
23
|
+
保留名称: ${o.join(",")}`)
|
|
24
|
+
), process.exit(1)) : !0;
|
|
25
|
+
}, f = {
|
|
26
|
+
version: "0.2.2",
|
|
27
|
+
name: "@done-coding/cli-component",
|
|
28
|
+
description: "组件命令行工具",
|
|
29
|
+
cliConfig: {
|
|
30
|
+
namespaceDir: ".done-coding",
|
|
31
|
+
moduleName: "component"
|
|
32
|
+
}
|
|
33
|
+
}, { namespaceDir: j, moduleName: A } = f.cliConfig, M = () => m.resolve(j, A), N = () => ({
|
|
34
|
+
execDir: process.cwd(),
|
|
35
|
+
templateDir: M()
|
|
36
|
+
}), g = (e) => {
|
|
37
|
+
const { series: t, name: o } = e, s = h(x(o)), c = L(s), a = E(s), l = t ? h(x(t)) : "", n = l ? `${l}${s}` : "", p = E(n);
|
|
38
|
+
return {
|
|
39
|
+
series: l,
|
|
40
|
+
name: s,
|
|
41
|
+
nameLowerFirst: c,
|
|
42
|
+
nameKebab: a,
|
|
43
|
+
fullName: n,
|
|
44
|
+
fullNameKebab: p,
|
|
45
|
+
cls: p
|
|
46
|
+
};
|
|
47
|
+
}, K = (e) => ({
|
|
48
|
+
$: "$",
|
|
49
|
+
...N(),
|
|
50
|
+
...g(e)
|
|
51
|
+
}), v = () => {
|
|
52
|
+
const e = m.resolve(M(), "index.json");
|
|
53
|
+
if (!u.existsSync(e))
|
|
54
|
+
return console.log(r.red(`模块入口文件不存在: ${e}`)), process.exit(1);
|
|
55
|
+
const o = JSON.parse(u.readFileSync(e, "utf-8")).config;
|
|
56
|
+
if (!o)
|
|
57
|
+
return console.log(r.red(`配置文件相对路径不存在: ${o}`)), process.exit(1);
|
|
58
|
+
const s = m.resolve(
|
|
59
|
+
m.dirname(e),
|
|
60
|
+
o
|
|
61
|
+
);
|
|
62
|
+
if (!u.existsSync(s))
|
|
63
|
+
return console.log(r.red(`配置文件不存在: ${s}`)), process.exit(1);
|
|
64
|
+
const c = I.parse(u.readFileSync(s, "utf-8")), a = N();
|
|
65
|
+
return c.componentDir = d(c.componentDir)(a), c;
|
|
66
|
+
}, y = (e) => {
|
|
67
|
+
const { componentDir: t, nameExcludes: o } = e;
|
|
68
|
+
return u.statSync(t).isDirectory() ? u.readdirSync(t).map((l) => {
|
|
69
|
+
const n = m.join(t, l);
|
|
70
|
+
return u.statSync(n).isDirectory() ? (console.log("filePath:", n, m.basename(n)), m.basename(n)) : "";
|
|
71
|
+
}).filter((l) => !(!l || o.includes(l))) : (console.log(r.red("组件源码路径不是目录")), process.exit(1));
|
|
72
|
+
}, U = async () => {
|
|
73
|
+
console.log(r.blue("展示列表"));
|
|
74
|
+
const e = v(), t = y(e);
|
|
75
|
+
console.table(
|
|
76
|
+
t.map((o) => {
|
|
77
|
+
const { name: s, fullName: c } = g({
|
|
78
|
+
...e,
|
|
79
|
+
name: o
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
[r.green("名称")]: s,
|
|
83
|
+
[r.green("带系列名称")]: c,
|
|
84
|
+
[r.green("绝对路径")]: m.resolve(e.componentDir, o)
|
|
85
|
+
};
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}, R = async ({
|
|
89
|
+
name: e,
|
|
90
|
+
config: t,
|
|
91
|
+
command: o
|
|
92
|
+
}) => {
|
|
93
|
+
if (![i.ADD, i.REMOVE].includes(o))
|
|
94
|
+
return console.log(r.red(`不支持组件${o}操作`)), process.exit(1);
|
|
95
|
+
const s = K({
|
|
96
|
+
...t,
|
|
97
|
+
name: e
|
|
98
|
+
}), c = JSON.stringify(s);
|
|
99
|
+
for (const { entry: a, index: l } of t.list) {
|
|
100
|
+
if (a) {
|
|
101
|
+
const n = a;
|
|
102
|
+
n != null && n.input && (n.input = d(n.input)(s)), n != null && n.output && (n.output = d(n.output)(s));
|
|
103
|
+
const p = {
|
|
104
|
+
...a,
|
|
105
|
+
envData: c,
|
|
106
|
+
mode: $.APPEND,
|
|
107
|
+
rollback: o === i.REMOVE,
|
|
108
|
+
dealMarkdown: !0
|
|
109
|
+
};
|
|
110
|
+
await C(p);
|
|
111
|
+
}
|
|
112
|
+
if (l) {
|
|
113
|
+
const n = l;
|
|
114
|
+
n != null && n.input && (n.input = d(n.input)(s)), n != null && n.output && (n.output = d(n.output)(s));
|
|
115
|
+
const p = {
|
|
116
|
+
...l,
|
|
117
|
+
envData: c,
|
|
118
|
+
mode: $.OVERWRITE,
|
|
119
|
+
rollback: o === i.REMOVE,
|
|
120
|
+
dealMarkdown: !0
|
|
121
|
+
};
|
|
122
|
+
await C(p);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, z = async ({ name: e }) => {
|
|
126
|
+
console.log(r.blue("添加组件"));
|
|
127
|
+
let t;
|
|
128
|
+
e ? t = e : t = (await w({
|
|
129
|
+
type: "text",
|
|
130
|
+
name: "name",
|
|
131
|
+
message: "请输入组件名",
|
|
132
|
+
onState: O
|
|
133
|
+
})).name;
|
|
134
|
+
const o = v();
|
|
135
|
+
_(t, o);
|
|
136
|
+
const { series: s } = o, c = await y(o);
|
|
137
|
+
for (let a of c)
|
|
138
|
+
if (g({
|
|
139
|
+
series: s,
|
|
140
|
+
name: t
|
|
141
|
+
}).nameKebab === a)
|
|
142
|
+
return console.log(r.red(`组件${a}已存在, 不能再次创建${t}组件`)), process.exit(1);
|
|
143
|
+
return R({
|
|
144
|
+
name: t,
|
|
145
|
+
config: o,
|
|
146
|
+
command: i.ADD
|
|
147
|
+
});
|
|
148
|
+
}, H = async ({ name: e }) => {
|
|
149
|
+
console.log(r.blue("移除组件"));
|
|
150
|
+
const t = v(), o = await y(t);
|
|
151
|
+
if (o.length === 0)
|
|
152
|
+
return console.log(r.red("组件列表为空")), process.exit(1);
|
|
153
|
+
let s;
|
|
154
|
+
e ? s = e : s = (await w({
|
|
155
|
+
type: "select",
|
|
156
|
+
name: "name",
|
|
157
|
+
message: "请选择要移除的组件",
|
|
158
|
+
choices: o.map((a) => ({ title: a, value: a })),
|
|
159
|
+
onState: O
|
|
160
|
+
})).name;
|
|
161
|
+
const { series: c } = t;
|
|
162
|
+
for (let a of o)
|
|
163
|
+
if (g({
|
|
164
|
+
series: c,
|
|
165
|
+
name: s
|
|
166
|
+
}).nameKebab === a) {
|
|
167
|
+
await R({
|
|
168
|
+
name: s,
|
|
169
|
+
config: t,
|
|
170
|
+
command: i.REMOVE
|
|
171
|
+
}), u.rmdirSync(m.resolve(t.componentDir, a));
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
return console.log(r.red(`组件${s}不存在`)), process.exit(1);
|
|
175
|
+
}, b = async (e, t) => e === i.ADD ? z(t) : e === i.REMOVE ? H(t) : e === i.LIST ? U() : (console.log(r.red(`无效的命令: ${e}`)), process.exit(1)), P = async (e) => {
|
|
176
|
+
}, V = f.cliConfig.moduleName, J = (e, t) => {
|
|
177
|
+
console.log(e ? r.red(e) : r.red(t.message)), process.exit(1);
|
|
178
|
+
}, Z = f.description, B = `Usage: $0 ${V} <command> [options]`, W = "Usage: $0 <command> [options]", S = (e) => e.command({
|
|
179
|
+
command: `${i.ADD} <name>`,
|
|
180
|
+
describe: "新增一个组件",
|
|
181
|
+
builder: (t) => t.positional("name", {
|
|
182
|
+
describe: "组件名称",
|
|
183
|
+
type: "string"
|
|
184
|
+
}),
|
|
185
|
+
async handler(t) {
|
|
186
|
+
return await D(b)(i.ADD)(t), process.exit(0);
|
|
187
|
+
}
|
|
188
|
+
}).command({
|
|
189
|
+
command: `${i.REMOVE} [name]`,
|
|
190
|
+
describe: "删除一个组件",
|
|
191
|
+
builder: (t) => t.positional("name", {
|
|
192
|
+
describe: "组件名称",
|
|
193
|
+
type: "string"
|
|
194
|
+
}),
|
|
195
|
+
async handler(t) {
|
|
196
|
+
return await D(b)(i.REMOVE)(t), process.exit(0);
|
|
197
|
+
}
|
|
198
|
+
}).command({
|
|
199
|
+
command: i.LIST,
|
|
200
|
+
describe: "展示组件列表",
|
|
201
|
+
async handler(t) {
|
|
202
|
+
return await D(b)(i.LIST)(t), process.exit(0);
|
|
203
|
+
}
|
|
204
|
+
}).demandCommand(1), F = (e, t = !1) => t ? S(e.strict().usage(B)) : S(
|
|
205
|
+
e.strict().usage(W).help("help").version(f.version).alias("v", "version").alias("h", "help")
|
|
206
|
+
).fail(J).argv, q = (e) => F(e, !0), ue = {
|
|
207
|
+
command: V,
|
|
208
|
+
describe: Z,
|
|
209
|
+
builder: q,
|
|
210
|
+
handler: P
|
|
211
|
+
}, pe = async () => {
|
|
212
|
+
const e = k(T(process.argv));
|
|
213
|
+
return await F(e), P();
|
|
214
|
+
};
|
|
215
|
+
export {
|
|
216
|
+
ue as a,
|
|
217
|
+
pe as c,
|
|
218
|
+
P as h
|
|
219
|
+
};
|
package/es/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/cli-component",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "组件命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"node": ">=18.0.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@done-coding/cli-template": "^0.
|
|
65
|
+
"@done-coding/cli-template": "^0.6.0",
|
|
66
66
|
"chalk": "^5.3.0",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"lodash.camelcase": "^4.3.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"prompts": "^2.4.2",
|
|
76
76
|
"yargs": "^17.7.2"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "0dde53af70143475f5149714152d714802f846f8"
|
|
79
79
|
}
|
package/es/index-8e0a0575.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import r from "chalk";
|
|
3
|
-
import m from "node:path";
|
|
4
|
-
import u from "node:fs";
|
|
5
|
-
import I from "json5";
|
|
6
|
-
import E from "lodash.upperfirst";
|
|
7
|
-
import y from "lodash.camelcase";
|
|
8
|
-
import x from "lodash.kebabcase";
|
|
9
|
-
import L from "lodash.lowerfirst";
|
|
10
|
-
import d from "lodash.template";
|
|
11
|
-
import S from "prompts";
|
|
12
|
-
import { OutputModeEnum as $, handler as C } from "@done-coding/cli-template";
|
|
13
|
-
import k from "yargs";
|
|
14
|
-
import { hideBin as T } from "yargs/helpers";
|
|
15
|
-
import D from "lodash.curry";
|
|
16
|
-
var i = /* @__PURE__ */ ((e) => (e.ADD = "add", e.REMOVE = "remove", e.LIST = "list", e))(i || {});
|
|
17
|
-
const _ = (e, n) => {
|
|
18
|
-
if (!/^[a-zA-Z]+[a-zA-Z0-9-]*$/.test(e))
|
|
19
|
-
return console.log(r.red("组件名只能包含字母、数字、中划线")), process.exit(1);
|
|
20
|
-
const { nameExcludes: t } = n;
|
|
21
|
-
return t.includes(e) ? (console.log(
|
|
22
|
-
r.red(`组件名: ${e}是保留名称。
|
|
23
|
-
保留名称: ${t.join(",")}`)
|
|
24
|
-
), process.exit(1)) : !0;
|
|
25
|
-
}, f = {
|
|
26
|
-
version: "0.2.1",
|
|
27
|
-
name: "@done-coding/cli-component",
|
|
28
|
-
description: "组件命令行工具",
|
|
29
|
-
cliConfig: {
|
|
30
|
-
namespaceDir: ".done-coding",
|
|
31
|
-
moduleName: "component"
|
|
32
|
-
}
|
|
33
|
-
}, { namespaceDir: j, moduleName: A } = f.cliConfig, w = () => m.resolve(j, A), M = () => ({
|
|
34
|
-
execDir: process.cwd(),
|
|
35
|
-
templateDir: w()
|
|
36
|
-
}), g = (e) => {
|
|
37
|
-
const { series: n, name: t } = e, s = E(y(t)), c = L(s), a = x(s), l = n ? E(y(n)) : "", o = l ? `${l}${s}` : "", p = x(o);
|
|
38
|
-
return {
|
|
39
|
-
series: l,
|
|
40
|
-
name: s,
|
|
41
|
-
nameLowerFirst: c,
|
|
42
|
-
nameKebab: a,
|
|
43
|
-
fullName: o,
|
|
44
|
-
fullNameKebab: p,
|
|
45
|
-
cls: p
|
|
46
|
-
};
|
|
47
|
-
}, F = (e) => ({
|
|
48
|
-
$: "$",
|
|
49
|
-
...M(),
|
|
50
|
-
...g(e)
|
|
51
|
-
}), h = () => {
|
|
52
|
-
const e = m.resolve(w(), "index.json");
|
|
53
|
-
if (!u.existsSync(e))
|
|
54
|
-
return console.log(r.red(`模块入口文件不存在: ${e}`)), process.exit(1);
|
|
55
|
-
const t = JSON.parse(u.readFileSync(e, "utf-8")).config;
|
|
56
|
-
if (!t)
|
|
57
|
-
return console.log(r.red(`配置文件相对路径不存在: ${t}`)), process.exit(1);
|
|
58
|
-
const s = m.resolve(
|
|
59
|
-
m.dirname(e),
|
|
60
|
-
t
|
|
61
|
-
);
|
|
62
|
-
if (!u.existsSync(s))
|
|
63
|
-
return console.log(r.red(`配置文件不存在: ${s}`)), process.exit(1);
|
|
64
|
-
const c = I.parse(u.readFileSync(s, "utf-8")), a = M();
|
|
65
|
-
return c.componentDir = d(c.componentDir)(a), c;
|
|
66
|
-
}, v = (e) => {
|
|
67
|
-
const { componentDir: n, nameExcludes: t } = e;
|
|
68
|
-
return u.statSync(n).isDirectory() ? u.readdirSync(n).map((l) => {
|
|
69
|
-
const o = m.join(n, l);
|
|
70
|
-
return u.statSync(o).isDirectory() ? (console.log("filePath:", o, m.basename(o)), m.basename(o)) : "";
|
|
71
|
-
}).filter((l) => !(!l || t.includes(l))) : (console.log(r.red("组件源码路径不是目录")), process.exit(1));
|
|
72
|
-
}, K = async () => {
|
|
73
|
-
console.log(r.blue("展示列表"));
|
|
74
|
-
const e = h(), n = v(e);
|
|
75
|
-
console.table(
|
|
76
|
-
n.map((t) => {
|
|
77
|
-
const { name: s, fullName: c } = g({
|
|
78
|
-
...e,
|
|
79
|
-
name: t
|
|
80
|
-
});
|
|
81
|
-
return {
|
|
82
|
-
[r.green("名称")]: s,
|
|
83
|
-
[r.green("带系列名称")]: c,
|
|
84
|
-
[r.green("绝对路径")]: m.resolve(e.componentDir, t)
|
|
85
|
-
};
|
|
86
|
-
})
|
|
87
|
-
);
|
|
88
|
-
}, N = async ({
|
|
89
|
-
name: e,
|
|
90
|
-
config: n,
|
|
91
|
-
command: t
|
|
92
|
-
}) => {
|
|
93
|
-
if (![i.ADD, i.REMOVE].includes(t))
|
|
94
|
-
return console.log(r.red(`不支持组件${t}操作`)), process.exit(1);
|
|
95
|
-
const s = F({
|
|
96
|
-
...n,
|
|
97
|
-
name: e
|
|
98
|
-
}), c = JSON.stringify(s);
|
|
99
|
-
for (const { entry: a, index: l } of n.list) {
|
|
100
|
-
if (a) {
|
|
101
|
-
const o = a;
|
|
102
|
-
o != null && o.input && (o.input = d(o.input)(s)), o != null && o.output && (o.output = d(o.output)(s));
|
|
103
|
-
const p = {
|
|
104
|
-
...a,
|
|
105
|
-
envData: c,
|
|
106
|
-
mode: $.APPEND,
|
|
107
|
-
rollback: t === i.REMOVE,
|
|
108
|
-
dealMarkdown: !0
|
|
109
|
-
};
|
|
110
|
-
await C(p);
|
|
111
|
-
}
|
|
112
|
-
if (l) {
|
|
113
|
-
const o = l;
|
|
114
|
-
o != null && o.input && (o.input = d(o.input)(s)), o != null && o.output && (o.output = d(o.output)(s));
|
|
115
|
-
const p = {
|
|
116
|
-
...l,
|
|
117
|
-
envData: c,
|
|
118
|
-
mode: $.OVERWRITE,
|
|
119
|
-
rollback: t === i.REMOVE,
|
|
120
|
-
dealMarkdown: !0
|
|
121
|
-
};
|
|
122
|
-
await C(p);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}, U = async ({ name: e }) => {
|
|
126
|
-
console.log(r.blue("添加组件"));
|
|
127
|
-
let n;
|
|
128
|
-
e ? n = e : n = (await S({
|
|
129
|
-
type: "text",
|
|
130
|
-
name: "name",
|
|
131
|
-
message: "请输入组件名"
|
|
132
|
-
})).name;
|
|
133
|
-
const t = h();
|
|
134
|
-
_(n, t);
|
|
135
|
-
const { series: s } = t, c = await v(t);
|
|
136
|
-
for (let a of c)
|
|
137
|
-
if (g({
|
|
138
|
-
series: s,
|
|
139
|
-
name: n
|
|
140
|
-
}).nameKebab === a)
|
|
141
|
-
return console.log(r.red(`组件${a}已存在, 不能再次创建${n}组件`)), process.exit(1);
|
|
142
|
-
return N({
|
|
143
|
-
name: n,
|
|
144
|
-
config: t,
|
|
145
|
-
command: i.ADD
|
|
146
|
-
});
|
|
147
|
-
}, z = async ({ name: e }) => {
|
|
148
|
-
console.log(r.blue("移除组件"));
|
|
149
|
-
const n = h(), t = await v(n);
|
|
150
|
-
if (t.length === 0)
|
|
151
|
-
return console.log(r.red("组件列表为空")), process.exit(1);
|
|
152
|
-
let s;
|
|
153
|
-
e ? s = e : s = (await S({
|
|
154
|
-
type: "select",
|
|
155
|
-
name: "name",
|
|
156
|
-
message: "请选择要移除的组件",
|
|
157
|
-
choices: t.map((a) => ({ title: a, value: a }))
|
|
158
|
-
})).name;
|
|
159
|
-
const { series: c } = n;
|
|
160
|
-
for (let a of t)
|
|
161
|
-
if (g({
|
|
162
|
-
series: c,
|
|
163
|
-
name: s
|
|
164
|
-
}).nameKebab === a) {
|
|
165
|
-
await N({
|
|
166
|
-
name: s,
|
|
167
|
-
config: n,
|
|
168
|
-
command: i.REMOVE
|
|
169
|
-
}), u.rmdirSync(m.resolve(n.componentDir, a));
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
return console.log(r.red(`组件${s}不存在`)), process.exit(1);
|
|
173
|
-
}, b = async (e, n) => (console.log("com", n), e === i.ADD ? U(n) : e === i.REMOVE ? z(n) : e === i.LIST ? K() : (console.log(r.red(`无效的命令: ${e}`)), process.exit(1))), R = async (e) => {
|
|
174
|
-
}, P = f.cliConfig.moduleName, H = (e, n) => {
|
|
175
|
-
console.log(e ? r.red(e) : r.red(n.message)), process.exit(1);
|
|
176
|
-
}, J = f.description, Z = `Usage: $0 ${P} <command> [options]`, B = "Usage: $0 <command> [options]", O = (e) => e.command({
|
|
177
|
-
command: `${i.ADD} <name>`,
|
|
178
|
-
describe: "新增一个组件",
|
|
179
|
-
builder: (n) => n.positional("name", {
|
|
180
|
-
describe: "组件名称",
|
|
181
|
-
type: "string"
|
|
182
|
-
}),
|
|
183
|
-
handler: D(b)(i.ADD)
|
|
184
|
-
}).command({
|
|
185
|
-
command: `${i.REMOVE} [name]`,
|
|
186
|
-
describe: "删除一个组件",
|
|
187
|
-
builder: (n) => n.positional("name", {
|
|
188
|
-
describe: "组件名称",
|
|
189
|
-
type: "string"
|
|
190
|
-
}),
|
|
191
|
-
handler: D(b)(i.REMOVE)
|
|
192
|
-
}).command({
|
|
193
|
-
command: i.LIST,
|
|
194
|
-
describe: "展示组件列表",
|
|
195
|
-
handler: D(b)(i.LIST)
|
|
196
|
-
}).demandCommand(1), V = (e, n = !1) => n ? O(e.strict().usage(Z)) : O(
|
|
197
|
-
e.strict().usage(B).help("help").version(f.version).alias("v", "version").alias("h", "help")
|
|
198
|
-
).fail(H).argv, W = (e) => V(e, !0), me = {
|
|
199
|
-
command: P,
|
|
200
|
-
describe: J,
|
|
201
|
-
builder: W,
|
|
202
|
-
handler: R
|
|
203
|
-
}, ue = async () => {
|
|
204
|
-
const e = k(T(process.argv));
|
|
205
|
-
return await V(e), R();
|
|
206
|
-
};
|
|
207
|
-
export {
|
|
208
|
-
me as a,
|
|
209
|
-
ue as c,
|
|
210
|
-
R as h
|
|
211
|
-
};
|