md-hopper 1.0.0-alpha.8 → 1.0.1

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.
Files changed (120) hide show
  1. package/README.md +1 -1
  2. package/dist/{_internal → lib/_internal}/types/command.d.ts +1 -0
  3. package/dist/lib/_internal/types/command.d.ts.map +1 -0
  4. package/dist/lib/_internal/types/configs/__generate.d.ts +42 -0
  5. package/dist/lib/_internal/types/configs/__generate.d.ts.map +1 -0
  6. package/dist/lib/_internal/types/configs/__generate.js +155 -0
  7. package/dist/lib/_internal/types/configs/_generate.d.ts +40 -0
  8. package/dist/lib/_internal/types/configs/_generate.d.ts.map +1 -0
  9. package/dist/lib/_internal/types/configs/_generate.js +176 -0
  10. package/dist/{_internal → lib/_internal}/types/configs/generate.d.ts +3 -7
  11. package/dist/lib/_internal/types/configs/generate.d.ts.map +1 -0
  12. package/dist/lib/_internal/types/configs/generate.js +153 -0
  13. package/dist/{_internal → lib/_internal}/types/configs/help.d.ts +1 -0
  14. package/dist/lib/_internal/types/configs/help.d.ts.map +1 -0
  15. package/dist/{_internal → lib/_internal}/types/configs/links.d.ts +1 -0
  16. package/dist/lib/_internal/types/configs/links.d.ts.map +1 -0
  17. package/dist/{_internal → lib/_internal}/types/configs.d.ts +1 -0
  18. package/dist/lib/_internal/types/configs.d.ts.map +1 -0
  19. package/dist/lib/_internal/types/inquirer.d.ts +20 -0
  20. package/dist/lib/_internal/types/inquirer.d.ts.map +1 -0
  21. package/dist/lib/_internal/types/inquirer.js +1 -0
  22. package/dist/{_internal → lib/_internal}/types/md.d.ts +1 -0
  23. package/dist/lib/_internal/types/md.d.ts.map +1 -0
  24. package/dist/{_internal → lib/_internal}/types/process.d.ts +1 -0
  25. package/dist/lib/_internal/types/process.d.ts.map +1 -0
  26. package/dist/{_internal → lib/_internal}/utils/chalk.d.ts +1 -0
  27. package/dist/lib/_internal/utils/chalk.d.ts.map +1 -0
  28. package/dist/lib/_internal/utils/command.d.ts +76 -0
  29. package/dist/lib/_internal/utils/command.d.ts.map +1 -0
  30. package/dist/{_internal → lib/_internal}/utils/command.js +52 -0
  31. package/dist/{_internal → lib/_internal}/utils/configs.d.ts +1 -0
  32. package/dist/lib/_internal/utils/configs.d.ts.map +1 -0
  33. package/dist/{_internal → lib/_internal}/utils/fs.d.ts +2 -1
  34. package/dist/lib/_internal/utils/fs.d.ts.map +1 -0
  35. package/dist/{_internal → lib/_internal}/utils/link.d.ts +1 -0
  36. package/dist/lib/_internal/utils/link.d.ts.map +1 -0
  37. package/dist/{_internal → lib/_internal}/utils/link.js +1 -0
  38. package/dist/{_internal → lib/_internal}/utils/log.d.ts +1 -0
  39. package/dist/lib/_internal/utils/log.d.ts.map +1 -0
  40. package/dist/{_internal → lib/_internal}/utils/md/lexer.d.ts +1 -0
  41. package/dist/lib/_internal/utils/md/lexer.d.ts.map +1 -0
  42. package/dist/{_internal → lib/_internal}/utils/md/line.d.ts +1 -0
  43. package/dist/lib/_internal/utils/md/line.d.ts.map +1 -0
  44. package/dist/{_internal → lib/_internal}/utils/md.d.ts +1 -0
  45. package/dist/lib/_internal/utils/md.d.ts.map +1 -0
  46. package/dist/{_internal → lib/_internal}/utils/minimatch.d.ts +1 -0
  47. package/dist/lib/_internal/utils/minimatch.d.ts.map +1 -0
  48. package/dist/{_internal → lib/_internal}/utils/path-match.d.ts +1 -0
  49. package/dist/lib/_internal/utils/path-match.d.ts.map +1 -0
  50. package/dist/{_internal → lib/_internal}/utils/path.d.ts +13 -1
  51. package/dist/lib/_internal/utils/path.d.ts.map +1 -0
  52. package/dist/{_internal → lib/_internal}/utils/path.js +29 -3
  53. package/dist/{_internal → lib/_internal}/utils/process.d.ts +1 -0
  54. package/dist/lib/_internal/utils/process.d.ts.map +1 -0
  55. package/dist/{_internal → lib/_internal}/utils/process.js +5 -1
  56. package/dist/{_internal → lib/_internal}/utils/type-check.d.ts +1 -0
  57. package/dist/lib/_internal/utils/type-check.d.ts.map +1 -0
  58. package/dist/{cli → lib/cli}/commands/generate/action.d.ts +1 -0
  59. package/dist/lib/cli/commands/generate/action.d.ts.map +1 -0
  60. package/dist/{cli → lib/cli}/commands/generate/actions/link.d.ts +1 -0
  61. package/dist/lib/cli/commands/generate/actions/link.d.ts.map +1 -0
  62. package/dist/{cli → lib/cli}/commands/generate/actions/link.js +14 -16
  63. package/dist/{cli → lib/cli}/commands/generate/actions/rc.d.ts +1 -0
  64. package/dist/lib/cli/commands/generate/actions/rc.d.ts.map +1 -0
  65. package/dist/{cli → lib/cli}/commands/generate/command.d.ts +1 -0
  66. package/dist/lib/cli/commands/generate/command.d.ts.map +1 -0
  67. package/dist/{cli → lib/cli}/commands/generate/command.js +15 -24
  68. package/dist/{cli → lib/cli}/commands/help/action.d.ts +1 -0
  69. package/dist/lib/cli/commands/help/action.d.ts.map +1 -0
  70. package/dist/{cli → lib/cli}/commands/help/action.js +1 -0
  71. package/dist/{cli → lib/cli}/commands/help/command.d.ts +1 -0
  72. package/dist/lib/cli/commands/help/command.d.ts.map +1 -0
  73. package/dist/{cli → lib/cli}/commands/help/command.js +1 -1
  74. package/dist/{cli → lib/cli}/commands/index.d.ts +1 -0
  75. package/dist/lib/cli/commands/index.d.ts.map +1 -0
  76. package/dist/{cli → lib/cli}/commands/index.js +2 -1
  77. package/dist/{cli → lib/cli}/commands/link/action.d.ts +1 -0
  78. package/dist/lib/cli/commands/link/action.d.ts.map +1 -0
  79. package/dist/{cli → lib/cli}/commands/link/command.d.ts +1 -0
  80. package/dist/lib/cli/commands/link/command.d.ts.map +1 -0
  81. package/dist/lib/cli/commands/link/command.js +22 -0
  82. package/dist/lib/cli/index.d.ts +3 -0
  83. package/dist/lib/cli/index.d.ts.map +1 -0
  84. package/dist/{cli → lib/cli}/index.js +2 -0
  85. package/dist/package.json +50 -0
  86. package/package.json +30 -92
  87. package/cli/commands/generate/action/package.json +0 -6
  88. package/cli/commands/generate/actions/link/package.json +0 -6
  89. package/cli/commands/generate/actions/rc/package.json +0 -6
  90. package/cli/commands/generate/command/package.json +0 -6
  91. package/cli/commands/help/action/package.json +0 -6
  92. package/cli/commands/help/command/package.json +0 -6
  93. package/cli/commands/index/package.json +0 -6
  94. package/cli/commands/link/README.md/package.json +0 -6
  95. package/cli/commands/link/action/package.json +0 -6
  96. package/cli/commands/link/command/package.json +0 -6
  97. package/cli/index/package.json +0 -6
  98. package/dist/_internal/types/configs/generate.js +0 -131
  99. package/dist/_internal/utils/command.d.ts +0 -20
  100. package/dist/cli/commands/link/command.js +0 -21
  101. package/dist/cli/index.d.ts +0 -2
  102. /package/dist/{_internal → lib/_internal}/types/command.js +0 -0
  103. /package/dist/{_internal → lib/_internal}/types/configs/help.js +0 -0
  104. /package/dist/{_internal → lib/_internal}/types/configs/links.js +0 -0
  105. /package/dist/{_internal → lib/_internal}/types/configs.js +0 -0
  106. /package/dist/{_internal → lib/_internal}/types/md.js +0 -0
  107. /package/dist/{_internal → lib/_internal}/types/process.js +0 -0
  108. /package/dist/{_internal → lib/_internal}/utils/chalk.js +0 -0
  109. /package/dist/{_internal → lib/_internal}/utils/configs.js +0 -0
  110. /package/dist/{_internal → lib/_internal}/utils/fs.js +0 -0
  111. /package/dist/{_internal → lib/_internal}/utils/log.js +0 -0
  112. /package/dist/{_internal → lib/_internal}/utils/md/lexer.js +0 -0
  113. /package/dist/{_internal → lib/_internal}/utils/md/line.js +0 -0
  114. /package/dist/{_internal → lib/_internal}/utils/md.js +0 -0
  115. /package/dist/{_internal → lib/_internal}/utils/minimatch.js +0 -0
  116. /package/dist/{_internal → lib/_internal}/utils/path-match.js +0 -0
  117. /package/dist/{_internal → lib/_internal}/utils/type-check.js +0 -0
  118. /package/dist/{cli → lib/cli}/commands/generate/action.js +0 -0
  119. /package/dist/{cli → lib/cli}/commands/generate/actions/rc.js +0 -0
  120. /package/dist/{cli → lib/cli}/commands/link/action.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inquirer.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/types/inquirer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE3E,KAAK,KAAK,GAAG,OAAO,KAAK,GAAG,OAAO,OAAO,GAAG,OAAO,MAAM,GAAG,OAAO,OAAO,GAAG,OAAO,MAAM,CAAA;AAE3F,UAAU,QAAQ,CAAC,CAAC,SAAS,KAAK;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,CAAA;IAC7B,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CACjC;AAED,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAA;AAClD,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAA;AACtD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AACpD,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAA;AACtD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AAEpD,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,aAAa,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,cAAc,CAAC,CAAA;AAE1H,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC/D,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAClE,MAAM,WAAW,OAAO;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;CAC9B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -49,3 +49,4 @@ export declare const MD_HOPPER_PARAMS_REG_EXP: RegExp;
