md-hopper 1.0.2 → 1.0.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
@@ -1,3 +1,6 @@
1
+ <!-- MD_HOPPER: ID: md-hopper -->
2
+ <!-- MD_HOPPER: TITLE: MD HOPPER -->
3
+ <!-- MD_HOPPER: OUTPUT: README.md -->
1
4
  <!-- MD_HOPPER: CONFIG: -->
2
5
 
3
6
  # MD HOPPER
@@ -19,17 +22,25 @@ $ npm i md-hopper
19
22
 
20
23
  ## Commands
21
24
 
22
- <!-- MD_HOPPER: LINK_NEXT_LINE:
23
- id: link-command
24
- inline: true
25
+ <!-- MD_HOPPER: BEGIN_LINKS:
26
+ all: true
27
+ linked: true
28
+ child: true
29
+ grandChild: false
30
+ parallel: false
25
31
  -->
26
32
 
27
- ### [LINK][md_hopper:link-command]
33
+ [LINK COMMAND][md_hopper:md-hopper-link]
28
34
 
29
- <!-- MD_HOPPER: BEFORE_GENERATE_LINK (6/4/2024, 10:23:14 AM): - [generate][md_hopper:generate-command] -->
35
+ <!-- MD_HOPPER: END_LINKS: --><!-- MD_HOPPER: BEGIN_DEFINE_LINKS: -->
30
36
 
31
- <!-- MD_HOPPER: BEGIN_DEFINE_LINKS: -->
32
-
33
- [md_hopper:link-command]: ./src/lib/cli/commands/link/README.md 'LINK COMMAND'
37
+ [md_hopper:main]: ../../README.md 'MyPackages'
38
+ [md_hopper:inquirer-plugins]: ../inquirer-plugins/README.md 'inquirer-plugins'
39
+ [md_hopper:inquirer-plugins-table]: ../inquirer-plugins/src/lib/_internal/plugins/table/README.md 'TABLE PLUGIN'
40
+ [md_hopper:md-hopper-link]: ./src/lib/cli/commands/link/README.md 'LINK COMMAND'
41
+ [md_hopper:my-gadgetry]: ../my-gadgetry/README.md 'my gadgetry'
42
+ [md_hopper:my-gadgetry-dev-ops]: ../my-gadgetry/src/lib/_internal/dev-ops/README.md 'Dev Ops'
43
+ [md_hopper:test]: ../test/README.md 'test'
44
+ [md_hopper:plugins-builder]: ../../plugins/builder/README.md 'builder'
34
45
 
35
46
  <!-- MD_HOPPER: END_DEFINE_LINKS: -->
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/types/command.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;AAE5C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IAEV,IAAI,EAAE,GAAG,EAAE,CAAA;CACZ;AAED,MAAM,WAAW,SAAS,CAAC,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3G,OAAO,EAAE,cAAc,CAAA;IACvB,QAAQ,EAAE,UAAU,CAAA;CACrB"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/types/command.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;AAE5C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IAEV,IAAI,EAAE,GAAG,EAAE,CAAA;CACZ;AAED,MAAM,WAAW,SAAS,CAAC,cAAc,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3G,OAAO,EAAE,cAAc,CAAA;IACvB,QAAQ,EAAE,UAAU,CAAA;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_internal/types/configs/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAA6D,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAMvG,eAAO,MAAM,KAAK;;;CAG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AA;AA2E/E,eAAO,MAAM,SAAS,YAAa,cAAc,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAGvF,CAAA"}
@@ -11,41 +11,41 @@ const INPUT_QUESTION_PARAMS = {
11
11
  };
12
12
  const INPUT_QUESTION = {
13
13
  name: 'input',
14
- question: () => input(INPUT_QUESTION_PARAMS)
14
+ question: () => input(INPUT_QUESTION_PARAMS),
15
15
  };
