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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-31f805ac.js";
2
+ import { c as m } from "./index-6eba96ce.js";
3
3
  import "node:path";
4
4
  import "node:fs";
5
5
  import "lodash.upperfirst";
@@ -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 y from "lodash.camelcase";
6
- import $ from "lodash.kebabcase";
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 h, compileHandler as O } from "@done-coding/cli-template";
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.8",
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(y(n)), i = A(o), s = $(o), c = t ? x(y(t)) : "", l = c ? `${c}${o}` : "", r = $(l);
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: h.APPEND,
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: h.OVERWRITE,
115
+ mode: $.OVERWRITE,
116
116
  rollback: n === a.REMOVE,
117
117
  dealMarkdown: !0,
118
118
  batch: !1,
package/es/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as b, h as c } from "./index-31f805ac.js";
2
+ import { a as b, h as c } from "./index-6eba96ce.js";
3
3
  import "node:path";
4
4
  import "node:fs";
5
5
  import "lodash.upperfirst";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "done-coding-component",
3
- "version": "0.3.8",
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.8",
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.8",
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": "b4fb4f2380a14f72597a1dbfd1bbce22287ef02f",
58
+ "gitHead": "3376f5fbbf8b87c791316e76df06028afd650e08",
59
59
  "scripts": {}
60
60
  }
package/types/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ export { }
package/types/index.d.ts CHANGED
@@ -1,2 +1,29 @@
1
- export { handler } from "./handler";
2
- export { crateAsSubcommand } from "./main";
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 { }
@@ -1,5 +0,0 @@
1
- import type { Options } from './utils';
2
- import { SubcommandEnum } from './utils';
3
- import type { CliHandlerArgv } from "@done-coding/cli-utils";
4
- /** 命令处理函数 */
5
- export declare const handler: (command: SubcommandEnum, argv: CliHandlerArgv<Options>) => Promise<void>;
@@ -1,11 +0,0 @@
1
- declare const _default: {
2
- "name": "@done-coding/cli-component",
3
- "version": "0.3.8",
4
- "description": "组件命令行工具",
5
- "cliConfig": {
6
- "namespaceDir": ".done-coding",
7
- "moduleName": "component"
8
- }
9
- };
10
-
11
- export default _default;
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<{}, {}>;
@@ -1,3 +0,0 @@
1
- import type { Options } from "./types";
2
- /** 新增组件 */
3
- export declare const addComponent: ({ name: nameInit }: Options) => Promise<undefined>;
@@ -1,3 +0,0 @@
1
- import type { Config } from "./types";
2
- /** 获取配置 */
3
- export declare const getConfig: () => Config;
@@ -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;
@@ -1,6 +0,0 @@
1
- export * from "./types";
2
- export * from "./name";
3
- export * from "./config";
4
- export * from "./list";
5
- export * from "./add";
6
- export * from "./remove";
@@ -1,6 +0,0 @@
1
- import type { Config } from "./types";
2
- /**
3
- * 获取组件列表
4
- */
5
- export declare const getComponentList: (config: Config) => string[];
6
- export declare const listComponent: () => Promise<void>;
@@ -1,7 +0,0 @@
1
- import type { Config } from "./types";
2
- /**
3
- * 组件名检测
4
- * ---
5
- * 限制只能字母、数字、中划线且以字母开头
6
- */
7
- export declare const ensureNameLegal: (name: string, config: Config) => boolean;
@@ -1,8 +0,0 @@
1
- import type { Config } from "./types";
2
- import { SubcommandEnum } from "./types";
3
- /** 操作组件 */
4
- export declare const operateComponent: ({ name, config, command, }: {
5
- name: string;
6
- config: Config;
7
- command: SubcommandEnum;
8
- }) => Promise<undefined>;
@@ -1,3 +0,0 @@
1
- import type { Options } from "./types";
2
- /** 新增组件 */
3
- export declare const removeComponent: ({ name: nameInit }: Options) => Promise<undefined>;
@@ -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
- }