49
49
  export declare const MD_HOPPER_CONTENT_REG_EXP: RegExp;
50
50
  export declare const MD_HOPPER_PROPERTY_REG_EXP: RegExp;
51
51
  export declare const getParamExp: (param: string) => RegExp;
52
+ //# sourceMappingURL=md.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/types/md.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;CAQtB,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,MAAO,SAAQ,QAAQ,EAAE,iBAAiB;CAAG;AAE9D,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,IAAI,CAAA;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAC5C,eAAO,MAAM,aAAa,SAAS,CAAA;AACnC,eAAO,MAAM,WAAW,QAAQ,CAAA;AAChC,eAAO,MAAM,eAAe,MAAM,CAAA;AAClC,eAAO,MAAM,wBAAwB,cAAc,CAAA;AACnD,eAAO,MAAM,eAAe,QAA4D,CAAA;AACxF,eAAO,MAAM,kBAAkB,QAA2B,CAAA;AAC1D,eAAO,MAAM,YAAY,QAAsD,CAAA;AAC/E,eAAO,MAAM,gCAAgC,QAE5C,CAAA;AACD,eAAO,MAAM,wBAAwB,QAGpC,CAAA;AACD,eAAO,MAAM,yBAAyB,QAGrC,CAAA;AACD,eAAO,MAAM,0BAA0B,QAAoE,CAAA;AAC3G,eAAO,MAAM,WAAW,UAAW,MAAM,WAItC,CAAA"}
@@ -3,3 +3,4 @@ export declare const ENVS: {
3
3
  readonly IS_DEBUG: "IS_DEBUG";
4
4
  };