16
16
  const SKIP_HIDDEN_QUESTION = {
17
17
  name: 'skipHidden',
18
18
  question: () => confirm({
19
19
  message: 'skip search hidden file? default Yes.',
20
20
  default: true,
21
- })
21
+ }),
22
22
  };
23
23
  const INCLUDE_QUESTION = {
24
24
  name: 'include',
25
25
  question: () => input({
26
26
  message: 'include pattern minimatch list with comma. ex: xxx,xxx',
27
27
  default: '',
28
- })
28
+ }),
29
29
  };
30
30
  const EXCLUDE_QUESTION = {
31
31
  name: 'exclude',
32
32
  question: () => input({
33
33
  message: 'exclude pattern minimatch list with comma. ex: xxx,xxx',
34
34
  default: '',
35
- })
35
+ }),
36
36
  };
37
37
  const FILENAMES_QUESTION = {
38
38
  name: 'filenames',
39
39
  question: () => input({
40
40
  message: 'search filenames with comma. (default: README.md) ex: README.md,CHANGELOG.md',
41
41
  default: DEFAULT_MD_FILENAME,
42
- })
42
+ }),
43
43
  };
44
44
  const OUTPUT_QUESTION = {
45
45
  name: 'output',
46
46
  question: () => input({
47
47
  message: 'output filename. (default: same name as read, means update file) ex: README_GENERATE.md',
48
- })
48
+ }),
49
49
  };
50
50
  const DEPTH_QUESTION = {
51
51
  name: 'depth',
@@ -67,17 +67,10 @@ const RC_QUESTIONS = (_options) => async () => {
67
67
  ...INPUT_QUESTION_PARAMS,
68
68
  validate: input => {
69
69
  return !!input;
70
- }
71
- })
70
+ },
71
+ }),
72
72
  };
73
- await setQuestions([
74
- SKIP_HIDDEN_QUESTION,
75
- INCLUDE_QUESTION,
76
- EXCLUDE_QUESTION,
77
- FILENAMES_QUESTION,
78
- OUTPUT_QUESTION,
79
- DEPTH_QUESTION,
80
- ], answers);
73
+ await setQuestions([SKIP_HIDDEN_QUESTION, INCLUDE_QUESTION, EXCLUDE_QUESTION, FILENAMES_QUESTION, OUTPUT_QUESTION, DEPTH_QUESTION], answers);
81
74
  return answers;
82
75
  };
