@done-coding/cli-component 0.1.2 → 0.1.4
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 +0 -0
- package/es/handler.mjs +0 -0
- package/es/index.mjs +0 -0
- package/es/injectInfo.json.mjs +6 -2
- package/es/main.mjs +15 -16
- package/es/utils/add.mjs +0 -0
- package/es/utils/config.mjs +0 -0
- package/es/utils/env-data.mjs +17 -17
- package/es/utils/list.mjs +0 -0
- package/es/utils/name.mjs +0 -0
- package/es/utils/operate.mjs +0 -0
- package/es/utils/remove.mjs +0 -0
- package/es/utils/types.mjs +0 -0
- package/package.json +6 -5
- package/types/cli.d.ts +0 -0
- package/types/handler.d.ts +2 -2
- package/types/index.d.ts +0 -0
- package/types/injectInfo.json.d.ts +6 -2
- 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 -1
- 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/es/utils/const.mjs +0 -6
- package/types/utils/const.d.ts +0 -4
package/README.md
CHANGED
|
File without changes
|
package/es/cli.mjs
CHANGED
|
File without changes
|
package/es/handler.mjs
CHANGED
|
File without changes
|
package/es/index.mjs
CHANGED
|
File without changes
|
package/es/injectInfo.json.mjs
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const n = {
|
|
3
|
+
version: "0.1.4",
|
|
3
4
|
name: "@done-coding/cli-component",
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
description: "组件命令行工具",
|
|
6
|
+
cliConfig: {
|
|
7
|
+
namespaceDir: ".done-coding",
|
|
8
|
+
moduleName: "component"
|
|
9
|
+
}
|
|
6
10
|
};
|
|
7
11
|
export {
|
|
8
12
|
n as default
|
package/es/main.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import l from "yargs";
|
|
3
3
|
import { hideBin as p } from "yargs/helpers";
|
|
4
|
-
import { MODULE_NAME as u } from "./utils/const.mjs";
|
|
5
4
|
import { SubcommandEnum as o } from "./utils/types.mjs";
|
|
6
|
-
import { handler as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import { handler as c, subHandler as r } from "./handler.mjs";
|
|
6
|
+
import s from "chalk";
|
|
7
|
+
import a from "./injectInfo.json.mjs";
|
|
9
8
|
import m from "lodash.curry";
|
|
10
|
-
const
|
|
11
|
-
console.log(e ?
|
|
12
|
-
},
|
|
9
|
+
const t = a.cliConfig.moduleName, u = (e, n) => {
|
|
10
|
+
console.log(e ? s.red(e) : s.red(n.message)), process.exit(1);
|
|
11
|
+
}, g = a.description, f = `Usage: $0 ${t} <command> [options]`, b = "Usage: $0 <command> [options]", i = (e) => e.command({
|
|
13
12
|
command: `${o.ADD} <name>`,
|
|
14
13
|
describe: "新增一个组件",
|
|
15
14
|
builder: (n) => n.positional("name", {
|
|
@@ -29,18 +28,18 @@ const c = u, g = (e, n) => {
|
|
|
29
28
|
command: o.LIST,
|
|
30
29
|
describe: "展示组件列表",
|
|
31
30
|
handler: m(r)(o.LIST)
|
|
32
|
-
}).demandCommand(1), d = (e, n = !1) => n ?
|
|
33
|
-
e.strict().usage(
|
|
34
|
-
).fail(
|
|
35
|
-
command:
|
|
36
|
-
describe:
|
|
37
|
-
builder:
|
|
38
|
-
handler:
|
|
31
|
+
}).demandCommand(1), d = (e, n = !1) => n ? i(e.strict().usage(f)) : i(
|
|
32
|
+
e.strict().usage(b).help("help").version(a.version).alias("v", "version").alias("h", "help")
|
|
33
|
+
).fail(u).argv, h = (e) => d(e, !0), U = {
|
|
34
|
+
command: t,
|
|
35
|
+
describe: g,
|
|
36
|
+
builder: h,
|
|
37
|
+
handler: c
|
|
39
38
|
}, I = async () => {
|
|
40
39
|
const e = l(p(process.argv)), n = await d(e);
|
|
41
|
-
return
|
|
40
|
+
return c(n);
|
|
42
41
|
};
|
|
43
42
|
export {
|
|
44
|
-
|
|
43
|
+
U as command,
|
|
45
44
|
I as createCli
|
|
46
45
|
};
|
package/es/utils/add.mjs
CHANGED
|
File without changes
|
package/es/utils/config.mjs
CHANGED
|
File without changes
|
package/es/utils/env-data.mjs
CHANGED
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
import a from "lodash.upperfirst";
|
|
3
3
|
import m from "lodash.camelcase";
|
|
4
4
|
import c from "lodash.kebabcase";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
const
|
|
5
|
+
import f from "lodash.lowerfirst";
|
|
6
|
+
import u from "node:path";
|
|
7
|
+
import b from "../injectInfo.json.mjs";
|
|
8
|
+
const { namespaceDir: D, moduleName: g } = b.cliConfig, v = () => u.resolve(D, g), C = () => ({
|
|
9
9
|
execDir: process.cwd(),
|
|
10
|
-
templateDir:
|
|
11
|
-
}),
|
|
12
|
-
const { series: r, name: i } = t, e = a(m(i)), p =
|
|
10
|
+
templateDir: v()
|
|
11
|
+
}), _ = (t) => {
|
|
12
|
+
const { series: r, name: i } = t, e = a(m(i)), p = f(e), l = c(e), o = r ? a(m(r)) : "", n = o ? `${o}${e}` : "", s = c(n);
|
|
13
13
|
return {
|
|
14
14
|
series: o,
|
|
15
15
|
name: e,
|
|
16
16
|
nameLowerFirst: p,
|
|
17
17
|
nameKebab: l,
|
|
18
|
-
fullName:
|
|
19
|
-
fullNameKebab:
|
|
20
|
-
cls:
|
|
18
|
+
fullName: n,
|
|
19
|
+
fullNameKebab: s,
|
|
20
|
+
cls: s
|
|
21
21
|
};
|
|
22
|
-
},
|
|
22
|
+
}, N = (t) => ({
|
|
23
23
|
$: "$",
|
|
24
|
-
...
|
|
25
|
-
...
|
|
24
|
+
...C(),
|
|
25
|
+
..._(t)
|
|
26
26
|
});
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
_ as getComponentEnvData,
|
|
29
|
+
N as getEnvData,
|
|
30
|
+
C as getPathEnvData,
|
|
31
|
+
v as getTemplateDirAbsolutePath
|
|
32
32
|
};
|
package/es/utils/list.mjs
CHANGED
|
File without changes
|
package/es/utils/name.mjs
CHANGED
|
File without changes
|
package/es/utils/operate.mjs
CHANGED
|
File without changes
|
package/es/utils/remove.mjs
CHANGED
|
File without changes
|
package/es/utils/types.mjs
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/cli-component",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "组件命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -34,13 +34,14 @@
|
|
|
34
34
|
"directory": "packages/component"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
37
|
+
"access": "public",
|
|
38
|
+
"registry": "https://registry.npmjs.org/"
|
|
38
39
|
},
|
|
39
40
|
"author": "JustSoSu",
|
|
40
41
|
"license": "MIT",
|
|
41
42
|
"sideEffects": false,
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@done-coding/cli-inject": "^0.
|
|
44
|
+
"@done-coding/cli-inject": "^0.3.1",
|
|
44
45
|
"@types/json5": "^2.2.0",
|
|
45
46
|
"@types/lodash.camelcase": "^4.3.8",
|
|
46
47
|
"@types/lodash.curry": "^4.1.8",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"node": ">=16.0.0"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"@done-coding/cli-template": "^0.
|
|
65
|
+
"@done-coding/cli-template": "^0.3.0",
|
|
65
66
|
"chalk": "^5.3.0",
|
|
66
67
|
"json5": "^2.2.3",
|
|
67
68
|
"lodash.camelcase": "^4.3.0",
|
|
@@ -74,5 +75,5 @@
|
|
|
74
75
|
"prompts": "^2.4.2",
|
|
75
76
|
"yargs": "^17.7.2"
|
|
76
77
|
},
|
|
77
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d1dabd6e46a5e38793bba477449dd62aa4d9c4c1"
|
|
78
79
|
}
|
package/types/cli.d.ts
CHANGED
|
File without changes
|
package/types/handler.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { Options } from './utils';
|
|
|
2
2
|
import { SubcommandEnum } from './utils';
|
|
3
3
|
import type { ArgumentsCamelCase } from "yargs";
|
|
4
4
|
/** 子命令处理函数 */
|
|
5
|
-
export declare const subHandler: (command: SubcommandEnum, argv: ArgumentsCamelCase<Options>) => Promise<void>;
|
|
6
|
-
export declare const handler: (argv: ArgumentsCamelCase<Options>) => Promise<void>;
|
|
5
|
+
export declare const subHandler: (command: SubcommandEnum, argv: ArgumentsCamelCase<Options> | Options) => Promise<void>;
|
|
6
|
+
export declare const handler: (argv: ArgumentsCamelCase<Options> | Options) => Promise<void>;
|
package/types/index.d.ts
CHANGED
|
File without changes
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
+
"version": "0.1.4",
|
|
2
3
|
"name": "@done-coding/cli-component",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
4
|
+
"description": "组件命令行工具",
|
|
5
|
+
"cliConfig": {
|
|
6
|
+
"namespaceDir": ".done-coding",
|
|
7
|
+
"moduleName": "component"
|
|
8
|
+
}
|
|
5
9
|
};
|
|
6
10
|
|
|
7
11
|
export default _default;
|
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
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
|
package/es/utils/const.mjs
DELETED
package/types/utils/const.d.ts
DELETED