@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 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
@@ -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
- version: "0.1.2",
5
- description: "组件命令行工具"
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 i, subHandler as r } from "./handler.mjs";
7
- import a from "chalk";
8
- import t from "./injectInfo.json.mjs";
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 c = u, g = (e, n) => {
11
- console.log(e ? a.red(e) : a.red(n.message)), process.exit(1);
12
- }, f = t.description, b = `Usage: $0 ${c} <command> [options]`, h = "Usage: $0 <command> [options]", s = (e) => e.command({
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 ? s(e.strict().usage(b)) : s(
33
- e.strict().usage(h).help("help").version(t.version).alias("v", "version").alias("h", "help")
34
- ).fail(g).argv, v = (e) => d(e, !0), A = {
35
- command: c,
36
- describe: f,
37
- builder: v,
38
- handler: i
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 i(n);
40
+ return c(n);
42
41
  };
43
42
  export {
44
- A as command,
43
+ U as command,
45
44
  I as createCli
46
45
  };
package/es/utils/add.mjs CHANGED
File without changes
File without changes
@@ -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 u from "lodash.lowerfirst";
6
- import b from "node:path";
7
- import { CLI_NAMESPACE_DIR as f, MODULE_NAME as D } from "./const.mjs";
8
- const E = () => b.resolve(f, D), _ = () => ({
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: E()
11
- }), v = (t) => {
12
- const { series: r, name: i } = t, e = a(m(i)), p = u(e), l = c(e), o = r ? a(m(r)) : "", s = o ? `${o}${e}` : "", n = c(s);
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: s,
19
- fullNameKebab: n,
20
- cls: n
18
+ fullName: n,
19
+ fullNameKebab: s,
20
+ cls: s
21
21
  };
22
- }, w = (t) => ({
22
+ }, N = (t) => ({
23
23
  $: "$",
24
- ..._(),
25
- ...v(t)
24
+ ...C(),
25
+ ..._(t)
26
26
  });
27
27
  export {
28
- v as getComponentEnvData,
29
- w as getEnvData,
30
- _ as getPathEnvData,
31
- E as getTemplateDirAbsolutePath
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
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-component",
3
- "version": "0.1.2",
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.2.2",
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.2.1",
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": "4fd613ca2bbdf655edd94895996129dcbd8ebb41"
78
+ "gitHead": "d1dabd6e46a5e38793bba477449dd62aa4d9c4c1"
78
79
  }
package/types/cli.d.ts CHANGED
File without changes
@@ -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
- "version": "0.1.2",
4
- "description": "组件命令行工具"
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
File without changes
File without changes
File without changes
@@ -1,4 +1,3 @@
1
- export * from "./const";
2
1
  export * from "./types";
3
2
  export * from "./name";
4
3
  export * from "./config";
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- const n = ".done-coding", o = "component";
3
- export {
4
- n as CLI_NAMESPACE_DIR,
5
- o as MODULE_NAME
6
- };
@@ -1,4 +0,0 @@
1
- /** 命令空间目录 */
2
- export declare const CLI_NAMESPACE_DIR = ".done-coding";
3
- /** 模块名 */
4
- export declare const MODULE_NAME = "component";