83
76
  export const GENERATE_TYPES = Object.freeze({
@@ -103,12 +96,12 @@ const setFileQuestions = async (inputPath, options, answers) => {
103
96
  const FILE_QUESTIONS = [
104
97
  {
105
98
  name: 'title',
106
- question: () => input({ message: 'title name. (default: auto detect title)', })
99
+ question: () => input({ message: 'title name. (default: auto detect title)' }),
107
100
  },
108
101
  {
109
102
  name: 'lock',
110
- question: () => confirm({ message: 'is locked? if true not link this file. (default: false)', default: false })
111
- }
103
+ question: () => confirm({ message: 'is locked? if true not link this file. (default: false)', default: false }),
104
+ },
112
105
  ];
113
106
  const isInputPathDirectory = (path, options) => isDirectory(path || options.input || '');
114
107
  const getIdGenQuestions = (path, options) => {
@@ -128,12 +121,12 @@ const LINK_QUESTIONS = (options) => async () => {
128
121
  default: '.',
129
122
  });
130
123
  const answers = {
131
- [INPUT_QUESTION.name]: inputPath
124
+ [INPUT_QUESTION.name]: inputPath,
132
125
  };
133
126
  answers['idGen'] = await select({
134
127
  message: `Choose generate type (default: ${GENERATE_TYPE_CHOICES[0].short})`,
135
128
  default: 0,
136
- choices: getIdGenQuestions(inputPath, options)
129
+ choices: getIdGenQuestions(inputPath, options),
137
130
  });
138
131
  if (answers.idGen === GENERATE_TYPES.manual) {
139
132
  answers['id'] = await input({
@@ -1 +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,G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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"}
@@ -31,13 +31,44 @@ export const OPTION_SHORTS = Object.freeze({
31
31
  A: '',
32
32
  B: '',
33
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: '',
34
+ D: 'depth',
35
+ E: 'exclude',
36
+ F: '',
37
+ G: 'id-gen',
38
+ H: '',
39
+ I: 'include',
40
+ J: '',
41
+ K: '',
42
+ L: 'lock',
43
+ M: '',
44
+ N: '',
45
+ O: '',
46
+ P: '',
47
+ Q: '',
48
+ R: '',
49
+ S: '',
50
+ T: 'title',
51
+ U: '',
52
+ V: '',
53
+ W: '',
54
+ X: '',
55
+ Y: '',
56
+ Z: '',
37
57
  });
38
58
  const INVERTED_OPTION_SHORTS = invert(OPTION_SHORTS);
39
59
  const OPTION_KEYS = Object.freeze([
40
- 'filenames', 'input', 'output', 'skip-hidden', 'type', 'depth', 'exclude', 'id-gen', 'include', 'lock', 'title', 'id'
60
+ 'filenames',
61
+ 'input',
62
+ 'output',
63
+ 'skip-hidden',
64
+ 'type',
65
+ 'depth',
66
+ 'exclude',
67
+ 'id-gen',
68
+ 'include',
69
+ 'lock',
70
+ 'title',
71
+ 'id',
41
72
  ]);
42
73
  export const OPTIONS = OPTION_KEYS.reduce((acc, key) => {
43
74
  const short = INVERTED_OPTION_SHORTS[key];
@@ -1,6 +1,5 @@
1
1
  import { getAllFiles } from 'my-gadgetry/fs';
2
2
  export { getAllFiles } from 'my-gadgetry/fs';
3
- export declare const readJsonFileSync: (path: string, encode?: BufferEncoding) => {};
4
3
  export declare const isDirectory: (path: string) => boolean;
5
4
  export declare const getAllMdFiles: (filenames: string[], startDir: string, _options?: import("my-gadgetry/fs").Options | undefined) => string[];
6
5
  //# sourceMappingURL=fs.d.ts.map
@@ -1 +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"}
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;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,eAAO,MAAM,WAAW,SAAU,MAAM,YAKvC,CAAA;AAED,eAAO,MAAM,aAAa,cAAe,MAAM,EAAE,wFAC+C,CAAA"}
@@ -1,14 +1,6 @@
1
- import { readFileSync, statSync, existsSync } from 'fs';
1
+ import { statSync, existsSync } from 'fs';
2
2
  import { getAllFiles } from 'my-gadgetry/fs';
3
- import { isJson } from 'my-gadgetry/type-check';
4
3
  export { getAllFiles } from 'my-gadgetry/fs';
5
- export const readJsonFileSync = (path, encode = 'utf-8') => {
6
- const json = isJson(readFileSync(path, encode));
7
- if (!json) {
8
- return {};
9
- }
10
- return json;
11
- };
12
4
  export const isDirectory = (path) => {
13
5
  if (!existsSync(path)) {
14
6
  throw new Error('not exists');
@@ -1 +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"}
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,UA4BnC,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
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
40
41
  // @ts-ignore: TS7053: Element implicitly has an any type because expression of type any can't be used to index type Setting
41
42
  settings[key] = val;
42
43
  }
@@ -1 +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,YAA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OAAQ,MAAM,KAAG,YAW9C,CAAA"}
@@ -1 +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
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/process.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAQ,MAAM,mBAAmB,CAAA;AAG7C,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,13 +1,14 @@
1
1
  import { join } from 'path';
2
+ import { getDirnameFromFileURL } from 'my-gadgetry/path';
3
+ import { readJsonFileSync } from 'my-gadgetry/fs';
2
4
  import { ENVS } from '../types/process.js';
3
- import { readJsonFileSync } from './fs.js';
4
- import { getDirnameFromFileURL } from './path.js';
5
+ // import { getDirnameFromFileURL } from './path.js'
5
6
  export * from '../types/process.js';
6
7
  // const __dirname = import.meta.dirname
7
8
  const __dirname = getDirnameFromFileURL(import.meta.url);
8
9
  export const args = process.argv.slice(2);
9
10
  export const init = () => {
10
- const pkg = readJsonFileSync(join(__dirname, '../../..', 'package.json'));
11
+ const pkg = readJsonFileSync(join(__dirname, '../../../..', 'package.json'));
11
12
  set(ENVS.PACKAGE_VERSION, pkg.version);
12
13
  set(ENVS.IS_DEBUG, bool(process.env.DEBUG) || args.includes('--debug'));
13
14
  };
@@ -1 +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
+ {"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,SAqC1E,CAAA;AAED,eAAO,MAAM,WAAW,aAAc,cAAc,OAEnD,CAAA"}
File without changes
package/dist/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "md-hopper",
3
- "version": "0.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
+ "license": "MIT",
5
6
  "bin": {
6
7
  "md-hopper": "./dist/lib/cli/index.js",
7
8
  "mdhopper": "./dist/lib/cli/index.js",
@@ -43,7 +44,8 @@
43
44
  "commander": "^13.1.0",
44
45
  "marked": "^15.0.11",
45
46
  "minimatch": "^10.0.1",
46
- "my-gadgetry": "1.3.7",
47
+ "my-gadgetry": "1.3.8",
48
+ "inquirer-plugins": "1.0.5",
47
49
  "tslib": "^2.3.0",
48
50
  "uuid": "^11.1.0"
49
51
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "md-hopper",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
+ "license": "MIT",
5
6
  "bin": {
6
7
  "md-hopper": "./dist/lib/cli/index.js",
7
8
  "mdhopper": "./dist/lib/cli/index.js",
@@ -43,8 +44,8 @@
43
44
  "commander": "^13.1.0",
44
45
  "marked": "^15.0.11",
45
46
  "minimatch": "^10.0.1",
46
- "my-gadgetry": "1.3.7",
47
- "inquirer-plugins": "1.0.4",
47
+ "my-gadgetry": "1.3.9",
48
+ "inquirer-plugins": "1.0.6",
48
49
  "tslib": "^2.3.0",
49
50
  "uuid": "^11.1.0"
50
51
  }
@@ -1,42 +0,0 @@
1
- import { Answers } from '../inquirer.js';
2
- export declare const TYPES: {
3
- readonly rc: "rc";
4
- readonly link: "link";
5
- };
6
- export type Type = (typeof TYPES)[keyof typeof TYPES];
7
- export interface CommandOptions {
8
- debug?: boolean;
9
- type?: Type;
10
- include?: string;
11
- exclude?: string;
12
- filenames?: string;
13
- input?: string;
14
- output?: string;
15
- idGen?: GenerateType;
16
- depth?: number;
17
- id?: string;
18
- lock?: boolean;
19
- skipHidden?: boolean;
20
- title?: string;
21
- }
22
- export interface MdSettings {
23
- include: string[];
24
- exclude: string[];
25
- filenames: string[];
26
- skipHidden: boolean;
27
- input: string;
28
- output: string;
29
- idGen: GenerateType;
30
- id: string;
31
- title: string;
32
- lock: boolean;
33
- depth: number;
34
- }
35
- export declare const GENERATE_TYPES: Readonly<{
36
- readonly path: "path";
37
- readonly random: "random";
38
- readonly manual: "manual";
39
- }>;
40
- export type GenerateType = (typeof GENERATE_TYPES)[keyof typeof GENERATE_TYPES];
41
- export declare const QUESTIONS: (options: CommandOptions) => Record<string, Promise<Answers>>;
42
- //# sourceMappingURL=__generate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"__generate.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_internal/types/configs/__generate.ts"],"names":[],"mappings":"AACA,OAAO,EAA6D,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAQvG,eAAO,MAAM,KAAK;;;CAGR,CAAA;AAEV,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAA;AAErD,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,YAAY,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAyFD,eAAO,MAAM,cAAc;;;;EAIhB,CAAA;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAA;AA4E/E,eAAO,MAAM,SAAS,YAAa,cAAc,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAGjF,CAAA"}
@@ -1,155 +0,0 @@
1
- import { input, confirm, number, select } from '@inquirer/prompts';
2
- import { isNumber } from 'my-gadgetry/type-check';
3
- /* eslint-disable import/no-restricted-paths */
4
- import { DEFAULT_MD_FILENAME } from '../../utils/configs.js';
5
- import { isDirectory } from '../../utils/path.js';
6
- /* eslint-enable import/no-restricted-paths */
7
- export const TYPES = {
8
- rc: 'rc',
9
- link: 'link',
10
- };
11
- const INPUT_QUESTION_PARAMS = {
12
- message: 'Please put path from current dir with filename? ex: "./{path}/{filename}.md"',
13
- };
14
- const INPUT_QUESTION = {
15
- name: 'input',
16
- question: input(INPUT_QUESTION_PARAMS)
17
- };
18
- const SKIP_HIDDEN_QUESTION = {
19
- name: 'skipHidden',
20
- question: confirm({
21
- message: 'skip search hidden file? default Yes.',
22
- default: true,
23
- })
24
- };
25
- const INCLUDE_QUESTION = {
26
- name: 'include',
27
- question: input({
28
- message: 'include pattern minimatch list with comma. ex: xxx,xxx',
29
- default: '',
30
- })
31
- };
32
- const EXCLUDE_QUESTION = {
33
- name: 'exclude',
34
- question: input({
35
- message: 'exclude pattern minimatch list with comma. ex: xxx,xxx',
36
- default: '',
37
- })
38
- };
39
- const FILENAMES_QUESTION = {
40
- name: 'filenames',
41
- question: input({
42
- message: 'search filenames with comma. (default: README.md) ex: README.md,CHANGELOG.md',
43
- default: DEFAULT_MD_FILENAME,
44
- })
45
- };
46
- const OUTPUT_QUESTION = {
47
- name: 'output',
48
- question: input({
49
- message: 'output filename. (default: same name as read, means update file) ex: README_GENERATE.md',
50
- })
51
- };
52
- const DEPTH_QUESTION = {
53
- name: 'depth',
54
- question: number({
55
- message: 'search depth number. more than 0. (if all put 0)',
56
- validate: input => {
57
- return isNumber(input, true) && input >= 0;
58
- },
59
- default: 0,
60
- }),
61
- filter: input => {
62
- return input >= 0 ? Number(input) : '';
63
- },
64
- };
65
- const DIR_QUESTIONS = [SKIP_HIDDEN_QUESTION, INCLUDE_QUESTION, EXCLUDE_QUESTION, FILENAMES_QUESTION, DEPTH_QUESTION];
66
- const RC_QUESTIONS = async (_options) => {
67
- const answers = {
68
- [INPUT_QUESTION.name]: await input({
69
- ...INPUT_QUESTION_PARAMS,
70
- validate: input => {
71
- return !!input;
72
- }
73
- })
74
- };
75
- await setQuestions([
76
- SKIP_HIDDEN_QUESTION,
77
- INCLUDE_QUESTION,
78
- EXCLUDE_QUESTION,
79
- FILENAMES_QUESTION,
80
- OUTPUT_QUESTION,
81
- DEPTH_QUESTION,
82
- ], answers);
83
- return answers;
84
- };
85
- export const GENERATE_TYPES = Object.freeze({
86
- path: 'path',
87
- random: 'random',
88
- manual: 'manual',
89
- });
90
- const GENERATE_TYPE_CHOICES = Object.freeze([
91
- { name: 'auto generate with directory path', short: 'dir path', value: GENERATE_TYPES.path },
92
- { name: 'auto generate with uuid', short: 'random', value: GENERATE_TYPES.random },
93
- { name: 'generate yourself', short: 'manually', value: GENERATE_TYPES.manual },
94
- ]);
95
- const setDirQuestions = async (inputPath, options, answers) => {
96
- if (isInputPathDirectory(inputPath, options)) {
97
- await setQuestions(DIR_QUESTIONS, answers);
98
- }
99
- };
100
- const setFileQuestions = async (inputPath, options, answers) => {
101
- if (!isInputPathDirectory(inputPath, options)) {
102
- await setQuestions(FILE_QUESTIONS, answers);
103
- }
104
- };
105
- const FILE_QUESTIONS = [
106
- {
107
- name: 'title',
108
- question: input({ message: 'title name. (default: auto detect title)', })
109
- },
110
- {
111
- name: 'lock',
112
- question: confirm({ message: 'is locked? if true not link this file. (default: false)', default: false })
113
- }
114
- ];
115
- const isInputPathDirectory = (path, options) => isDirectory(path || options.input || '');
116
- const getIdGenQuestions = (path, options) => {
117
- if (isInputPathDirectory(path, options)) {
118
- return GENERATE_TYPE_CHOICES.filter(({ value }) => [GENERATE_TYPES.path, GENERATE_TYPES.random].includes(value));
119
- }
120
- return GENERATE_TYPE_CHOICES;
121
- };
122
- const setQuestions = async (questions, answers) => {
123
- for (const question of questions) {
124
- answers[question.name] = await question.question;
125
- }
126
- };
127
- const LINK_QUESTIONS = async (options) => {
128
- const inputPath = await input({
129
- message: 'Please put path from current dir with filename? (default: ".") ex: "./{path}/{filename}.md"',
130
- default: '.',
131
- });
132
- const answers = {
133
- [INPUT_QUESTION.name]: inputPath
134
- };
135
- answers['idGen'] = await select({
136
- message: `Choose generate type (default: ${GENERATE_TYPE_CHOICES[0].short})`,
137
- default: 0,
138
- choices: getIdGenQuestions(inputPath, options)
139
- });
140
- if (answers.idGen === GENERATE_TYPES.manual) {
141
- answers['id'] = await input({
142
- message: 'type id',
143
- validate: input => {
144
- return !!input;
145
- },
146
- });
147
- }
148
- await setDirQuestions(inputPath, options, answers);
149
- await setFileQuestions(inputPath, options, answers);
150
- return answers;
151
- };
152
- export const QUESTIONS = (options) => ({
153
- [TYPES.rc]: RC_QUESTIONS(options),
154
- [TYPES.link]: LINK_QUESTIONS(options),
155
- });
@@ -1,40 +0,0 @@
1
- export declare const TYPES: {
2
- readonly rc: "rc";
3
- readonly link: "link";
4
- };
5
- export type Type = (typeof TYPES)[keyof typeof TYPES];
6
- export interface CommandOptions {
7
- debug?: boolean;
8
- type?: Type;
9
- include?: string;
10
- exclude?: string;
11
- filenames?: string;
12
- input?: string;
13
- output?: string;
14
- idGen?: GenerateType;
15
- depth?: number;
16
- id?: string;
17
- lock?: boolean;
18
- skipHidden?: boolean;
19
- title?: string;
20
- }
21
- export interface MdSettings {
22
- include: string[];
23
- exclude: string[];
24
- filenames: string[];
25
- skipHidden: boolean;
26
- input: string;
27
- output: string;
28
- idGen: GenerateType;
29
- id: string;
30
- title: string;
31
- lock: boolean;
32
- depth: number;
33
- }
34
- export declare const GENERATE_TYPES: Readonly<{
35
- readonly path: "path";
36
- readonly random: "random";
37
- readonly manual: "manual";
38
- }>;
39
- export type GenerateType = (typeof GENERATE_TYPES)[keyof typeof GENERATE_TYPES];
40
- //# sourceMappingURL=_generate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_generate.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_internal/types/configs/_generate.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,KAAK;;;CAGR,CAAA;AAEV,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAA;AAErD,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,YAAY,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAyFD,eAAO,MAAM,cAAc;;;;EAIhB,CAAA;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAA"}
@@ -1,176 +0,0 @@
1
- // import { input, confirm , number, select } from '@inquirer/prompts'
2
- // import { InputQuestion, ConfirmQuestion, NumberQuestion, Questions, Answers } from '../inquirer.js'
3
- // import { isNumber } from 'my-gadgetry/type-check'
4
- /* eslint-disable import/no-restricted-paths */
5
- // import { DEFAULT_MD_FILENAME } from '../../utils/configs.js'
6
- // import { isDirectory } from '../../utils/path.js'
7
- /* eslint-enable import/no-restricted-paths */
8
- export const TYPES = {
9
- rc: 'rc',
10
- link: 'link',
11
- };
12
- // const INPUT_QUESTION_PARAMS = {
13
- // message: 'Please put path from current dir with filename? ex: "./{path}/{filename}.md"',
14
- // }
15
- // const INPUT_QUESTION: InputQuestion = {
16
- // name: 'input',
17
- // question: input(INPUT_QUESTION_PARAMS)
18
- // }
19
- //
20
- // const SKIP_HIDDEN_QUESTION: ConfirmQuestion = {
21
- // name: 'skipHidden',
22
- // question: confirm({
23
- // message: 'skip search hidden file? default Yes.',
24
- // default: true,
25
- // })
26
- // }
27
- //
28
- // const INCLUDE_QUESTION: InputQuestion = {
29
- // name: 'include',
30
- // question: input({
31
- // message: 'include pattern minimatch list with comma. ex: xxx,xxx',
32
- // default: '',
33
- // })
34
- // }
35
- //
36
- // const EXCLUDE_QUESTION: InputQuestion = {
37
- // name: 'exclude',
38
- // question: input({
39
- // message: 'exclude pattern minimatch list with comma. ex: xxx,xxx',
40
- // default: '',
41
- // })
42
- // }
43
- //
44
- // const FILENAMES_QUESTION: InputQuestion = {
45
- // name: 'filenames',
46
- // question: input({
47
- // message: 'search filenames with comma. (default: README.md) ex: README.md,CHANGELOG.md',
48
- // default: DEFAULT_MD_FILENAME,
49
- // })
50
- // }
51
- //
52
- // const OUTPUT_QUESTION: InputQuestion = {
53
- // name: 'output',
54
- // question: input({
55
- // message: 'output filename. (default: same name as read, means update file) ex: README_GENERATE.md',
56
- // })
57
- // }
58
- //
59
- // const DEPTH_QUESTION: NumberQuestion = {
60
- // name: 'depth',
61
- // question: number({
62
- // message: 'search depth number. more than 0. (if all put 0)',
63
- // validate: input => {
64
- // return isNumber(input, true) && (input as number) >= 0
65
- // },
66
- // default: 0,
67
- // }),
68
- // filter: input => {
69
- // return input >= 0 ? Number(input) : ''
70
- // },
71
- // }
72
- // const DIR_QUESTIONS = [SKIP_HIDDEN_QUESTION, INCLUDE_QUESTION, EXCLUDE_QUESTION, FILENAMES_QUESTION, DEPTH_QUESTION]
73
- //
74
- // const RC_QUESTIONS = async (_options: CommandOptions): Promise<Answers> => {
75
- // const answers: Answers = {
76
- // [INPUT_QUESTION.name]: await input({
77
- // ...INPUT_QUESTION_PARAMS,
78
- // validate: input => {
79
- // return !!input
80
- // }
81
- // })
82
- // }
83
- // await setQuestions(
84
- // [
85
- // SKIP_HIDDEN_QUESTION,
86
- // INCLUDE_QUESTION,
87
- // EXCLUDE_QUESTION,
88
- // FILENAMES_QUESTION,
89
- // OUTPUT_QUESTION,
90
- // DEPTH_QUESTION,
91
- // ],
92
- // answers
93
- // )
94
- // return answers
95
- // }
96
- export const GENERATE_TYPES = Object.freeze({
97
- path: 'path',
98
- random: 'random',
99
- manual: 'manual',
100
- });
101
- // const GENERATE_TYPE_CHOICES = Object.freeze([
102
- // { name: 'auto generate with directory path', short: 'dir path', value: GENERATE_TYPES.path },
103
- // { name: 'auto generate with uuid', short: 'random', value: GENERATE_TYPES.random },
104
- // { name: 'generate yourself', short: 'manually', value: GENERATE_TYPES.manual },
105
- // ] as const)
106
- //
107
- // const setDirQuestions = async (inputPath: string, options: CommandOptions, answers: Answers) => {
108
- // if (isInputPathDirectory(inputPath, options)) {
109
- // await setQuestions(DIR_QUESTIONS, answers)
110
- // }
111
- // }
112
- //
113
- // const setFileQuestions = async (inputPath: string, options: CommandOptions, answers: Answers) => {
114
- // if (!isInputPathDirectory(inputPath, options)) {
115
- // await setQuestions(FILE_QUESTIONS, answers)
116
- // }
117
- // }
118
- //
119
- // const FILE_QUESTIONS: Questions = [
120
- // {
121
- // name: 'title',
122
- // question: input({ message: 'title name. (default: auto detect title)', })
123
- // },
124
- // {
125
- // name: 'lock',
126
- // question: confirm({ message: 'is locked? if true not link this file. (default: false)', default: false })
127
- // }
128
- // ]
129
- //
130
- //
131
- // const isInputPathDirectory = (path: string, options: CommandOptions) => isDirectory(path || options.input || '')
132
- //
133
- // const getIdGenQuestions = (path: string, options: CommandOptions) => {
134
- // if (isInputPathDirectory(path, options)) {
135
- // return GENERATE_TYPE_CHOICES.filter(({ value }) =>
136
- // ([GENERATE_TYPES.path, GENERATE_TYPES.random] as string[]).includes(value)
137
- // )
138
- // }
139
- // return GENERATE_TYPE_CHOICES
140
- // }
141
- //
142
- // const setQuestions = async (questions: Questions, answers: Answers) => {
143
- // for (const question of questions) {
144
- // answers[question.name] = await question.question
145
- // }
146
- // }
147
- // const LINK_QUESTIONS = async (options: CommandOptions): Promise<Answers> => {
148
- // const inputPath = await input({
149
- // message: 'Please put path from current dir with filename? (default: ".") ex: "./{path}/{filename}.md"',
150
- // default: '.',
151
- // })
152
- // const answers: Answers = {
153
- // [INPUT_QUESTION.name]: inputPath
154
- // }
155
- //
156
- // answers['idGen'] = await select({
157
- // message: `Choose generate type (default: ${GENERATE_TYPE_CHOICES[0].short})`,
158
- // default: 0,
159
- // choices: getIdGenQuestions(inputPath, options)
160
- // })
161
- // if (answers.idGen === GENERATE_TYPES.manual) {
162
- // answers['id'] = await input({
163
- // message: 'type id',
164
- // validate: input => {
165
- // return !!input
166
- // },
167
- // })
168
- // }
169
- // await setDirQuestions(inputPath, options, answers)
170
- // await setFileQuestions(inputPath, options, answers)
171
- // return answers
172
- // }
173
- // export const QUESTIONS = (options: CommandOptions): Record<string, Promise<Answers>> => ({
174
- // [TYPES.rc]: RC_QUESTIONS(options),
175
- // [TYPES.link]: LINK_QUESTIONS(options),
176
- // })