@done-coding/cli-component 0.1.8 → 0.2.0-alpha.0
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/README.md +0 -0
- package/es/cli.mjs +1 -1
- package/es/{index-d4826460.js → index-d6f53839.js} +18 -18
- package/es/index.mjs +1 -1
- package/package.json +3 -3
- package/types/cli.d.ts +0 -0
- package/types/handler.d.ts +0 -0
- package/types/index.d.ts +0 -0
- package/types/injectInfo.json.d.ts +1 -1
- package/types/main.d.ts +0 -0
- package/types/utils/add.d.ts +0 -0
- package/types/utils/config.d.ts +0 -0
- package/types/utils/env-data.d.ts +0 -0
- package/types/utils/index.d.ts +0 -0
- package/types/utils/list.d.ts +0 -0
- package/types/utils/name.d.ts +0 -0
- package/types/utils/operate.d.ts +0 -0
- package/types/utils/remove.d.ts +0 -0
- package/types/utils/types.d.ts +0 -0
package/README.md
CHANGED
|
File without changes
|
package/es/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import r from "chalk";
|
|
3
3
|
import m from "node:path";
|
|
4
|
-
import
|
|
4
|
+
import p from "node:fs";
|
|
5
5
|
import I from "json5";
|
|
6
6
|
import E from "lodash.upperfirst";
|
|
7
7
|
import y from "lodash.camelcase";
|
|
@@ -23,7 +23,7 @@ const _ = (e, o) => {
|
|
|
23
23
|
保留名称: ${t.join(",")}`)
|
|
24
24
|
), process.exit(1)) : !0;
|
|
25
25
|
}, f = {
|
|
26
|
-
version: "0.
|
|
26
|
+
version: "0.2.0-alpha.0",
|
|
27
27
|
name: "@done-coding/cli-component",
|
|
28
28
|
description: "组件命令行工具",
|
|
29
29
|
cliConfig: {
|
|
@@ -34,15 +34,15 @@ const _ = (e, o) => {
|
|
|
34
34
|
execDir: process.cwd(),
|
|
35
35
|
templateDir: w()
|
|
36
36
|
}), g = (e) => {
|
|
37
|
-
const { series: o, name: t } = e, s = E(y(t)), i = L(s), a = x(s), l = o ? E(y(o)) : "", n = l ? `${l}${s}` : "",
|
|
37
|
+
const { series: o, name: t } = e, s = E(y(t)), i = L(s), a = x(s), l = o ? E(y(o)) : "", n = l ? `${l}${s}` : "", u = x(n);
|
|
38
38
|
return {
|
|
39
39
|
series: l,
|
|
40
40
|
name: s,
|
|
41
41
|
nameLowerFirst: i,
|
|
42
42
|
nameKebab: a,
|
|
43
43
|
fullName: n,
|
|
44
|
-
fullNameKebab:
|
|
45
|
-
cls:
|
|
44
|
+
fullNameKebab: u,
|
|
45
|
+
cls: u
|
|
46
46
|
};
|
|
47
47
|
}, F = (e) => ({
|
|
48
48
|
$: "$",
|
|
@@ -50,24 +50,24 @@ const _ = (e, o) => {
|
|
|
50
50
|
...g(e)
|
|
51
51
|
}), h = () => {
|
|
52
52
|
const e = m.resolve(w(), "index.json");
|
|
53
|
-
if (!
|
|
53
|
+
if (!p.existsSync(e))
|
|
54
54
|
return console.log(r.red(`模块入口文件不存在: ${e}`)), process.exit(1);
|
|
55
|
-
const t = JSON.parse(
|
|
55
|
+
const t = JSON.parse(p.readFileSync(e, "utf-8")).config;
|
|
56
56
|
if (!t)
|
|
57
57
|
return console.log(r.red(`配置文件相对路径不存在: ${t}`)), process.exit(1);
|
|
58
58
|
const s = m.resolve(
|
|
59
59
|
m.dirname(e),
|
|
60
60
|
t
|
|
61
61
|
);
|
|
62
|
-
if (!
|
|
62
|
+
if (!p.existsSync(s))
|
|
63
63
|
return console.log(r.red(`配置文件不存在: ${s}`)), process.exit(1);
|
|
64
|
-
const i = I.parse(
|
|
64
|
+
const i = I.parse(p.readFileSync(s, "utf-8")), a = M();
|
|
65
65
|
return i.componentDir = d(i.componentDir)(a), i;
|
|
66
66
|
}, v = (e) => {
|
|
67
67
|
const { componentDir: o, nameExcludes: t } = e;
|
|
68
|
-
return
|
|
68
|
+
return p.statSync(o).isDirectory() ? p.readdirSync(o).map((l) => {
|
|
69
69
|
const n = m.join(o, l);
|
|
70
|
-
return
|
|
70
|
+
return p.statSync(n).isDirectory() ? (console.log("filePath:", n, m.basename(n)), m.basename(n)) : "";
|
|
71
71
|
}).filter((l) => !(!l || t.includes(l))) : (console.log(r.red("组件源码路径不是目录")), process.exit(1));
|
|
72
72
|
}, K = async () => {
|
|
73
73
|
console.log(r.blue("展示列表"));
|
|
@@ -100,26 +100,26 @@ const _ = (e, o) => {
|
|
|
100
100
|
if (a) {
|
|
101
101
|
const n = a;
|
|
102
102
|
n != null && n.input && (n.input = d(n.input)(s)), n != null && n.output && (n.output = d(n.output)(s));
|
|
103
|
-
const
|
|
103
|
+
const u = {
|
|
104
104
|
...a,
|
|
105
105
|
envData: i,
|
|
106
106
|
mode: $.APPEND,
|
|
107
107
|
rollback: t === c.REMOVE,
|
|
108
108
|
dealMarkdown: !0
|
|
109
109
|
};
|
|
110
|
-
await C(
|
|
110
|
+
await C(u);
|
|
111
111
|
}
|
|
112
112
|
if (l) {
|
|
113
113
|
const n = l;
|
|
114
114
|
n != null && n.input && (n.input = d(n.input)(s)), n != null && n.output && (n.output = d(n.output)(s));
|
|
115
|
-
const
|
|
115
|
+
const u = {
|
|
116
116
|
...l,
|
|
117
117
|
envData: i,
|
|
118
118
|
mode: $.OVERWRITE,
|
|
119
119
|
rollback: t === c.REMOVE,
|
|
120
120
|
dealMarkdown: !0
|
|
121
121
|
};
|
|
122
|
-
await C(
|
|
122
|
+
await C(u);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}, U = async ({ name: e }) => {
|
|
@@ -166,7 +166,7 @@ const _ = (e, o) => {
|
|
|
166
166
|
name: s,
|
|
167
167
|
config: o,
|
|
168
168
|
command: c.REMOVE
|
|
169
|
-
}),
|
|
169
|
+
}), p.rmdirSync(m.resolve(o.componentDir, a));
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
return console.log(r.red(`组件${s}不存在`)), process.exit(1);
|
|
@@ -201,12 +201,12 @@ const _ = (e, o) => {
|
|
|
201
201
|
describe: J,
|
|
202
202
|
builder: W,
|
|
203
203
|
handler: R
|
|
204
|
-
},
|
|
204
|
+
}, pe = async () => {
|
|
205
205
|
const e = k(T(process.argv)), o = await V(e);
|
|
206
206
|
return R(o);
|
|
207
207
|
};
|
|
208
208
|
export {
|
|
209
209
|
me as a,
|
|
210
|
-
|
|
210
|
+
pe as c,
|
|
211
211
|
R as h
|
|
212
212
|
};
|
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.
|
|
3
|
+
"version": "0.2.0-alpha.0",
|
|
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.5.0-alpha.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": "c386db9e11a6e5cf017839d657cd4c0bf1fb6a90"
|
|
79
79
|
}
|
package/types/cli.d.ts
CHANGED
|
File without changes
|
package/types/handler.d.ts
CHANGED
|
File without changes
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/types/main.d.ts
CHANGED
|
File without changes
|
package/types/utils/add.d.ts
CHANGED
|
File without changes
|
package/types/utils/config.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/types/utils/index.d.ts
CHANGED
|
File without changes
|
package/types/utils/list.d.ts
CHANGED
|
File without changes
|
package/types/utils/name.d.ts
CHANGED
|
File without changes
|
package/types/utils/operate.d.ts
CHANGED
|
File without changes
|
package/types/utils/remove.d.ts
CHANGED
|
File without changes
|
package/types/utils/types.d.ts
CHANGED
|
File without changes
|