5
5
  export type Env = (typeof ENVS)[keyof typeof ENVS];
6
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/types/process.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;CAGP,CAAA;AACV,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,CAAC,CAAA"}
@@ -5,3 +5,4 @@ export declare const error: import("chalk").ChalkInstance;
5
5
  export declare const hop: import("chalk").ChalkInstance;
6
6
  export declare const cyan: import("chalk").ChalkInstance;
7
7
  export declare const bold: import("chalk").ChalkInstance;
8
+ //# sourceMappingURL=chalk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chalk.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/chalk.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,+BAAc,CAAA;AAClC,eAAO,MAAM,IAAI,+BAAuB,CAAA;AACxC,eAAO,MAAM,IAAI,+BAAuB,CAAA;AACxC,eAAO,MAAM,KAAK,+BAAY,CAAA;AAC9B,eAAO,MAAM,GAAG,+BAAuB,CAAA;AACvC,eAAO,MAAM,IAAI,+BAAa,CAAA;AAC9B,eAAO,MAAM,IAAI,+BAAa,CAAA"}
@@ -0,0 +1,76 @@
1
+ import { Command as Program } from 'commander';
2
+ import { Action } from '../types/command.js';
3
+ type SettingsFnc<CommandOptions extends Record<string, any>, MdSettings extends Record<string, any>> = (options: CommandOptions) => MdSettings;
4
+ export declare const OPTION_SHORTS: Readonly<{
5
+ readonly a: "";
6
+ readonly b: "";
7
+ readonly c: "";
8
+ readonly d: "";
9
+ readonly e: "";
10
+ readonly f: "filenames";
11
+ readonly g: "";
12
+ readonly h: "";
13
+ readonly i: "input";
14
+ readonly j: "";
15
+ readonly k: "";
16
+ readonly l: "";
17
+ readonly m: "";
18
+ readonly n: "";
19
+ readonly o: "output";
20
+ readonly p: "";
21
+ readonly q: "";
22
+ readonly r: "";
23
+ readonly s: "skip-hidden";
24
+ readonly t: "type";
25
+ readonly u: "";
26
+ readonly v: "";
27
+ readonly w: "";
28
+ readonly x: "";
29
+ readonly y: "";
30
+ readonly z: "";
31
+ readonly A: "";
32
+ readonly B: "";
33
+ readonly C: "";
34
+ readonly D: "depth";
35
+ readonly E: "exclude";
36
+ readonly F: "";
37
+ readonly G: "id-gen";
38
+ readonly H: "";
39
+ readonly I: "include";
40
+ readonly J: "";
41
+ readonly K: "";
42
+ readonly L: "lock";
43
+ readonly M: "";
44
+ readonly N: "";
45
+ readonly O: "";
46
+ readonly P: "";
47
+ readonly Q: "";
48
+ readonly R: "";
49
+ readonly S: "";
50
+ readonly T: "title";
51
+ readonly U: "";
52
+ readonly V: "";
53
+ readonly W: "";
54
+ readonly X: "";
55
+ readonly Y: "";
56
+ readonly Z: "";
57
+ }>;
58
+ export declare const OPTIONS: Record<string, string>;
59
+ export declare class CommandClass<CommandOptions extends Record<string, any>, MdSettings extends Record<string, any>> {
60
+ program: Program;
61
+ private befores;
62
+ private args;
63
+ private getSettingFnc;
64
+ constructor(program: Program, getSettingFnc: SettingsFnc<CommandOptions, MdSettings>);
65
+ init(options: CommandOptions, settings: MdSettings): this;
66
+ command(command: string): this;
67
+ help(helpTxt: string): this;
68
+ before(before: Action, ...args: any[]): this;
69
+ description(description: string): this;
70
+ option(...args: any[]): this;
71
+ requiredOption(...args: any[]): this;
72
+ action(action: Action): void;
73
+ }
74
+ export declare const setCommands: <CommandOptions extends Record<string, any>, MdSettings extends Record<string, any>>(program: Program, commands: string[], initFnc: (commandClass: CommandClass<CommandOptions, MdSettings>) => void, getSettingFnc: SettingsFnc<CommandOptions, MdSettings>) => void;
75
+ export {};
76
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAE,MAAM,EAA6B,MAAM,mBAAmB,CAAA;AAErE,KAAK,WAAW,CAAC,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CACrG,OAAO,EAAE,cAAc,KACpB,UAAU,CAAA;AAQf,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCf,CAAA;AAOX,eAAO,MAAM,OAAO,wBAQd,CAAA;AAEN,qBAAa,YAAY,CAAC,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC1G,OAAO,EAAG,OAAO,CAAA;IACjB,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,IAAI,CAAwC;IACpD,OAAO,CAAC,aAAa,CAAyC;gBAElD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,cAAc,EAAE,UAAU,CAAC;IAMpF,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU;IAQlD,OAAO,CAAC,OAAO,EAAE,MAAM;IAKvB,IAAI,CAAC,OAAO,EAAE,MAAM;IAQpB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAKrC,WAAW,CAAC,WAAW,EAAE,MAAM;IAK/B,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAMrB,cAAc,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAM7B,MAAM,CAAC,MAAM,EAAE,MAAM;CAUtB;AAED,eAAO,MAAM,WAAW,GAAI,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,WACnG,OAAO,YACN,MAAM,EAAE,WACT,CAAC,YAAY,EAAE,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,KAAK,IAAI,iBAC1D,WAAW,CAAC,cAAc,EAAE,UAAU,CAAC,SAKvD,CAAA"}
@@ -1,3 +1,54 @@
1
+ const invert = (obj) => {
2
+ return Object.fromEntries(Object.entries(obj).map(([key, value]) => [value, key]));
3
+ };
4
+ export const OPTION_SHORTS = Object.freeze({
5
+ a: '',
6
+ b: '',
7
+ c: '',
8
+ d: '',
9
+ e: '',
10
+ f: 'filenames',
11
+ g: '',
12
+ h: '',
13
+ i: 'input',
14
+ j: '',
15
+ k: '',
16
+ l: '',
17
+ m: '',
18
+ n: '',
19
+ o: 'output',
20
+ p: '',
21
+ q: '',
22
+ r: '',
23
+ s: 'skip-hidden',
24
+ t: 'type',
25
+ u: '',
26
+ v: '',
27
+ w: '',
28
+ x: '',
29
+ y: '',
30
+ z: '',
31
+ A: '',
32
+ B: '',
33
+ C: '',
34
+ D: 'depth', E: 'exclude', F: '', G: 'id-gen',
35
+ H: '', I: 'include', J: '', K: '',
36
+ L: 'lock', M: '', N: '', O: '', P: '', Q: '', R: '', S: '', T: 'title', U: '', V: '', W: '', X: '', Y: '', Z: '',
37
+ });
38
+ const INVERTED_OPTION_SHORTS = invert(OPTION_SHORTS);
39
+ const OPTION_KEYS = Object.freeze([
40
+ 'filenames', 'input', 'output', 'skip-hidden', 'type', 'depth', 'exclude', 'id-gen', 'include', 'lock', 'title', 'id'
41
+ ]);
42
+ export const OPTIONS = OPTION_KEYS.reduce((acc, key) => {
43
+ const short = INVERTED_OPTION_SHORTS[key];
44
+ if (!short) {
45
+ acc[key] = `--${key}`;
46
+ }
47
+ else {
48
+ acc[key] = `-${short}, --${key}`;
49
+ }
50
+ return acc;
51
+ }, {});
1
52
  export class CommandClass {
2
53
  program;
3
54
  befores = [];
@@ -7,6 +58,7 @@ export class CommandClass {
7
58
  this.program = program;
8
59
  this.getSettingFnc = getSettingFnc;
9
60
  }
61
+ // async init(options: ActionArg<T>['options'], settings: Settings) {
10
62
  init(options, settings) {
11
63
  this.args = {
12
64
  options,
@@ -2,3 +2,4 @@ export declare const DEFAULT_MD_FILENAME = "README.md";
2
2
  export declare const SETTING_FILENAME = "README.md";
3
3
  export declare const importLineRegExp: RegExp;
4
4
  export declare const indentRegExp: RegExp;
5
+ //# sourceMappingURL=configs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/configs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,cAAc,CAAA;AAC9C,eAAO,MAAM,gBAAgB,cAAsB,CAAA;AACnD,eAAO,MAAM,gBAAgB,QAA6C,CAAA;AAC1E,eAAO,MAAM,YAAY,QAAyB,CAAA"}
@@ -1,5 +1,6 @@
1
- /// <reference types="node" resolution-mode="require"/>
1
+ import { getAllFiles } from 'my-gadgetry/fs';
2
2
  export { getAllFiles } from 'my-gadgetry/fs';
3
3
  export declare const readJsonFileSync: (path: string, encode?: BufferEncoding) => {};
4
4
  export declare const isDirectory: (path: string) => boolean;
5
5
  export declare const getAllMdFiles: (filenames: string[], startDir: string, _options?: import("my-gadgetry/fs").Options | undefined) => string[];
6
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/fs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,eAAO,MAAM,gBAAgB,SAAU,MAAM,WAAU,cAAc,OAMpE,CAAA;AAED,eAAO,MAAM,WAAW,SAAU,MAAM,YAKvC,CAAA;AAED,eAAO,MAAM,aAAa,cAAe,MAAM,EAAE,wFAC+C,CAAA"}
@@ -2,3 +2,4 @@ import { MdSettings } from '../types/configs/links.js';
2
2
  export declare const DEFAULT_SETTINGS: MdSettings;
3
3
  export declare const parse: (txt: string) => MdSettings;
4
4
  export declare const getSettings: (inputFilename: string) => MdSettings;
5
+ //# sourceMappingURL=link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/link.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAUpD,eAAO,MAAM,gBAAgB,EAAE,UAQ7B,CAAA;AAEF,eAAO,MAAM,KAAK,QAAS,MAAM,KAAG,UA2BnC,CAAA;AAED,eAAO,MAAM,WAAW,kBAAmB,MAAM,KAAG,UAGnD,CAAA"}
@@ -37,6 +37,7 @@ export const parse = (txt) => {
37
37
  else {
38
38
  continue;
39
39
  }
40
+ // @ts-ignore: TS7053: Element implicitly has an any type because expression of type any can't be used to index type Setting
40
41
  settings[key] = val;
41
42
  }
42
43
  return {
@@ -3,3 +3,4 @@ export declare const warn: (...args: any[]) => void;
3
3
  export declare const info: (...args: any[]) => void;
4
4
  export declare const error: (...args: any[]) => void;
5
5
  export declare const hop: (...args: any[]) => void;
6
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/log.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,YAAa,GAAG,EAAE,SAErC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,GAAG,EAAE,SAElC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,GAAG,EAAE,SAElC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,GAAG,EAAE,SAEnC,CAAA;AAED,eAAO,MAAM,GAAG,YAAa,GAAG,EAAE,SAEjC,CAAA"}
@@ -1 +1,2 @@
1
1
  export declare const lexer: (txt: string) => import("marked").Token;
2
+ //# sourceMappingURL=lexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_internal/utils/md/lexer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,QAAS,MAAM,2BAGhC,CAAA"}
@@ -20,3 +20,4 @@ export declare const getProperties: (txt: string) => {
20
20
  } | null;
21
21
  export declare const replaceLineToLink: (txt: string, defineName: string) => string;
22
22
  export {};
23
+ //# sourceMappingURL=line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_internal/utils/md/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAahD,KAAK,KAAK,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAA;AAE7C,UAAU,QAAQ;IAChB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACjB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CACpB;AAED,eAAO,MAAM,gBAAgB,kBAAmB,QAAQ;;;CAKvD,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,MAAM;;;;CAStC,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,MAAM;;;;QAsBxC,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAS,MAAM,cAAc,MAAM,WAOhE,CAAA"}
@@ -9,3 +9,4 @@ export declare const getTitle: (txt: string) => string;
9
9
  export declare const replace: (detail: Detail, details: Detail[]) => string;
10
10
  export declare const getLinkedMdDetail: (md: string) => MdAttributes;
11
11
  export {};
12
+ //# sourceMappingURL=md.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/md.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,MAAM,EAiBP,MAAM,cAAc,CAAA;AAMrB,eAAO,MAAM,QAAQ,QAAS,MAAM,OAAO,MAAM,WAOhD,CAAA;AAED,eAAO,MAAM,eAAe,UAAW,MAAM,SAAS,MAAM,WACyD,CAAA;AACrH,eAAO,MAAM,YAAY,cAAe,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,WAKhF,CAAA;AACD,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;AAC9D,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,aAAa,6BAA6B,CAAC,WACsB,CAAA;AAC5G,eAAO,MAAM,WAAW,OAAQ,MAAM,SAAS,MAAM,WAEpD,CAAA;AASD,eAAO,MAAM,QAAQ,QAAS,MAAM,WASnC,CAAA;AA8LD,eAAO,MAAM,OAAO,WAAY,MAAM,WAAW,MAAM,EAAE,WAmDxD,CAAA;AAED,eAAO,MAAM,iBAAiB,OAAQ,MAAM,KAAG,YAW9C,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export declare const getExclude: (basePath: string, excludes: string[], skipHidden: boolean) => string[];
2
2
  export declare const getInclude: (basePath: string, includes: string[]) => string[];
3
+ //# sourceMappingURL=minimatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimatch.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/minimatch.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,aAAc,MAAM,YAAY,MAAM,EAAE,cAAc,OAAO,aAOnF,CAAA;AAED,eAAO,MAAM,UAAU,aAAc,MAAM,YAAY,MAAM,EAAE,aAE9D,CAAA"}
@@ -1 +1,2 @@
1
1
  export declare const isMatch: (path: string, pattern: string) => boolean;
2
+ //# sourceMappingURL=path-match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-match.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/path-match.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,SAAU,MAAM,WAAW,MAAM,YAA6B,CAAA"}
@@ -1,8 +1,9 @@
1
+ export declare const getDirnameFromFileURL: (url: string) => string;
1
2
  export declare const isDirectory: (path: string) => boolean;
2
3
  export declare const getExecDir: () => string;
3
4
  export declare const getParseDirPath: (path: string) => string;
4
5
  export declare const getParentDirname: (path: string) => string | undefined;
5
- export declare const getCommands: (path: string, start?: number, end?: number) => string[];
6
+ export declare const getCommands: (filepath: string, start?: number, end?: number) => string[];
6
7
  export declare const DEPTH_TYPES: {
7
8
  ancestor: string;
8
9
  parent: string;
@@ -12,5 +13,16 @@ export declare const DEPTH_TYPES: {
12
13
  different: string;
13
14
  };
14
15
  export type DepthType = (typeof DEPTH_TYPES)[keyof typeof DEPTH_TYPES];
16
+ /**
17
+ * A: /hoge, B: /hoge/foo/piyo -> ancestor
18
+ * A: /hoge/foo, B: /hoge/foo/piyo -> parent
19
+ * A: /hoge/foo, B: /hoge/foo -> parallel
20
+ * A: /hoge/foo/piyo, B: /hoge/foo -> child
21
+ * A: /hoge/foo/piyo, B: /hoge -> grandchild
22
+ * A: /foo, B: /hoge -> different
23
+ * @param thisDir
24
+ * @param isTypeFromThisDir
25
+ */
15
26
  export declare const getDepthType: (thisDir: string, isTypeFromThisDir: string) => DepthType;
16
27
  export declare const getRelative: (dir: string, path: string) => string;
28
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/path.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,qBAAqB,QAAS,MAAM,WAAgC,CAAA;AACjF,eAAO,MAAM,WAAW,SAAU,MAAM,YAAqB,CAAA;AAC7D,eAAO,MAAM,UAAU,cAAsB,CAAA;AAC7C,eAAO,MAAM,eAAe,SAAU,MAAM,WAAoB,CAAA;AAChE,eAAO,MAAM,gBAAgB,SAAU,MAAM,uBAA0B,CAAA;AACvE,eAAO,MAAM,WAAW,aAAc,MAAM,2CAM3C,CAAA;AAID,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAA;AACD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AACtE;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,YAAa,MAAM,qBAAqB,MAAM,KAAG,SAoBzE,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,MAAM,QAAQ,MAAM,WAAwB,CAAA"}
@@ -1,15 +1,31 @@
1
- import { parse, relative } from 'path';
1
+ import { parse, relative, dirname } from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ // export const getProjectRootPath = () => {
4
+ // let path = process.cwd()
5
+ // if (!existsSync(join(path, SETTING_FILENAME))) {
6
+ // for (const _ in process.cwd().split(/\//g)) {
7
+ // path = join(path, '..')
8
+ // if (existsSync(join(path, SETTING_FILENAME))) {
9
+ // break
10
+ // }
11
+ // }
12
+ // }
13
+ //
14
+ // return path
15
+ // }
16
+ export const getDirnameFromFileURL = (url) => dirname(fileURLToPath(url));
2
17
  export const isDirectory = (path) => !parse(path).ext;
3
18
  export const getExecDir = () => process.cwd();
4
19
  export const getParseDirPath = (path) => parse(path).dir;
5
20
  export const getParentDirname = (path) => path.split('/').pop();
6
- export const getCommands = (path, start = 0, end = 1) => {
7
- const dirname = getParentDirname(path);
21
+ export const getCommands = (filepath, start = 0, end = 1) => {
22
+ const dirname = getParentDirname(getDirnameFromFileURL(filepath));
8
23
  if (!dirname) {
9
24
  throw new Error('no command name');
10
25
  }
11
26
  return [dirname, dirname.substring(start, end)];
12
27
  };
28
+ // export const getFullPath = (...path: string[]) => join(getProjectRootPath(), ...path)
13
29
  export const DEPTH_TYPES = {
14
30
  ancestor: 'ancestor',
15
31
  parent: 'parent',
@@ -18,6 +34,16 @@ export const DEPTH_TYPES = {
18
34
  grandchild: 'grandchild',
19
35
  different: 'different',
20
36
  };
37
+ /**
38
+ * A: /hoge, B: /hoge/foo/piyo -> ancestor
39
+ * A: /hoge/foo, B: /hoge/foo/piyo -> parent
40
+ * A: /hoge/foo, B: /hoge/foo -> parallel
41
+ * A: /hoge/foo/piyo, B: /hoge/foo -> child
42
+ * A: /hoge/foo/piyo, B: /hoge -> grandchild
43
+ * A: /foo, B: /hoge -> different
44
+ * @param thisDir
45
+ * @param isTypeFromThisDir
46
+ */
21
47
  export const getDepthType = (thisDir, isTypeFromThisDir) => {
22
48
  if (thisDir === isTypeFromThisDir) {
23
49
  return DEPTH_TYPES.parallel;
@@ -4,3 +4,4 @@ export declare const args: string[];
4
4
  export declare const init: () => void;
5
5
  export declare const set: (env: Env, value: string | boolean | number) => void;
6
6
  export declare const get: (env: Env) => string | boolean;
7
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/process.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAQ,MAAM,mBAAmB,CAAA;AAI7C,cAAc,mBAAmB,CAAA;AAIjC,eAAO,MAAM,IAAI,UAAwB,CAAA;AAEzC,eAAO,MAAM,IAAI,YAIhB,CAAA;AAYD,eAAO,MAAM,GAAG,QAAS,GAAG,SAAS,MAAM,GAAG,OAAO,GAAG,MAAM,SAE7D,CAAA;AAED,eAAO,MAAM,GAAG,QAAS,GAAG,qBAS3B,CAAA"}
@@ -1,8 +1,10 @@
1
1
  import { join } from 'path';
2
2
  import { ENVS } from '../types/process.js';
3
3
  import { readJsonFileSync } from './fs.js';
4
+ import { getDirnameFromFileURL } from './path.js';
4
5
  export * from '../types/process.js';
5
- const __dirname = import.meta.dirname;
6
+ // const __dirname = import.meta.dirname
7
+ const __dirname = getDirnameFromFileURL(import.meta.url);
6
8
  export const args = process.argv.slice(2);
7
9
  export const init = () => {
8
10
  const pkg = readJsonFileSync(join(__dirname, '../../..', 'package.json'));
@@ -15,6 +17,8 @@ const bool = (val) => {
15
17
  }
16
18
  return false;
17
19
  };
20
+ // export const IS_DEBUG = bool(process.env.DEBUG) || args.includes('--debug')
21
+ // export const IS_LOCAL = bool(process.env.IS_LOCAL)
18
22
  export const set = (env, value) => {
19
23
  process.env[env] = `${value}`;
20
24
  };
@@ -1 +1,2 @@
1
1
  export declare const isBoolean: (val: any, isAllowString?: boolean) => boolean;
2
+ //# sourceMappingURL=type-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-check.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/type-check.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,QAAS,GAAG,qCAQjC,CAAA"}
@@ -3,3 +3,4 @@ import { CommandOptions, MdSettings } from '../../../_internal/types/configs/gen
3
3
  type Arg = ActionArg<CommandOptions, MdSettings>;
4
4
  export declare const action: (args: Arg) => Promise<void>;
5
5
  export {};
6
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/lib/cli/commands/generate/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAS,MAAM,4BAA4B,CAAA;AAK9E,KAAK,GAAG,GAAG,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;AAEhD,eAAO,MAAM,MAAM,SAAgB,GAAG,kBAQrC,CAAA"}
@@ -1,2 +1,3 @@
1
1
  import { MdSettings } from '../../../../_internal/types/configs/generate.js';
2
2
  export declare const exec: (settings: MdSettings) => Promise<void>;
3
+ //# sourceMappingURL=link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/cli/commands/generate/actions/link.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAkB,MAAM,4BAA4B,CAAA;AA4HvE,eAAO,MAAM,IAAI,aAAc,UAAU,kBAOxC,CAAA"}
@@ -1,6 +1,5 @@
1
1
  import { readFileSync, existsSync, writeFileSync } from 'fs';
2
2
  import { parse, join } from 'path';
3
- import inquirer from 'inquirer';
4
3
  import { TablePlugin } from 'inquirer-plugins/table';
5
4
  import { v4 as uuid } from 'uuid';
6
5
  import { GENERATE_TYPES } from '../../../../_internal/types/configs/generate.js';
@@ -10,21 +9,17 @@ import { getLinkedMdDetail, removeParam, getParamsComment } from '../../../../_i
10
9
  import { getExclude, getInclude } from '../../../../_internal/utils/minimatch.js';
11
10
  import { isDirectory as isDirectoryPath, getExecDir } from '../../../../_internal/utils/path.js';
12
11
  const PARAMS = ['id', 'title', 'output', 'lock'];
13
- const getAnswers = (details) => {
14
- inquirer.registerPrompt('table', TablePlugin);
15
- const question = {
16
- type: 'table',
17
- name: 'links',
18
- message: 'GENERATE LINKS PATH SETTINGS',
12
+ const getAnswers = async (details) => {
13
+ const { status, data } = await TablePlugin({
14
+ title: 'GENERATE LINKS PATH SETTINGS',
19
15
  description: `Edit setting.`,
20
- disableColumnIndexes: [0],
21
16
  colors: {
22
17
  selected: warn,
23
18
  editable: success,
24
19
  editing: hop,
25
20
  },
26
21
  columns: [
27
- { name: cyan.bold('filepath'), value: 'path', type: 'input' },
22
+ { name: cyan.bold('filepath'), value: 'path', type: 'input', disabled: true },
28
23
  { name: cyan.bold('id'), value: 'id', type: 'input' },
29
24
  { name: cyan.bold('title'), value: 'title', type: 'input' },
30
25
  { name: cyan.bold('output'), value: 'output', type: 'input' },
@@ -33,8 +28,11 @@ const getAnswers = (details) => {
33
28
  rows: details.map(({ path, id, title, output, lock }) => {
34
29
  return [bold(path), id, title, output, lock];
35
30
  }),
36
- };
37
- return inquirer.prompt([question]);
31
+ });
32
+ if (status !== 'confirmed') {
33
+ throw new Error(`table question is canceled: ${status}`);
34
+ }
35
+ return data;
38
36
  };
39
37
  const getQuestionParam = (settings, path, md, prefixExp) => {
40
38
  const detail = getLinkedMdDetail(md);
@@ -70,8 +68,8 @@ const generateLink = async (settings, fullPath) => {
70
68
  const execDir = getExecDir();
71
69
  const prefixExp = new RegExp(`${execDir}/(.+)$`);
72
70
  const question = getQuestionParam(settings, fullPath, md, prefixExp);
73
- const { links } = await getAnswers([question]);
74
- for (const result of links.result) {
71
+ const { table } = await getAnswers([question]);
72
+ for (const result of table) {
75
73
  writeMd(md, result);
76
74
  }
77
75
  };
@@ -104,9 +102,9 @@ const generateLinks = async (settings, fullPath) => {
104
102
  const md = readFileSync(path, 'utf-8');
105
103
  questions.push(getQuestionParam(settings, path, md, prefixExp));
106
104
  }
107
- const { links } = await getAnswers(questions);
108
- console.log(links);
109
- for (const result of links.result) {
105
+ const { table } = await getAnswers(questions);
106
+ console.log(table);
107
+ for (const result of table) {
110
108
  writeMd(readFileSync(result.path, 'utf-8'), result);
111
109
  }
112
110
  };
@@ -1,2 +1,3 @@
1
1
  import { MdSettings } from '../../../../_internal/types/configs/generate.js';
2
2
  export declare const exec: (settings: MdSettings) => void;
3
+ //# sourceMappingURL=rc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rc.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/cli/commands/generate/actions/rc.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAgBvD,eAAO,MAAM,IAAI,aAAc,UAAU,SAwBxC,CAAA"}
@@ -5,3 +5,4 @@ export declare const COMMANDS: string[];
5
5
  export declare const beforeAction: (args: ActionArg<CommandOptions, MdSettings>) => Promise<void>;
6
6
  export declare const init: (commandClass: CommandClass<CommandOptions, MdSettings>) => void;
7
7
  export declare const getSettings: (_options: CommandOptions) => {};
8
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/lib/cli/commands/generate/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,UAAU,EAA0C,MAAM,4BAA4B,CAAA;AAC/G,OAAO,EAAE,YAAY,EAAW,MAAM,mBAAmB,CAAA;AAMzD,eAAO,MAAM,QAAQ,UAA+B,CAAA;AAgCpD,eAAO,MAAM,YAAY,SAAgB,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,kBAY7E,CAAA;AAED,eAAO,MAAM,IAAI,iBAAkB,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,SAiC1E,CAAA;AAED,eAAO,MAAM,WAAW,aAAc,cAAc,OAEnD,CAAA"}
@@ -1,9 +1,9 @@
1
- import inquirer from 'inquirer';
2
1
  import { TYPES, GENERATE_TYPES, QUESTIONS } from '../../../_internal/types/configs/generate.js';
2
+ import { OPTIONS } from '../../../_internal/utils/command.js';
3
3
  import { DEFAULT_MD_FILENAME } from '../../../_internal/utils/configs.js';
4
4
  import { getCommands } from '../../../_internal/utils/path.js';
5
5
  import { action } from './action.js';
6
- export const COMMANDS = getCommands(import.meta.dirname);
6
+ export const COMMANDS = getCommands(import.meta.url);
7
7
  const DEFAULT_SETTINGS = {
8
8
  include: [],
9
9
  exclude: [],
@@ -33,17 +33,8 @@ const mergeSetting = (options) => {
33
33
  };
34
34
  };
35
35
  export const beforeAction = async (args) => {
36
- let answers = {};
37
36
  const { options: opts } = args;
38
- const questions = [];
39
- for (const question of QUESTIONS(opts)[opts.type]) {
40
- const name = question.name || '';
41
- if (name in opts) {
42
- continue;
43
- }
44
- questions.push(question);
45
- }
46
- answers = await inquirer.prompt(questions);
37
+ const answers = await QUESTIONS(opts)[opts.type]();
47
38
  console.log(answers);
48
39
  const options = {
49
40
  ...opts,
@@ -57,30 +48,30 @@ export const beforeAction = async (args) => {
57
48
  export const init = (commandClass) => {
58
49
  commandClass
59
50
  .description('This command is generate template.')
60
- .option('-t --type <string>', `template type default: ${TYPES.rc} (${Object.values(TYPES).join(', ')})`, (value) => {
51
+ .option(`${OPTIONS.type} <string>`, `template type default: ${TYPES.rc} (${Object.values(TYPES).join(', ')})`, (value) => {
61
52
  const values = Object.values(TYPES);
62
53
  if (!values.includes(value)) {
63
54
  throw new Error(`Invalid type. Allowed values are: ${values.join(', ')}`);
64
55
  }
65
56
  return value;
66
57
  }, TYPES.rc)
67
- .option('-sh --skip-hidden', 'skip read hidden dir (default: true)')
68
- .option('-incl, --include <strings>', 'include dirs (default: [] (all files))')
69
- .option('-excl, --exclude <strings>', 'ignore dirs (default: node_modules only)')
70
- .option('-f, --filenames <strings>', 'filenames (default: README.md only)')
71
- .option('-o, --output <filename>', 'output filename (default: README.md (replace))')
72
- .option('-i, --input <filename>', 'target root filename (default: README.md)')
73
- .option('-ig, --id-gen <string>', `Choose generate type (default: ${GENERATE_TYPES.path})`, (value) => {
58
+ .option(`${OPTIONS['skip-hidden']} <boolean>`, 'skip read hidden dir (default: true)')
59
+ .option(`${OPTIONS.include} <strings>`, 'include dirs (default: [] (all files))')
60
+ .option(`${OPTIONS.exclude} <strings>`, 'ignore dirs (default: node_modules only)')
61
+ .option(`${OPTIONS.filenames} <strings>`, 'filenames (default: README.md only)')
62
+ .option(`${OPTIONS.output} <filename>`, 'output filename (default: README.md (replace))')
63
+ .option(`${OPTIONS.input} <filename>`, 'target root filename (default: README.md)')
64
+ .option(`${OPTIONS['id-gen']} <string>`, `Choose generate type (default: ${GENERATE_TYPES.path})`, (value) => {
74
65
  const values = Object.values(GENERATE_TYPES);
75
66
  if (!values.includes(value)) {
76
67
  throw new Error(`Invalid type. Allowed values are: ${values.join(', ')}`);
77
68
  }
78
69
  return value;
79
70
  })
80
- .option('-I, --id <string>', 'type id')
81
- .option('-T, --title <string>', 'title name')
82
- .option('-l --lock', 'is locked? if true not link this file. (default: false)')
83
- .option('-D, --depth <filename>', 'depth level more than 0')
71
+ .option(`${OPTIONS.id} <string>`, 'type id')
72
+ .option(`${OPTIONS.title} <string>`, 'title name')
73
+ .option(`${OPTIONS.lock} <boolean>`, 'is locked? if true not link this file. (default: false)')
74
+ .option(`${OPTIONS.depth} <filename>`, 'depth level more than 0')
84
75
  .action(beforeAction);
85
76
  };
86
77
  export const getSettings = (_options) => {
@@ -1,3 +1,4 @@
1
1
  import { ActionArg } from '../../../_internal/types/command.js';
2
2
  import { CommandOptions, MdSettings } from '../../../_internal/types/configs/help.js';
3
3
  export declare const action: (_: ActionArg<CommandOptions, MdSettings>) => Promise<void>;
4
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/lib/cli/commands/help/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AA0BnE,eAAO,MAAM,MAAM,MAAa,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,kBAIpE,CAAA"}
@@ -22,5 +22,6 @@ const show = () => {
22
22
  };
23
23
  export const action = async (_) => {
24
24
  show();
25
+ // TODO
25
26
  return;
26
27
  };
@@ -3,3 +3,4 @@ import { CommandClass } from '../../../_internal/utils/command.js';
3
3
  export declare const COMMANDS: string[];
4
4
  export declare const init: (commandClass: CommandClass<CommandOptions, MdSettings>) => void;
5
5
  export declare const getSettings: (options: CommandOptions) => CommandOptions;
6
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/lib/cli/commands/help/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKhD,eAAO,MAAM,QAAQ,UAA+B,CAAA;AAEpD,eAAO,MAAM,IAAI,iBAAkB,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,SAI1E,CAAA;AAED,eAAO,MAAM,WAAW,YAAa,cAAc,mBAElD,CAAA"}