done-coding-component 0.3.8 → 0.3.10-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/es/cli.mjs +1 -1
- package/es/{index-31f805ac.js → index-6eba96ce.js} +7 -7
- package/es/index.mjs +1 -1
- package/package.json +5 -5
- package/types/cli.d.ts +1 -2
- package/types/index.d.ts +29 -2
- package/types/handler.d.ts +0 -5
- package/types/injectInfo.json.d.ts +0 -11
- package/types/main.d.ts +0 -9
- package/types/utils/add.d.ts +0 -3
- package/types/utils/config.d.ts +0 -3
- package/types/utils/env-data.d.ts +0 -41
- package/types/utils/index.d.ts +0 -6
- package/types/utils/list.d.ts +0 -6
- package/types/utils/name.d.ts +0 -7
- package/types/utils/operate.d.ts +0 -8
- package/types/utils/remove.d.ts +0 -3
- package/types/utils/types.d.ts +0 -44
package/es/cli.mjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import u from "node:path";
|
|
3
3
|
import p from "node:fs";
|
|
4
4
|
import x from "lodash.upperfirst";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import h from "lodash.camelcase";
|
|
6
|
+
import y from "lodash.kebabcase";
|
|
7
7
|
import A from "lodash.lowerfirst";
|
|
8
8
|
import f from "lodash.template";
|
|
9
9
|
import { log as m, json5 as L, chalk as g, xPrompts as w, _curry as b, createSubcommand as M, createMainCommand as F } from "@done-coding/cli-utils";
|
|
10
|
-
import { OutputModeEnum as
|
|
10
|
+
import { OutputModeEnum as $, compileHandler as O } from "@done-coding/cli-template";
|
|
11
11
|
var a = /* @__PURE__ */ ((e) => (e.ADD = "add", e.REMOVE = "remove", e.LIST = "list", e))(a || {});
|
|
12
12
|
const T = (e, t) => {
|
|
13
13
|
if (!/^[a-zA-Z]+[a-zA-Z0-9-]*$/.test(e))
|
|
@@ -17,7 +17,7 @@ const T = (e, t) => {
|
|
|
17
17
|
保留名称: ${n.join(",")}`), process.exit(1)) : !0;
|
|
18
18
|
}, N = {
|
|
19
19
|
name: "@done-coding/cli-component",
|
|
20
|
-
version: "0.3.
|
|
20
|
+
version: "0.3.10-alpha.0",
|
|
21
21
|
description: "组件命令行工具",
|
|
22
22
|
cliConfig: {
|
|
23
23
|
namespaceDir: ".done-coding",
|
|
@@ -27,7 +27,7 @@ const T = (e, t) => {
|
|
|
27
27
|
execDir: process.cwd(),
|
|
28
28
|
templateDir: I()
|
|
29
29
|
}), D = (e) => {
|
|
30
|
-
const { series: t, name: n } = e, o = x(
|
|
30
|
+
const { series: t, name: n } = e, o = x(h(n)), i = A(o), s = y(o), c = t ? x(h(t)) : "", l = c ? `${c}${o}` : "", r = y(l);
|
|
31
31
|
return {
|
|
32
32
|
series: c,
|
|
33
33
|
name: o,
|
|
@@ -96,7 +96,7 @@ const T = (e, t) => {
|
|
|
96
96
|
const d = {
|
|
97
97
|
...c,
|
|
98
98
|
envData: s,
|
|
99
|
-
mode:
|
|
99
|
+
mode: $.APPEND,
|
|
100
100
|
rollback: n === a.REMOVE,
|
|
101
101
|
/** 回滚时可以删除空文件 */
|
|
102
102
|
rollbackDelNullFile: !0,
|
|
@@ -112,7 +112,7 @@ const T = (e, t) => {
|
|
|
112
112
|
const d = {
|
|
113
113
|
...l,
|
|
114
114
|
envData: s,
|
|
115
|
-
mode:
|
|
115
|
+
mode: $.OVERWRITE,
|
|
116
116
|
rollback: n === a.REMOVE,
|
|
117
117
|
dealMarkdown: !0,
|
|
118
118
|
batch: !1,
|
package/es/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "done-coding-component",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10-alpha.0",
|
|
4
4
|
"description": "组件命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@done-coding/cli-inject": "^0.5.
|
|
33
|
+
"@done-coding/cli-inject": "^0.5.10-alpha.0",
|
|
34
34
|
"@types/lodash.camelcase": "^4.3.8",
|
|
35
35
|
"@types/lodash.kebabcase": "^4.1.8",
|
|
36
36
|
"@types/lodash.lowerfirst": "^4.3.8",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"node": ">=18.0.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@done-coding/cli-template": "^0.7.
|
|
51
|
-
"@done-coding/cli-utils": "^0.7.0",
|
|
50
|
+
"@done-coding/cli-template": "^0.7.10-alpha.0",
|
|
51
|
+
"@done-coding/cli-utils": "^0.7.1-alpha.0",
|
|
52
52
|
"lodash.camelcase": "^4.3.0",
|
|
53
53
|
"lodash.kebabcase": "^4.1.1",
|
|
54
54
|
"lodash.lowerfirst": "^4.3.1",
|
|
55
55
|
"lodash.template": "^4.5.0",
|
|
56
56
|
"lodash.upperfirst": "^4.3.1"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "3376f5fbbf8b87c791316e76df06028afd650e08",
|
|
59
59
|
"scripts": {}
|
|
60
60
|
}
|
package/types/cli.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export {};
|
|
1
|
+
export { }
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { CliHandlerArgv } from '@done-coding/cli-utils';
|
|
2
|
+
import { CommandModule } from 'yargs';
|
|
3
|
+
|
|
4
|
+
/** 作为子命令创建 */
|
|
5
|
+
export declare const crateAsSubcommand: () => CommandModule<{}, {}>;
|
|
6
|
+
|
|
7
|
+
/** 命令处理函数 */
|
|
8
|
+
export declare const handler: (command: SubcommandEnum, argv: CliHandlerArgv<Options>) => Promise<void>;
|
|
9
|
+
|
|
10
|
+
declare interface Options {
|
|
11
|
+
/**
|
|
12
|
+
* 组件名
|
|
13
|
+
* ---
|
|
14
|
+
* 新增时必传
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 子命令枚举 */
|
|
20
|
+
declare enum SubcommandEnum {
|
|
21
|
+
/** 新增组件 */
|
|
22
|
+
ADD = "add",
|
|
23
|
+
/** 移除组件 */
|
|
24
|
+
REMOVE = "remove",
|
|
25
|
+
/** 展示列表 */
|
|
26
|
+
LIST = "list"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { }
|
package/types/handler.d.ts
DELETED
package/types/main.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
/** 作为主命令创建 */
|
|
3
|
-
export declare const createCommand: () => Promise<void | {
|
|
4
|
-
[x: string]: unknown;
|
|
5
|
-
_: (string | number)[];
|
|
6
|
-
$0: string;
|
|
7
|
-
}>;
|
|
8
|
-
/** 作为子命令创建 */
|
|
9
|
-
export declare const crateAsSubcommand: () => import("yargs").CommandModule<{}, {}>;
|
package/types/utils/add.d.ts
DELETED
package/types/utils/config.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Config, Options } from "./types";
|
|
2
|
-
/** 获取模板目录绝对路径 */
|
|
3
|
-
export declare const getTemplateDirAbsolutePath: () => string;
|
|
4
|
-
/** 路径环境变量 */
|
|
5
|
-
export interface PathEnvData {
|
|
6
|
-
/** 执行命令的目录绝对路径 */
|
|
7
|
-
execDir: string;
|
|
8
|
-
/** 模板目录绝对路径 */
|
|
9
|
-
templateDir: string;
|
|
10
|
-
}
|
|
11
|
-
/** 获取路径环境变量 */
|
|
12
|
-
export declare const getPathEnvData: () => {
|
|
13
|
-
execDir: string;
|
|
14
|
-
templateDir: string;
|
|
15
|
-
};
|
|
16
|
-
/** 组件环境变量 */
|
|
17
|
-
export interface ComponentEnvData {
|
|
18
|
-
/** 矫正后的组件系列 */
|
|
19
|
-
series: string;
|
|
20
|
-
/** 矫正后的组件名 */
|
|
21
|
-
name: string;
|
|
22
|
-
/** 矫正后的组件名小写开头 */
|
|
23
|
-
nameLowerFirst: string;
|
|
24
|
-
/** 小写连接的组件名 */
|
|
25
|
-
nameKebab: string;
|
|
26
|
-
/** 矫正后的带系列组件名 */
|
|
27
|
-
fullName: string;
|
|
28
|
-
/** 矫正后的带系列小写连接的组件名 */
|
|
29
|
-
fullNameKebab: string;
|
|
30
|
-
/** 组件类名 */
|
|
31
|
-
cls: string;
|
|
32
|
-
}
|
|
33
|
-
/** 获取环境变量 */
|
|
34
|
-
export declare const getComponentEnvData: (data: Pick<Config, "series"> & Required<Options>) => ComponentEnvData;
|
|
35
|
-
/** 环境变量 */
|
|
36
|
-
export interface EnvData extends PathEnvData, ComponentEnvData {
|
|
37
|
-
/** 转义的$ */
|
|
38
|
-
$: "$";
|
|
39
|
-
}
|
|
40
|
-
/** 获取环境变量 */
|
|
41
|
-
export declare const getEnvData: (data: Pick<Config, "series"> & Required<Options>) => EnvData;
|
package/types/utils/index.d.ts
DELETED
package/types/utils/list.d.ts
DELETED
package/types/utils/name.d.ts
DELETED
package/types/utils/operate.d.ts
DELETED
package/types/utils/remove.d.ts
DELETED
package/types/utils/types.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { CompileOptions } from "@done-coding/cli-template";
|
|
2
|
-
/** 子命令枚举 */
|
|
3
|
-
export declare enum SubcommandEnum {
|
|
4
|
-
/** 新增组件 */
|
|
5
|
-
ADD = "add",
|
|
6
|
-
/** 移除组件 */
|
|
7
|
-
REMOVE = "remove",
|
|
8
|
-
/** 展示列表 */
|
|
9
|
-
LIST = "list"
|
|
10
|
-
}
|
|
11
|
-
export interface Options {
|
|
12
|
-
/**
|
|
13
|
-
* 组件名
|
|
14
|
-
* ---
|
|
15
|
-
* 新增时必传
|
|
16
|
-
*/
|
|
17
|
-
name?: string;
|
|
18
|
-
}
|
|
19
|
-
/** 模版配置输入路径 */
|
|
20
|
-
export type TemplateConfigInputByPath = Pick<CompileOptions, "input" | "output">;
|
|
21
|
-
/** 模版配置输入数据 */
|
|
22
|
-
export type TemplateConfigInputByData = Pick<CompileOptions, "inputData" | "output">;
|
|
23
|
-
/** 模版配置 */
|
|
24
|
-
export type TemplateConfig = TemplateConfigInputByPath | TemplateConfigInputByData;
|
|
25
|
-
/** 模版配置完整 */
|
|
26
|
-
export type TemplateConfigFull = Pick<CompileOptions, "input" | "inputData" | "output">;
|
|
27
|
-
/** 列表item */
|
|
28
|
-
export interface ConfigListItem {
|
|
29
|
-
/** 入口文件 */
|
|
30
|
-
entry: TemplateConfig;
|
|
31
|
-
/** 索引文件 */
|
|
32
|
-
index?: TemplateConfig;
|
|
33
|
-
}
|
|
34
|
-
/** 组件配置 */
|
|
35
|
-
export interface Config {
|
|
36
|
-
/** 组件系列 */
|
|
37
|
-
series: string;
|
|
38
|
-
/** 组件名排除列表 */
|
|
39
|
-
nameExcludes: string[];
|
|
40
|
-
/** 组件目录 */
|
|
41
|
-
componentDir: string;
|
|
42
|
-
/** 配置列表 */
|
|
43
|
-
list: ConfigListItem[];
|
|
44
|
-
}
|