md-hopper 1.0.0-alpha.9 → 1.0.2
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 +1 -1
- package/dist/{_internal → lib/_internal}/types/command.d.ts +1 -0
- package/dist/lib/_internal/types/command.d.ts.map +1 -0
- package/dist/lib/_internal/types/configs/__generate.d.ts +42 -0
- package/dist/lib/_internal/types/configs/__generate.d.ts.map +1 -0
- package/dist/lib/_internal/types/configs/__generate.js +155 -0
- package/dist/lib/_internal/types/configs/_generate.d.ts +40 -0
- package/dist/lib/_internal/types/configs/_generate.d.ts.map +1 -0
- package/dist/lib/_internal/types/configs/_generate.js +176 -0
- package/dist/{_internal → lib/_internal}/types/configs/generate.d.ts +3 -7
- package/dist/lib/_internal/types/configs/generate.d.ts.map +1 -0
- package/dist/lib/_internal/types/configs/generate.js +153 -0
- package/dist/{_internal → lib/_internal}/types/configs/help.d.ts +1 -0
- package/dist/lib/_internal/types/configs/help.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/types/configs/links.d.ts +1 -0
- package/dist/lib/_internal/types/configs/links.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/types/configs.d.ts +1 -0
- package/dist/lib/_internal/types/configs.d.ts.map +1 -0
- package/dist/lib/_internal/types/inquirer.d.ts +20 -0
- package/dist/lib/_internal/types/inquirer.d.ts.map +1 -0
- package/dist/lib/_internal/types/inquirer.js +1 -0
- package/dist/{_internal → lib/_internal}/types/md.d.ts +1 -0
- package/dist/lib/_internal/types/md.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/types/process.d.ts +1 -0
- package/dist/lib/_internal/types/process.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/chalk.d.ts +1 -0
- package/dist/lib/_internal/utils/chalk.d.ts.map +1 -0
- package/dist/lib/_internal/utils/command.d.ts +76 -0
- package/dist/lib/_internal/utils/command.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/command.js +52 -0
- package/dist/{_internal → lib/_internal}/utils/configs.d.ts +1 -0
- package/dist/lib/_internal/utils/configs.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/fs.d.ts +2 -1
- package/dist/lib/_internal/utils/fs.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/link.d.ts +1 -0
- package/dist/lib/_internal/utils/link.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/link.js +1 -0
- package/dist/{_internal → lib/_internal}/utils/log.d.ts +1 -0
- package/dist/lib/_internal/utils/log.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/md/lexer.d.ts +1 -0
- package/dist/lib/_internal/utils/md/lexer.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/md/line.d.ts +1 -0
- package/dist/lib/_internal/utils/md/line.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/md.d.ts +1 -0
- package/dist/lib/_internal/utils/md.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/minimatch.d.ts +1 -0
- package/dist/lib/_internal/utils/minimatch.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/path-match.d.ts +1 -0
- package/dist/lib/_internal/utils/path-match.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/path.d.ts +13 -1
- package/dist/lib/_internal/utils/path.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/path.js +29 -3
- package/dist/{_internal → lib/_internal}/utils/process.d.ts +1 -0
- package/dist/lib/_internal/utils/process.d.ts.map +1 -0
- package/dist/{_internal → lib/_internal}/utils/process.js +5 -1
- package/dist/{_internal → lib/_internal}/utils/type-check.d.ts +1 -0
- package/dist/lib/_internal/utils/type-check.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/generate/action.d.ts +1 -0
- package/dist/lib/cli/commands/generate/action.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/generate/actions/link.d.ts +1 -0
- package/dist/lib/cli/commands/generate/actions/link.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/generate/actions/link.js +14 -16
- package/dist/{cli → lib/cli}/commands/generate/actions/rc.d.ts +1 -0
- package/dist/lib/cli/commands/generate/actions/rc.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/generate/command.d.ts +1 -0
- package/dist/lib/cli/commands/generate/command.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/generate/command.js +15 -24
- package/dist/{cli → lib/cli}/commands/help/action.d.ts +1 -0
- package/dist/lib/cli/commands/help/action.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/help/action.js +1 -0
- package/dist/{cli → lib/cli}/commands/help/command.d.ts +1 -0
- package/dist/lib/cli/commands/help/command.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/help/command.js +1 -1
- package/dist/{cli → lib/cli}/commands/index.d.ts +1 -0
- package/dist/lib/cli/commands/index.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/index.js +2 -1
- package/dist/{cli → lib/cli}/commands/link/action.d.ts +1 -0
- package/dist/lib/cli/commands/link/action.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/commands/link/command.d.ts +1 -0
- package/dist/lib/cli/commands/link/command.d.ts.map +1 -0
- package/dist/lib/cli/commands/link/command.js +22 -0
- package/dist/lib/cli/index.d.ts +3 -0
- package/dist/lib/cli/index.d.ts.map +1 -0
- package/dist/{cli → lib/cli}/index.js +2 -0
- package/dist/package.json +50 -0
- package/package.json +31 -92
- package/cli/commands/generate/action/package.json +0 -6
- package/cli/commands/generate/actions/link/package.json +0 -6
- package/cli/commands/generate/actions/rc/package.json +0 -6
- package/cli/commands/generate/command/package.json +0 -6
- package/cli/commands/help/action/package.json +0 -6
- package/cli/commands/help/command/package.json +0 -6
- package/cli/commands/index/package.json +0 -6
- package/cli/commands/link/README.md/package.json +0 -6
- package/cli/commands/link/action/package.json +0 -6
- package/cli/commands/link/command/package.json +0 -6
- package/cli/index/package.json +0 -6
- package/dist/_internal/types/configs/generate.js +0 -131
- package/dist/_internal/utils/command.d.ts +0 -20
- package/dist/cli/commands/link/command.js +0 -21
- package/dist/cli/index.d.ts +0 -2
- /package/dist/{_internal → lib/_internal}/types/command.js +0 -0
- /package/dist/{_internal → lib/_internal}/types/configs/help.js +0 -0
- /package/dist/{_internal → lib/_internal}/types/configs/links.js +0 -0
- /package/dist/{_internal → lib/_internal}/types/configs.js +0 -0
- /package/dist/{_internal → lib/_internal}/types/md.js +0 -0
- /package/dist/{_internal → lib/_internal}/types/process.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/chalk.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/configs.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/fs.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/log.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/md/lexer.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/md/line.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/md.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/minimatch.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/path-match.js +0 -0
- /package/dist/{_internal → lib/_internal}/utils/type-check.js +0 -0
- /package/dist/{cli → lib/cli}/commands/generate/action.js +0 -0
- /package/dist/{cli → lib/cli}/commands/generate/actions/rc.js +0 -0
- /package/dist/{cli → lib/cli}/commands/link/action.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCommands } from '../../../_internal/utils/path.js';
|
|
2
2
|
import { action } from './action.js';
|
|
3
|
-
export const COMMANDS = getCommands(import.meta.
|
|
3
|
+
export const COMMANDS = getCommands(import.meta.url);
|
|
4
4
|
export const init = (commandClass) => {
|
|
5
5
|
commandClass.description('This command is used to show help').action(options => {
|
|
6
6
|
return action(options);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/cli/commands/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAY9C,eAAO,MAAM,IAAI,YAAmB,OAAO,kBAQ1C,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { readdirSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
+
import { getDirnameFromFileURL } from '../../_internal/utils/path.js';
|
|
3
4
|
import { setCommands } from '../../_internal/utils/command.js';
|
|
4
5
|
import { isDirectory } from '../../_internal/utils/fs.js';
|
|
5
|
-
const __dirname = import.meta.
|
|
6
|
+
const __dirname = getDirnameFromFileURL(import.meta.url);
|
|
6
7
|
const initCommand = async (filename, program) => {
|
|
7
8
|
const { COMMANDS, init, getSettings } = await import(`./${filename}/command.js`);
|
|
8
9
|
setCommands(program, COMMANDS, init, getSettings);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/lib/cli/commands/link/action.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAUpE,KAAK,GAAG,GAAG,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;AA6DhD,eAAO,MAAM,MAAM,SAAgB,GAAG,kBA+CrC,CAAA"}
|
|
@@ -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) => MdSettings;
|
|
6
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/lib/cli/commands/link/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAW,MAAM,mBAAmB,CAAA;AAMzD,eAAO,MAAM,QAAQ,UAA+B,CAAA;AAEpD,eAAO,MAAM,IAAI,iBAAkB,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,SAa1E,CAAA;AAED,eAAO,MAAM,WAAW,YAAa,cAAc,KAAG,UAErD,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OPTIONS } from '../../../_internal/utils/command.js';
|
|
2
|
+
import { getSettings as _getSettings } from '../../../_internal/utils/link.js';
|
|
3
|
+
import { getCommands } from '../../../_internal/utils/path.js';
|
|
4
|
+
import { action } from './action.js';
|
|
5
|
+
export const COMMANDS = getCommands(import.meta.url);
|
|
6
|
+
export const init = (commandClass) => {
|
|
7
|
+
commandClass
|
|
8
|
+
.description('This command is used to exec target file.')
|
|
9
|
+
.option(`${OPTIONS['skip-hidden']} <boolean>`, 'skip read hidden dir (default: true)')
|
|
10
|
+
.option(`${OPTIONS.include} <strings>`, 'include dirs (default: [] (all files))')
|
|
11
|
+
.option(`${OPTIONS.exclude} <strings>`, 'ignore dirs (default: node_modules only)')
|
|
12
|
+
.option(`${OPTIONS.filenames} <strings>`, 'filenames (default: README.md only)')
|
|
13
|
+
.option(`${OPTIONS.output} <filename>`, 'output filename (default: README.md (replace))')
|
|
14
|
+
.option(`${OPTIONS.input} <filename>`, 'target root filename (default: README.md)')
|
|
15
|
+
.option(`${OPTIONS.depth} <filename>`, 'depth level more than 0')
|
|
16
|
+
.action(options => {
|
|
17
|
+
return action(options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export const getSettings = (options) => {
|
|
21
|
+
return _getSettings(options.input || '');
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// import { EventEmitter } from 'events';
|
|
2
3
|
import { program } from 'commander';
|
|
3
4
|
import { error } from '../_internal/utils/log.js';
|
|
4
5
|
import { get, ENVS, init } from '../_internal/utils/process.js';
|
|
5
6
|
import { init as initCommands } from './commands/index.js';
|
|
7
|
+
// EventEmitter.defaultMaxListeners = 50
|
|
6
8
|
init();
|
|
7
9
|
program.version(`${get(ENVS.PACKAGE_VERSION)}`);
|
|
8
10
|
await initCommands(program);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "md-hopper",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"md-hopper": "./dist/lib/cli/index.js",
|
|
7
|
+
"mdhopper": "./dist/lib/cli/index.js",
|
|
8
|
+
"mdhop": "./dist/lib/cli/index.js"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/cilly-yllic/my-packages.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/cilly-yllic/my-packages/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/cilly-yllic/my-packages/blob/main/packages/md-hopper/README.md",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"markdown",
|
|
20
|
+
"readme",
|
|
21
|
+
"md",
|
|
22
|
+
"links"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
".": {
|
|
30
|
+
"development": "./src/index.ts",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"!**/*.tsbuildinfo"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@inquirer/prompts": "^7.5.0",
|
|
42
|
+
"chalk": "^5.4.1",
|
|
43
|
+
"commander": "^13.1.0",
|
|
44
|
+
"marked": "^15.0.11",
|
|
45
|
+
"minimatch": "^10.0.1",
|
|
46
|
+
"my-gadgetry": "1.3.7",
|
|
47
|
+
"tslib": "^2.3.0",
|
|
48
|
+
"uuid": "^11.1.0"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,112 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "md-hopper",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.0.2",
|
|
5
4
|
"type": "module",
|
|
6
5
|
"bin": {
|
|
7
|
-
"md-hopper": "./dist/cli/index.js",
|
|
8
|
-
"mdhopper": "./dist/cli/index.js",
|
|
9
|
-
"mdhop": "./dist/cli/index.js"
|
|
6
|
+
"md-hopper": "./dist/lib/cli/index.js",
|
|
7
|
+
"mdhopper": "./dist/lib/cli/index.js",
|
|
8
|
+
"mdhop": "./dist/lib/cli/index.js"
|
|
10
9
|
},
|
|
11
10
|
"repository": {
|
|
12
11
|
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/cilly-yllic/
|
|
12
|
+
"url": "git+https://github.com/cilly-yllic/my-packages.git"
|
|
14
13
|
},
|
|
15
14
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/cilly-yllic/
|
|
15
|
+
"url": "https://github.com/cilly-yllic/my-packages/issues"
|
|
17
16
|
},
|
|
18
|
-
"homepage": "https://github.com/cilly-yllic/md-hopper
|
|
17
|
+
"homepage": "https://github.com/cilly-yllic/my-packages/blob/main/packages/md-hopper/README.md",
|
|
19
18
|
"keywords": [
|
|
20
19
|
"markdown",
|
|
21
20
|
"readme",
|
|
22
21
|
"md",
|
|
23
22
|
"links"
|
|
24
23
|
],
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"lint": "eslint .",
|
|
29
|
-
"lint:fix": "npm run lint -- --fix",
|
|
30
|
-
"_prettier": "prettier .",
|
|
31
|
-
"prettier:write": "npm run _prettier -- --write",
|
|
32
|
-
"prettier": "npm run prettier:write",
|
|
33
|
-
"prettier:check": "npm run _prettier -- --check",
|
|
34
|
-
"clean": "rimraf ./dist ./cli",
|
|
35
|
-
"tsc": "tsc -p tsconfig.publish.json && tsc-alias -p tsconfig.publish.json",
|
|
36
|
-
"generate": "tsx --tsconfig ./tsconfig.zx.json ./tools/generate-alias.zx.ts",
|
|
37
|
-
"ci:update-version": "tsx --tsconfig ./tsconfig.zx.json ./tools/update-version.zx.ts",
|
|
38
|
-
"md:generate": "tsx --tsconfig ./tsconfig.zx.json ./tools/generate-md.ts",
|
|
39
|
-
|
|
40
|
-
"//--- test ---//": "",
|
|
41
|
-
"test": "run-s test:*",
|
|
42
|
-
"test:lint": "npm run lint",
|
|
43
|
-
"test:prettier": "npm run prettier:check",
|
|
44
|
-
"test:jest": "npm run jest",
|
|
45
|
-
|
|
46
|
-
"//--- build ---//": "",
|
|
47
|
-
"build": "run-s build:*",
|
|
48
|
-
"build:test": "npm run test",
|
|
49
|
-
"build:clean": "npm run clean",
|
|
50
|
-
"build:tsc": "npm run tsc",
|
|
51
|
-
"build:generate": "npm run generate",
|
|
52
|
-
|
|
53
|
-
"//--- publish ---//": "",
|
|
54
|
-
"publish:build": "run-s build:{clean,tsc,generate}"
|
|
55
|
-
},
|
|
56
|
-
"author": "",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
57
27
|
"exports": {
|
|
58
|
-
"./package.json": "./package.json"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"@actions/core": "^1.10.1",
|
|
66
|
-
"@actions/exec": "^1.1.1",
|
|
67
|
-
"@actions/github": "^6.0.0",
|
|
68
|
-
"chalk": "^5.3.0",
|
|
69
|
-
"commander": "^12.1.0",
|
|
70
|
-
"inquirer": "^9.2.23",
|
|
71
|
-
"inquirer-plugins": "^1.0.0-alpha.5",
|
|
72
|
-
"marked": "^12.0.2",
|
|
73
|
-
"minimatch": "^9.0.4",
|
|
74
|
-
"my-gadgetry": "^1.2.17",
|
|
75
|
-
"uuid": "^10.0.0",
|
|
76
|
-
"zx": "^8.1.2"
|
|
77
|
-
},
|
|
78
|
-
"devDependencies": {
|
|
79
|
-
"@babel/core": "^7.24.7",
|
|
80
|
-
"@babel/preset-env": "^7.24.7",
|
|
81
|
-
"@babel/preset-typescript": "^7.24.7",
|
|
82
|
-
"@eslint/js": "^8.57.0",
|
|
83
|
-
"@types/inquirer": "^9.0.7",
|
|
84
|
-
"@types/jest": "^29.5.12",
|
|
85
|
-
"@types/uuid": "^9.0.8",
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
87
|
-
"@typescript-eslint/parser": "^7.9.0",
|
|
88
|
-
"babel-jest": "^29.7.0",
|
|
89
|
-
"eslint": "^8.57.0",
|
|
90
|
-
"eslint-config-prettier": "^9.1.0",
|
|
91
|
-
"eslint-import-resolver-typescript": "^3.6.1",
|
|
92
|
-
"eslint-plugin-import": "^2.29.1",
|
|
93
|
-
"eslint-plugin-jest": "^28.6.0",
|
|
94
|
-
"eslint-plugin-unused-imports": "^3.2.0",
|
|
95
|
-
"fs-extra": "^11.2.0",
|
|
96
|
-
"husky": "^9.0.11",
|
|
97
|
-
"jest": "^29.7.0",
|
|
98
|
-
"lint-staged": "^15.2.6",
|
|
99
|
-
"npm-run-all2": "^6.2.0",
|
|
100
|
-
"prettier": "^3.3.2",
|
|
101
|
-
"ts-jest": "^29.1.4",
|
|
102
|
-
"ts-node": "^10.9.2",
|
|
103
|
-
"tsc-alias": "^1.8.10",
|
|
104
|
-
"tsx": "^4.15.2",
|
|
105
|
-
"typescript": "^5.4.5",
|
|
106
|
-
"typescript-eslint": "^7.13.0"
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
".": {
|
|
30
|
+
"development": "./src/index.ts",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
}
|
|
107
35
|
},
|
|
108
36
|
"files": [
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
]
|
|
37
|
+
"dist",
|
|
38
|
+
"!**/*.tsbuildinfo"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@inquirer/prompts": "^7.5.0",
|
|
42
|
+
"chalk": "^5.4.1",
|
|
43
|
+
"commander": "^13.1.0",
|
|
44
|
+
"marked": "^15.0.11",
|
|
45
|
+
"minimatch": "^10.0.1",
|
|
46
|
+
"my-gadgetry": "1.3.7",
|
|
47
|
+
"inquirer-plugins": "1.0.4",
|
|
48
|
+
"tslib": "^2.3.0",
|
|
49
|
+
"uuid": "^11.1.0"
|
|
50
|
+
}
|
|
112
51
|
}
|
package/cli/index/package.json
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { isNumber } from 'my-gadgetry/type-check';
|
|
2
|
-
import { DEFAULT_MD_FILENAME } from '../../utils/configs.js';
|
|
3
|
-
import { isDirectory } from '../../utils/path.js';
|
|
4
|
-
export const TYPES = {
|
|
5
|
-
rc: 'rc',
|
|
6
|
-
link: 'link',
|
|
7
|
-
};
|
|
8
|
-
const INPUT_QUESTION = {
|
|
9
|
-
type: 'input',
|
|
10
|
-
name: 'input',
|
|
11
|
-
message: 'Please put path from current dir with filename? ex: "./{path}/{filename}.md"',
|
|
12
|
-
};
|
|
13
|
-
const SKIP_HIDDEN_QUESTION = {
|
|
14
|
-
type: 'confirm',
|
|
15
|
-
name: 'skipHidden',
|
|
16
|
-
message: 'skip search hidden file? default Yes.',
|
|
17
|
-
default: true,
|
|
18
|
-
};
|
|
19
|
-
const INCLUDE_QUESTION = {
|
|
20
|
-
type: 'input',
|
|
21
|
-
name: 'include',
|
|
22
|
-
message: 'include pattern minimatch list with comma. ex: xxx,xxx',
|
|
23
|
-
default: '',
|
|
24
|
-
};
|
|
25
|
-
const EXCLUDE_QUESTION = {
|
|
26
|
-
type: 'input',
|
|
27
|
-
name: 'exclude',
|
|
28
|
-
message: 'exclude pattern minimatch list with comma. ex: xxx,xxx',
|
|
29
|
-
default: '',
|
|
30
|
-
};
|
|
31
|
-
const FILENAMES_QUESTION = {
|
|
32
|
-
type: 'input',
|
|
33
|
-
name: 'filenames',
|
|
34
|
-
message: 'search filenames with comma. (default: README.md) ex: README.md,CHANGELOG.md',
|
|
35
|
-
default: DEFAULT_MD_FILENAME,
|
|
36
|
-
};
|
|
37
|
-
const OUTPUT_QUESTION = {
|
|
38
|
-
type: 'input',
|
|
39
|
-
name: 'output',
|
|
40
|
-
message: 'output filename. (default: same name as read, means update file) ex: README_GENERATE.md',
|
|
41
|
-
};
|
|
42
|
-
const DEPTH_QUESTION = {
|
|
43
|
-
type: 'number',
|
|
44
|
-
name: 'depth',
|
|
45
|
-
message: 'search depth number. more than 0. (if all put 0)',
|
|
46
|
-
validate: input => {
|
|
47
|
-
return isNumber(input, true) && input >= 0;
|
|
48
|
-
},
|
|
49
|
-
filter: input => {
|
|
50
|
-
return input >= 0 ? Number(input) : '';
|
|
51
|
-
},
|
|
52
|
-
default: 0,
|
|
53
|
-
};
|
|
54
|
-
export const RC_QUESTIONS = (_options) => [
|
|
55
|
-
{
|
|
56
|
-
...INPUT_QUESTION,
|
|
57
|
-
validate: input => {
|
|
58
|
-
return !!input;
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
SKIP_HIDDEN_QUESTION,
|
|
62
|
-
INCLUDE_QUESTION,
|
|
63
|
-
EXCLUDE_QUESTION,
|
|
64
|
-
FILENAMES_QUESTION,
|
|
65
|
-
OUTPUT_QUESTION,
|
|
66
|
-
DEPTH_QUESTION,
|
|
67
|
-
];
|
|
68
|
-
export const GENERATE_TYPES = Object.freeze({
|
|
69
|
-
path: 'path',
|
|
70
|
-
random: 'random',
|
|
71
|
-
manual: 'manual',
|
|
72
|
-
});
|
|
73
|
-
const GENERATE_TYPE_CHOICES = Object.freeze([
|
|
74
|
-
{ name: 'auto generate with directory path', short: 'dir path', value: GENERATE_TYPES.path },
|
|
75
|
-
{ name: 'auto generate with uuid', short: 'random', value: GENERATE_TYPES.random },
|
|
76
|
-
{ name: 'generate yourself', short: 'manually', value: GENERATE_TYPES.manual },
|
|
77
|
-
]);
|
|
78
|
-
const DIR_QUESTIONS = (options) => [SKIP_HIDDEN_QUESTION, INCLUDE_QUESTION, EXCLUDE_QUESTION, FILENAMES_QUESTION, DEPTH_QUESTION].map(QUESTION => ({
|
|
79
|
-
...QUESTION,
|
|
80
|
-
when: (answers) => isDirectory(answers.input || options.input || ''),
|
|
81
|
-
}));
|
|
82
|
-
const FILE_QUESTIONS = (options) => [
|
|
83
|
-
{
|
|
84
|
-
type: 'input',
|
|
85
|
-
name: 'title',
|
|
86
|
-
message: 'title name. (default: auto detect title)',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: 'confirm',
|
|
90
|
-
name: 'lock',
|
|
91
|
-
message: 'is locked? if true not link this file. (default: false)',
|
|
92
|
-
default: false,
|
|
93
|
-
},
|
|
94
|
-
OUTPUT_QUESTION,
|
|
95
|
-
].map(QUESTION => ({ ...QUESTION, when: (answers) => !isDirectory(answers.input || options.input || '') }));
|
|
96
|
-
export const LINK_QUESTIONS = (options) => [
|
|
97
|
-
{
|
|
98
|
-
...INPUT_QUESTION,
|
|
99
|
-
message: 'Please put path from current dir with filename? (default: ".") ex: "./{path}/{filename}.md"',
|
|
100
|
-
default: '.',
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
type: 'list',
|
|
104
|
-
name: 'idGen',
|
|
105
|
-
message: `Choose generate type (default: ${GENERATE_TYPE_CHOICES[0].short})`,
|
|
106
|
-
choices: answers => {
|
|
107
|
-
if (isDirectory(answers.input || options.input || '')) {
|
|
108
|
-
return GENERATE_TYPE_CHOICES.filter(({ value }) => [GENERATE_TYPES.path, GENERATE_TYPES.random].includes(value));
|
|
109
|
-
}
|
|
110
|
-
return GENERATE_TYPE_CHOICES;
|
|
111
|
-
},
|
|
112
|
-
default: 0,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: 'input',
|
|
116
|
-
name: 'id',
|
|
117
|
-
message: 'type id',
|
|
118
|
-
validate: input => {
|
|
119
|
-
return !!input;
|
|
120
|
-
},
|
|
121
|
-
when: answers => {
|
|
122
|
-
return answers.idGen === GENERATE_TYPES.manual;
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
...DIR_QUESTIONS(options),
|
|
126
|
-
...FILE_QUESTIONS(options),
|
|
127
|
-
];
|
|
128
|
-
export const QUESTIONS = (options) => ({
|
|
129
|
-
[TYPES.rc]: RC_QUESTIONS(options),
|
|
130
|
-
[TYPES.link]: LINK_QUESTIONS(options),
|
|
131
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
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 class CommandClass<CommandOptions extends Record<string, any>, MdSettings extends Record<string, any>> {
|
|
5
|
-
program: Program;
|
|
6
|
-
private befores;
|
|
7
|
-
private args;
|
|
8
|
-
private getSettingFnc;
|
|
9
|
-
constructor(program: Program, getSettingFnc: SettingsFnc<CommandOptions, MdSettings>);
|
|
10
|
-
init(options: CommandOptions, settings: MdSettings): this;
|
|
11
|
-
command(command: string): this;
|
|
12
|
-
help(helpTxt: string): this;
|
|
13
|
-
before(before: Action, ...args: any[]): this;
|
|
14
|
-
description(description: string): this;
|
|
15
|
-
option(...args: any[]): this;
|
|
16
|
-
requiredOption(...args: any[]): this;
|
|
17
|
-
action(action: Action): void;
|
|
18
|
-
}
|
|
19
|
-
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;
|
|
20
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { getSettings as _getSettings } from '../../../_internal/utils/link.js';
|
|
2
|
-
import { getCommands } from '../../../_internal/utils/path.js';
|
|
3
|
-
import { action } from './action.js';
|
|
4
|
-
export const COMMANDS = getCommands(import.meta.dirname);
|
|
5
|
-
export const init = (commandClass) => {
|
|
6
|
-
commandClass
|
|
7
|
-
.description('This command is used to exec target file.')
|
|
8
|
-
.option('-sh --skip-hidden', 'skip read hidden dir (default: true)')
|
|
9
|
-
.option('-incl, --include <strings>', 'include dirs (default: [] (all files))')
|
|
10
|
-
.option('-excl, --exclude <strings>', 'ignore dirs (default: node_modules only)')
|
|
11
|
-
.option('-f, --filenames <strings>', 'filenames (default: README.md only)')
|
|
12
|
-
.option('-o, --output <filename>', 'output filename (default: README.md (replace))')
|
|
13
|
-
.option('-i, --input <filename>', 'target root filename (default: README.md)')
|
|
14
|
-
.option('-D, --depth <filename>', 'depth level more than 0')
|
|
15
|
-
.action(options => {
|
|
16
|
-
return action(options);
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export const getSettings = (options) => {
|
|
20
|
-
return _getSettings(options.input || '');
|
|
21
|
-
};
|
package/dist/cli/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|