mdat 0.6.12 → 0.6.14
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/bin/cli.js +356 -33
- package/dist/index.js +249 -27
- package/dist/src/cli/cli.d.ts +2 -0
- package/dist/src/cli/options.d.ts +63 -0
- package/dist/src/cli/readme-options.d.ts +61 -0
- package/dist/src/lib/readme/init.d.ts +16 -0
- package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/get-help-markdown.d.ts +1 -0
- package/dist/src/lib/readme/rules/cli.d.ts +9 -0
- package/dist/{readme → src/lib/readme}/rules/index.d.ts +8 -5
- package/dist/src/lib/readme/templates/index.d.ts +36 -0
- package/package.json +18 -18
- package/readme.md +2 -0
- package/dist/.DS_Store +0 -0
- /package/dist/{api.d.ts → src/lib/api.d.ts} +0 -0
- /package/dist/{config.d.ts → src/lib/config.d.ts} +0 -0
- /package/dist/{index.d.ts → src/lib/index.d.ts} +0 -0
- /package/dist/{mdat-json-loader.d.ts → src/lib/mdat-json-loader.d.ts} +0 -0
- /package/dist/{processors.d.ts → src/lib/processors.d.ts} +0 -0
- /package/dist/{readme → src/lib/readme}/api.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/config.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/badges.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/banner.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/cli-help/index.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/help-object-to-markdown.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/help-string-to-object.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/infer-command.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/parsers/index.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/parsers/meow.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/parsers/yargs.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/code.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/contributing.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/description.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/footer.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/header.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/license.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/short-description.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/table-of-contents.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/title.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/tldraw.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/rules/toc.d.ts +0 -0
- /package/dist/{readme → src/lib/readme}/utilities.d.ts +0 -0
- /package/dist/{utilities.d.ts → src/lib/utilities.d.ts} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const configOption: {
|
|
2
|
+
readonly config: {
|
|
3
|
+
readonly defaultDescription: "Configuration is loaded if found from the usual places, or defaults are used.";
|
|
4
|
+
readonly description: "Path(s) to files containing MDAT configuration.";
|
|
5
|
+
readonly string: true;
|
|
6
|
+
readonly type: "array";
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const metaOption: {
|
|
10
|
+
readonly meta: {
|
|
11
|
+
readonly alias: "m";
|
|
12
|
+
readonly description: "Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically.";
|
|
13
|
+
readonly type: "boolean";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const nameOption: {
|
|
17
|
+
readonly name: {
|
|
18
|
+
readonly alias: "n";
|
|
19
|
+
readonly defaultDescription: "Same name as input file. Overwrites the input file.";
|
|
20
|
+
readonly description: "Output file name.";
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const outputOption: {
|
|
25
|
+
readonly output: {
|
|
26
|
+
readonly alias: "o";
|
|
27
|
+
readonly defaultDescription: "Same directory as input file.";
|
|
28
|
+
readonly description: "Output file directory.";
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare const prefixOption: {
|
|
33
|
+
readonly prefix: {
|
|
34
|
+
readonly description: "Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety.";
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const printOption: {
|
|
39
|
+
readonly print: {
|
|
40
|
+
readonly description: "Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options.";
|
|
41
|
+
readonly type: "boolean";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const rulesOption: {
|
|
45
|
+
readonly rules: {
|
|
46
|
+
readonly alias: "r";
|
|
47
|
+
readonly description: "Path(s) to files containing MDAT comment expansion rules.";
|
|
48
|
+
readonly string: true;
|
|
49
|
+
readonly type: "array";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare const verboseOption: {
|
|
53
|
+
readonly verbose: {
|
|
54
|
+
readonly describe: "Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.";
|
|
55
|
+
readonly type: "boolean";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const filesPositional: ["files", {
|
|
59
|
+
readonly array: true;
|
|
60
|
+
readonly demandOption: true;
|
|
61
|
+
readonly describe: "Markdown file(s) with MDAT placeholder comments.";
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
}];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const packageOption: {
|
|
2
|
+
readonly package: {
|
|
3
|
+
readonly defaultDescription: "The closest package.json file is used by default.";
|
|
4
|
+
readonly description: "Path to the package.json file to use to populate the readme.";
|
|
5
|
+
readonly string: true;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare const assetsOption: {
|
|
9
|
+
readonly assets: {
|
|
10
|
+
readonly defaultDescription: "./assets";
|
|
11
|
+
readonly description: "Path to find and save readme-related assets.";
|
|
12
|
+
readonly string: true;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const interactiveOption: {
|
|
16
|
+
readonly interactive: {
|
|
17
|
+
readonly alias: "i";
|
|
18
|
+
readonly default: true;
|
|
19
|
+
readonly description: "Run the guided interactive `init` process. Set explicitly to `false` to use default values and skip the prompt.";
|
|
20
|
+
readonly type: "boolean";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare const overwriteOption: {
|
|
24
|
+
readonly overwrite: {
|
|
25
|
+
readonly default: false;
|
|
26
|
+
readonly defaultDescription: "`false`, if an existing readme is found, don't touch it.";
|
|
27
|
+
readonly description: "Replace an existing readme file if one is found.";
|
|
28
|
+
readonly type: "boolean";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const expandOption: {
|
|
32
|
+
readonly expand: {
|
|
33
|
+
readonly alias: "e";
|
|
34
|
+
readonly default: true;
|
|
35
|
+
readonly description: "Automatically run `mdat readme` immediately after creating the readme template.";
|
|
36
|
+
readonly type: "boolean";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const templateOption: {
|
|
40
|
+
readonly template: {
|
|
41
|
+
readonly alias: "t";
|
|
42
|
+
readonly choices: string[];
|
|
43
|
+
readonly default: string;
|
|
44
|
+
readonly description: "Specify a template to use for the new readme.";
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare const compoundOption: {
|
|
49
|
+
readonly compound: {
|
|
50
|
+
readonly alias: "c";
|
|
51
|
+
readonly default: true;
|
|
52
|
+
readonly description: "Use compound comment version of the template to replace several individual comment placeholders where possible. This combines things like `<!-- title -->`, `<!-- badges -->`, etc. in a single `<!-- header -->` comment. It's less clutter when you're editing, but it's also less explicit. The final readme.md output is identical.";
|
|
53
|
+
readonly type: "boolean";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export declare const filesPositionalOptional: ["files", {
|
|
57
|
+
readonly array: true;
|
|
58
|
+
readonly demandOption: false;
|
|
59
|
+
readonly describe: "Readme file(s) with MDAT placeholder comments. If not provided, the closest readme.md file is used.";
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
}];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Symbolize<T extends Record<string, unknown>> = {
|
|
2
|
+
[x in keyof T]: T[x] | symbol;
|
|
3
|
+
};
|
|
4
|
+
type MdatReadmeInitOptions = {
|
|
5
|
+
compound: boolean;
|
|
6
|
+
expand: boolean;
|
|
7
|
+
output: string;
|
|
8
|
+
overwrite: boolean;
|
|
9
|
+
template: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function initReadmeInteractive(): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* @return Path to the created readme file.
|
|
14
|
+
*/
|
|
15
|
+
export declare function initReadme(options?: Partial<MdatReadmeInitOptions>): Promise<string>;
|
|
16
|
+
export {};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
title: {
|
|
3
|
-
applicationOrder: number;
|
|
4
|
-
content(options?: import("type-fest").JsonValue | undefined): Promise<string>;
|
|
5
|
-
order: number;
|
|
6
|
-
};
|
|
7
2
|
toc: {
|
|
8
3
|
applicationOrder: number;
|
|
9
4
|
content(options: import("type-fest").JsonValue, tree: import("mdast").Root): Promise<string>;
|
|
@@ -12,6 +7,11 @@ declare const _default: {
|
|
|
12
7
|
tldraw: {
|
|
13
8
|
content(options?: import("type-fest").JsonValue | undefined): Promise<string>;
|
|
14
9
|
};
|
|
10
|
+
title: {
|
|
11
|
+
applicationOrder: number;
|
|
12
|
+
content(options?: import("type-fest").JsonValue | undefined): Promise<string>;
|
|
13
|
+
order: number;
|
|
14
|
+
};
|
|
15
15
|
'table-of-contents': {
|
|
16
16
|
applicationOrder: number;
|
|
17
17
|
content(options: import("type-fest").JsonValue, tree: import("mdast").Root): Promise<string>;
|
|
@@ -54,6 +54,9 @@ declare const _default: {
|
|
|
54
54
|
'cli-help': {
|
|
55
55
|
content(options?: import("type-fest").JsonValue | undefined): Promise<string>;
|
|
56
56
|
};
|
|
57
|
+
cli: {
|
|
58
|
+
content(options?: import("type-fest").JsonValue | undefined): Promise<string>;
|
|
59
|
+
};
|
|
57
60
|
banner: {
|
|
58
61
|
content(options?: import("type-fest").JsonValue | undefined): Promise<string>;
|
|
59
62
|
order: number;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type Template = {
|
|
2
|
+
content: {
|
|
3
|
+
compound: string;
|
|
4
|
+
explicit: string;
|
|
5
|
+
};
|
|
6
|
+
description: string;
|
|
7
|
+
exampleLink: `https://${string}.md`;
|
|
8
|
+
};
|
|
9
|
+
export type Templates = Record<string, Template>;
|
|
10
|
+
declare const _default: {
|
|
11
|
+
'MDAT Readme': {
|
|
12
|
+
content: {
|
|
13
|
+
compound: string;
|
|
14
|
+
explicit: string;
|
|
15
|
+
};
|
|
16
|
+
description: string;
|
|
17
|
+
exampleLink: "https://github.com/kitschpatrol/mdat/blob/main/readme.md";
|
|
18
|
+
};
|
|
19
|
+
'Standard Readme Basic': {
|
|
20
|
+
content: {
|
|
21
|
+
compound: string;
|
|
22
|
+
explicit: string;
|
|
23
|
+
};
|
|
24
|
+
description: string;
|
|
25
|
+
exampleLink: "https://github.com/RichardLitt/standard-readme/blob/main/example-readmes/minimal-readme.md";
|
|
26
|
+
};
|
|
27
|
+
'Standard Readme Full': {
|
|
28
|
+
content: {
|
|
29
|
+
compound: string;
|
|
30
|
+
explicit: string;
|
|
31
|
+
};
|
|
32
|
+
description: string;
|
|
33
|
+
exampleLink: "https://github.com/RichardLitt/standard-readme/blob/main/example-readmes/maximal-readme.md";
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdat",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool and library implementing the Markdown Autophagic Template (MDAT) system. MDAT lets you use comments as dynamic content templates in Markdown files, making it easy to generate and update readme boilerplate.",
|
|
6
6
|
"repository": {
|
|
@@ -43,43 +43,43 @@
|
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@clack/prompts": "^0.7.0",
|
|
46
|
-
"@kitschpatrol/tldraw-cli": "^4.5.
|
|
46
|
+
"@kitschpatrol/tldraw-cli": "^4.5.4",
|
|
47
47
|
"@types/mdast": "^4.0.4",
|
|
48
|
+
"@types/node": "^20.14.1",
|
|
48
49
|
"@types/unist": "^3.0.2",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
50
|
+
"@types/which": "^3.0.4",
|
|
51
|
+
"@types/yargs": "^17.0.32",
|
|
51
52
|
"cosmiconfig": "^9.0.0",
|
|
52
53
|
"cosmiconfig-typescript-loader": "^5.0.0",
|
|
53
54
|
"execa": "^9.1.0",
|
|
54
|
-
"find-up": "^7.0.0",
|
|
55
55
|
"globby": "^14.0.1",
|
|
56
|
+
"read-pkg": "^9.0.1",
|
|
57
|
+
"which": "^4.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"chalk": "^5.3.0",
|
|
61
|
+
"chevrotain": "^11.0.3",
|
|
62
|
+
"find-up": "^7.0.0",
|
|
56
63
|
"is-executable": "^2.0.1",
|
|
57
|
-
"mdast-util-toc": "^7.0
|
|
64
|
+
"mdast-util-toc": "^7.1.0",
|
|
58
65
|
"nanoid": "^5.0.7",
|
|
59
66
|
"package-up": "^5.0.0",
|
|
60
67
|
"path-type": "^5.0.0",
|
|
61
68
|
"pkg-dir": "^8.0.0",
|
|
62
69
|
"plur": "^5.1.0",
|
|
63
70
|
"pretty-ms": "^9.0.0",
|
|
64
|
-
"read-pkg": "^9.0.1",
|
|
65
71
|
"remark": "^15.0.1",
|
|
66
72
|
"remark-gfm": "^4.0.0",
|
|
67
73
|
"to-vfile": "^8.0.0",
|
|
68
|
-
"
|
|
74
|
+
"tsup": "^8.1.0",
|
|
75
|
+
"type-fest": "^4.19.0",
|
|
76
|
+
"typescript": "^5.4.5",
|
|
69
77
|
"untildify": "^5.0.0",
|
|
70
78
|
"vfile": "^6.0.1",
|
|
71
|
-
"
|
|
79
|
+
"vitest": "^1.6.0",
|
|
72
80
|
"yargs": "^17.7.2",
|
|
73
81
|
"zod": "^3.23.8",
|
|
74
|
-
"remark-mdat": "0.6.
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"@types/node": "^20.12.12",
|
|
78
|
-
"@types/which": "^3.0.3",
|
|
79
|
-
"@types/yargs": "^17.0.32",
|
|
80
|
-
"tsup": "^8.0.2",
|
|
81
|
-
"typescript": "^5.4.5",
|
|
82
|
-
"vitest": "^1.6.0"
|
|
82
|
+
"remark-mdat": "0.6.14"
|
|
83
83
|
},
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
package/readme.md
CHANGED
|
@@ -701,6 +701,8 @@ See the [Examples section](../remark-mdat/readme.md#examples) of the `remark-mda
|
|
|
701
701
|
|
|
702
702
|
([Parsing help output](https://github.com/kitschpatrol/mdat/tree/main/packages/mdat/src/lib/readme/rules/cli-help/utilities/parsers) is a bit tricky. The [jc](https://github.com/kellyjonbrazil/jc) project is a heroic collection of output parsers, but does not currently implement help output parsing. It might be interesting to try to contribute mdat's help parsing implementations to jc.)
|
|
703
703
|
|
|
704
|
+
This rule is also aliased under the `<!-- cli -->` keyword.
|
|
705
|
+
|
|
704
706
|
- ###### `<!-- tldraw -->`
|
|
705
707
|
|
|
706
708
|
Allows embedding [tldraw](https://www.tldraw.com) files in your readme. Accepts either a path to a local `.tldr` file, or remote tldraw URLs.
|
package/dist/.DS_Store
DELETED
|
Binary file
|
|
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
|
/package/dist/{readme → src/lib/readme}/rules/cli-help/utilities/help-object-to-markdown.d.ts
RENAMED
|
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
|