mdat 0.8.1 → 0.9.0
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 +151 -214
- package/dist/index.js +100 -163
- package/dist/readme/rules/utilities/cli-help/parsers/index.d.ts +1 -1
- package/package.json +14 -14
- package/readme.md +31 -5
|
@@ -33,8 +33,8 @@ export type ProgramInfo = {
|
|
|
33
33
|
subcommandName?: string;
|
|
34
34
|
};
|
|
35
35
|
declare const _default: {
|
|
36
|
-
meow: typeof helpStringToObjectMeow;
|
|
37
36
|
yargs: typeof helpStringToObjectYargs;
|
|
37
|
+
meow: typeof helpStringToObjectMeow;
|
|
38
38
|
};
|
|
39
39
|
export default _default;
|
|
40
40
|
export declare function getCommandParts(wholeCommand: string | undefined): {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
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": "github:kitschpatrol/mdat",
|
|
@@ -39,46 +39,46 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@clack/prompts": "^0.7.0",
|
|
42
|
-
"@kitschpatrol/tldraw-cli": "^4.6.
|
|
42
|
+
"@kitschpatrol/tldraw-cli": "^4.6.28",
|
|
43
43
|
"@types/mdast": "^4.0.4",
|
|
44
44
|
"@types/node": "18.19.0",
|
|
45
45
|
"@types/unist": "^3.0.3",
|
|
46
46
|
"@types/yargs": "^17.0.33",
|
|
47
47
|
"cosmiconfig": "^9.0.0",
|
|
48
|
-
"cosmiconfig-typescript-loader": "^6.
|
|
49
|
-
"execa": "^9.5.
|
|
48
|
+
"cosmiconfig-typescript-loader": "^6.1.0",
|
|
49
|
+
"execa": "^9.5.2",
|
|
50
50
|
"globby": "^14.0.2",
|
|
51
51
|
"read-pkg": "^9.0.1",
|
|
52
|
+
"remark-mdat": "^0.7.5",
|
|
53
|
+
"type-fest": "^4.33.0",
|
|
54
|
+
"vfile": "^6.0.3",
|
|
52
55
|
"which": "^5.0.0"
|
|
53
56
|
},
|
|
54
57
|
"devDependencies": {
|
|
55
58
|
"@kitschpatrol/shared-config": "^4.7.12",
|
|
56
59
|
"@types/which": "^3.0.4",
|
|
57
|
-
"bumpp": "^9.
|
|
58
|
-
"chalk": "^5.
|
|
60
|
+
"bumpp": "^9.10.1",
|
|
61
|
+
"chalk": "^5.4.1",
|
|
59
62
|
"chevrotain": "^11.0.3",
|
|
60
63
|
"find-up": "^7.0.0",
|
|
61
64
|
"is-executable": "^2.0.1",
|
|
62
65
|
"mdast-util-toc": "^7.1.0",
|
|
63
|
-
"nanoid": "^5.0.
|
|
66
|
+
"nanoid": "^5.0.9",
|
|
64
67
|
"package-up": "^5.0.0",
|
|
65
68
|
"path-type": "^6.0.0",
|
|
66
69
|
"pkg-dir": "^8.0.0",
|
|
67
70
|
"plur": "^5.1.0",
|
|
68
71
|
"pretty-bytes": "^6.1.1",
|
|
69
|
-
"pretty-ms": "^9.
|
|
72
|
+
"pretty-ms": "^9.2.0",
|
|
70
73
|
"remark": "^15.0.1",
|
|
71
74
|
"remark-gfm": "^4.0.0",
|
|
72
|
-
"remark-mdat": "^0.7.4",
|
|
73
75
|
"to-vfile": "^8.0.0",
|
|
74
76
|
"tsup": "^8.3.5",
|
|
75
|
-
"
|
|
76
|
-
"typescript": "^5.6.3",
|
|
77
|
+
"typescript": "^5.7.3",
|
|
77
78
|
"untildify": "^5.0.0",
|
|
78
|
-
"
|
|
79
|
-
"vitest": "^2.1.4",
|
|
79
|
+
"vitest": "^2.1.8",
|
|
80
80
|
"yargs": "^17.7.2",
|
|
81
|
-
"zod": "^3.
|
|
81
|
+
"zod": "^3.24.1"
|
|
82
82
|
},
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
package/readme.md
CHANGED
|
@@ -601,6 +601,32 @@ TypeScript or JavaScript with JSDoc annotations are recommended for the most fle
|
|
|
601
601
|
|
|
602
602
|
`mdat` also allows arbitrary JSON files to be loaded as rule sets, flattening them so any value may be accessed by using a dot-notation key path as a comment keyword.
|
|
603
603
|
|
|
604
|
+
#### Configuration in package.json
|
|
605
|
+
|
|
606
|
+
"Shared" configurations can be specified in `package.json` as a special case by passing a string that can be resolved to a module which default-exports an `mdat` `Config` type object. For example, in your `package.json`:
|
|
607
|
+
|
|
608
|
+
```json
|
|
609
|
+
{
|
|
610
|
+
"mdat": "@kitschpatrol/mdat-config"
|
|
611
|
+
}
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Though a string is not technically a valid `mdat` `Config` object, it is detected as a special case which loads the `Config` object exported from the `@kitschpatrol/mdat-config` module.
|
|
615
|
+
|
|
616
|
+
Rules may also be defined directly in `package.json`, but of course only static replacements are supported. For programmatic rules, you will need to create a JavaScript or TypeScript configuration file.
|
|
617
|
+
|
|
618
|
+
For example, the following configuration in your `package.json` will expand `<!-- what -->` comments:
|
|
619
|
+
|
|
620
|
+
```json
|
|
621
|
+
{
|
|
622
|
+
"mdat": {
|
|
623
|
+
"rules": {
|
|
624
|
+
"what": "hath god wrought"
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
```
|
|
629
|
+
|
|
604
630
|
#### Configuration file format
|
|
605
631
|
|
|
606
632
|
The `mdat` configuration file is a record object allowing you to customize aspects of the comment expansion process, and also optionally define expansion rules as well under the `rules` key:
|
|
@@ -619,7 +645,7 @@ type Config = {
|
|
|
619
645
|
|
|
620
646
|
A valid configuration file default-exports an object conforming to the above type.
|
|
621
647
|
|
|
622
|
-
The configuration file may be located in any location supported by [cosmicconfig](https://github.com/cosmiconfig/cosmiconfig?tab=readme-ov-file#searchplaces). I use an
|
|
648
|
+
The configuration file may be located in any location supported by [cosmicconfig](https://github.com/cosmiconfig/cosmiconfig?tab=readme-ov-file#searchplaces). I use an `mdat.config.ts` file in the root of my projects.
|
|
623
649
|
|
|
624
650
|
#### Rule file format
|
|
625
651
|
|
|
@@ -712,10 +738,10 @@ See the [Examples section](https://github.com/kitschpatrol/remark-mdat#examples)
|
|
|
712
738
|
|
|
713
739
|
<!-- size-table { files: ["package.json", "readme.md"] } -->
|
|
714
740
|
|
|
715
|
-
| File | Original | Gzip
|
|
716
|
-
| ------------ | -------- |
|
|
717
|
-
| package.json | 2.5 kB | 1.1 kB
|
|
718
|
-
| readme.md |
|
|
741
|
+
| File | Original | Gzip | Brotli |
|
|
742
|
+
| ------------ | -------- | ------ | ------ |
|
|
743
|
+
| package.json | 2.5 kB | 1.1 kB | 996 B |
|
|
744
|
+
| readme.md | 22.8 kB | 8.2 kB | 6.8 kB |
|
|
719
745
|
|
|
720
746
|
<!-- /size-table -->
|
|
721
747
|
|