@stephansama/auto-readme 0.1.0 → 0.1.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.
- package/README.md +119 -93
- package/config/schema.json +1 -1
- package/config/schema.yaml +3 -1
- package/dist/index.cjs +28 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Auto Readme 🪄
|
|
2
2
|
|
|
3
|
-
[](https://github.com/stephansama/packages/tree/main/packages/auto-readme)
|
|
4
|
+
[](https://packages.stephansama.info/modules/_stephansama_auto-readme)
|
|
5
|
+
[](https://www.npmjs.com/package/@stephansama/auto-readme)
|
|
6
6
|
[](https://www.npmjs.com/package/@stephansama/auto-readme)
|
|
7
7
|
|
|
8
8
|
Generate lists and tables for your README automagically based on your repository
|
|
@@ -11,16 +11,16 @@ Generate lists and tables for your README automagically based on your repository
|
|
|
11
11
|
|
|
12
12
|
<details><summary>Open Table of contents</summary>
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Usage](#usage)
|
|
16
|
+
- [CLI Options](#cli-options)
|
|
17
|
+
- [Configuration](#configuration)
|
|
18
|
+
- [Configuration File](#configuration-file)
|
|
19
|
+
- [JSON Example](#json-example)
|
|
20
|
+
- [YAML Example](#yaml-example)
|
|
21
|
+
- [JavaScript Example](#javascript-example)
|
|
22
|
+
- [TypeScript Example](#typescript-example)
|
|
23
|
+
- [Schema](#schema)
|
|
24
24
|
|
|
25
25
|
</details>
|
|
26
26
|
|
|
@@ -41,6 +41,32 @@ In order to run the script you need to do two things
|
|
|
41
41
|
pnpx @stephansama/auto-readme [options]
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
To turn on table of content enable the setting `enableToc` and add the following header
|
|
45
|
+
|
|
46
|
+
```md
|
|
47
|
+
## Table of contents
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
To turn on the usage generator enable the setting `enableUsage` and add the following header
|
|
51
|
+
|
|
52
|
+
```md
|
|
53
|
+
## Usage
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
To use the zod generator add the following comments
|
|
57
|
+
|
|
58
|
+
```md
|
|
59
|
+
<!-- ZOD path="./path/to/zod.js" start -->
|
|
60
|
+
<!-- ZOD end -->
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
There are more [Actions](#actions) that you can use in conjunction with different [languages](#language) and [formats](#formats) like so:
|
|
64
|
+
|
|
65
|
+
```md
|
|
66
|
+
<!-- JS-WORKSPACE-TABLE start -->
|
|
67
|
+
<!-- JS-WORKSPACE-TABLE end -->
|
|
68
|
+
```
|
|
69
|
+
|
|
44
70
|
You can run `auto-readme` as a pre-commit git hook to automatically keep your `README`s up to date. For example, you can use `husky` to add the following to your `.husky/pre-commit` file:
|
|
45
71
|
|
|
46
72
|
```sh
|
|
@@ -68,27 +94,27 @@ Most of the options in the [schema](#schema) below can also be used as command-l
|
|
|
68
94
|
|
|
69
95
|
You can configure `auto-readme` by creating a configuration file (or object) in the root of your project. The following file formats are supported:
|
|
70
96
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
- `package.json`
|
|
98
|
+
- `.autoreadmerc`
|
|
99
|
+
- `.autoreadmerc.json`
|
|
100
|
+
- `.autoreadmerc.yaml`
|
|
101
|
+
- `.autoreadmerc.yml`
|
|
102
|
+
- `.autoreadmerc.js`
|
|
103
|
+
- `.autoreadmerc.ts`
|
|
104
|
+
- `.autoreadmerc.mjs`
|
|
105
|
+
- `.autoreadmerc.cjs`
|
|
106
|
+
- `.config/autoreadmerc`
|
|
107
|
+
- `.config/autoreadmerc.json`
|
|
108
|
+
- `.config/autoreadmerc.yaml`
|
|
109
|
+
- `.config/autoreadmerc.yml`
|
|
110
|
+
- `.config/autoreadmerc.js`
|
|
111
|
+
- `.config/autoreadmerc.ts`
|
|
112
|
+
- `.config/autoreadmerc.mjs`
|
|
113
|
+
- `.config/autoreadmerc.cjs`
|
|
114
|
+
- `autoreadme.config.js`
|
|
115
|
+
- `autoreadme.config.ts`
|
|
116
|
+
- `autoreadme.config.mjs`
|
|
117
|
+
- `autoreadme.config.cjs`
|
|
92
118
|
|
|
93
119
|
#### JSON Example
|
|
94
120
|
|
|
@@ -135,96 +161,96 @@ export default {
|
|
|
135
161
|
|
|
136
162
|
Comment action options
|
|
137
163
|
|
|
138
|
-
|
|
164
|
+
_Enum, one of the following possible values:_
|
|
139
165
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
166
|
+
- `'ACTION'`
|
|
167
|
+
- `'PKG'`
|
|
168
|
+
- `'USAGE'`
|
|
169
|
+
- `'WORKSPACE'`
|
|
170
|
+
- `'ZOD'`
|
|
145
171
|
|
|
146
172
|
## Config
|
|
147
173
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
| Property | Description | Type | Default
|
|
151
|
-
| :------------------------ | :---------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
152
|
-
| `affectedRegexes` | | `Array<string>` | `[]`
|
|
153
|
-
| `defaultLanguage` | Default language to infer projects from | [Language](#language) |
|
|
154
|
-
| `disableEmojis` | Whether or not to use emojis in markdown table headings | `boolean` | `false`
|
|
155
|
-
| `disableMarkdownHeadings` | Whether or not to display markdown headings | `boolean` | `false`
|
|
156
|
-
| `enableToc` | generate table of contents for readmes | `boolean` | `false`
|
|
157
|
-
| `enableUsage` | Whether or not to enable usage plugin | `boolean` | `false`
|
|
158
|
-
| `headings` | List of headings for different table outputs |
|
|
159
|
-
| `onlyReadmes` | Whether or not to only traverse readmes | `boolean` | `true`
|
|
160
|
-
| `onlyShowPublicPackages` | Only show public packages in workspaces | `boolean` | `false`
|
|
161
|
-
| `removeScope` | Remove common workspace scope | `string` | `''`
|
|
162
|
-
| `templates` | Handlebars templates used to fuel list and table generation |
|
|
163
|
-
| `tocHeading` | Markdown heading used to generate table of contents | `string` | `'Table of contents'`
|
|
164
|
-
| `usageFile` | Workspace level usage file | `string` | `''`
|
|
165
|
-
| `usageHeading` | Markdown heading used to generate usage example | `string` | `'Usage'`
|
|
166
|
-
| `verbose` | whether or not to display verbose logging | `boolean` | `false`
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
_Object containing the following properties:_
|
|
175
|
+
|
|
176
|
+
| Property | Description | Type | Default |
|
|
177
|
+
| :------------------------ | :---------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
178
|
+
| `affectedRegexes` | | `Array<string>` | `[]` |
|
|
179
|
+
| `defaultLanguage` | Default language to infer projects from | [Language](#language) | |
|
|
180
|
+
| `disableEmojis` | Whether or not to use emojis in markdown table headings | `boolean` | `false` |
|
|
181
|
+
| `disableMarkdownHeadings` | Whether or not to display markdown headings | `boolean` | `false` |
|
|
182
|
+
| `enableToc` | generate table of contents for readmes | `boolean` | `false` |
|
|
183
|
+
| `enableUsage` | Whether or not to enable usage plugin | `boolean` | `false` |
|
|
184
|
+
| `headings` | List of headings for different table outputs | _Object with dynamic keys of type_ [Actions](#actions) _and values of type_ _Array of [Headings](#headings) items_ (_optional_) | `{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]}` |
|
|
185
|
+
| `onlyReadmes` | Whether or not to only traverse readmes | `boolean` | `true` |
|
|
186
|
+
| `onlyShowPublicPackages` | Only show public packages in workspaces | `boolean` | `false` |
|
|
187
|
+
| `removeScope` | Remove common workspace scope | `string` | `''` |
|
|
188
|
+
| `templates` | Handlebars templates used to fuel list and table generation | _Object with properties:_<ul><li>`downloadImage`: `string`</li><li>`emojis`: _Object with dynamic keys of type_ [Headings](#headings) _and values of type_ `string` - Table heading emojis used when enabled</li><li>`registryUrl`: `string`</li><li>`versionImage`: `string`</li></ul> | `{"downloadImage":"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F","emojis":{"default":"⚙️","description":"📝","devDependency":"💻","downloads":"📥","name":"🏷️","private":"🔒","required":"","version":""},"registryUrl":"https://www.npmjs.com/package/{{name}}","versionImage":"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F"}` |
|
|
189
|
+
| `tocHeading` | Markdown heading used to generate table of contents | `string` | `'Table of contents'` |
|
|
190
|
+
| `usageFile` | Workspace level usage file | `string` | `''` |
|
|
191
|
+
| `usageHeading` | Markdown heading used to generate usage example | `string` | `'Usage'` |
|
|
192
|
+
| `verbose` | whether or not to display verbose logging | `boolean` | `false` |
|
|
193
|
+
|
|
194
|
+
_All properties are optional._ (_optional_)
|
|
169
195
|
|
|
170
196
|
## Formats
|
|
171
197
|
|
|
172
|
-
|
|
198
|
+
_Enum, one of the following possible values:_
|
|
173
199
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
(
|
|
200
|
+
- `'LIST'`
|
|
201
|
+
- `'TABLE'`
|
|
202
|
+
(_optional_)
|
|
177
203
|
|
|
178
|
-
|
|
204
|
+
_Default value:_ `'TABLE'`
|
|
179
205
|
|
|
180
206
|
## Headings
|
|
181
207
|
|
|
182
208
|
Table heading options
|
|
183
209
|
|
|
184
|
-
|
|
210
|
+
_Enum, one of the following possible values:_
|
|
185
211
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
212
|
+
- `'default'`
|
|
213
|
+
- `'description'`
|
|
214
|
+
- `'devDependency'`
|
|
215
|
+
- `'downloads'`
|
|
216
|
+
- `'name'`
|
|
217
|
+
- `'private'`
|
|
218
|
+
- `'required'`
|
|
219
|
+
- `'version'`
|
|
194
220
|
|
|
195
221
|
## Language
|
|
196
222
|
|
|
197
|
-
|
|
223
|
+
_Enum, one of the following possible values:_
|
|
198
224
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
(
|
|
225
|
+
- `'JS'`
|
|
226
|
+
- `'RS'`
|
|
227
|
+
(_optional_)
|
|
202
228
|
|
|
203
|
-
|
|
229
|
+
_Default value:_ `'JS'`
|
|
204
230
|
|
|
205
231
|
## TableHeadings
|
|
206
232
|
|
|
207
233
|
Table heading action configuration
|
|
208
234
|
|
|
209
|
-
|
|
235
|
+
_Object record with dynamic keys:_
|
|
210
236
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
(
|
|
237
|
+
- _keys of type_ [Actions](#actions)
|
|
238
|
+
- _values of type_ _Array of [Headings](#headings) items_ (_optional_)
|
|
239
|
+
(_optional_)
|
|
214
240
|
|
|
215
|
-
|
|
241
|
+
_Default value:_ `{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]}`
|
|
216
242
|
|
|
217
243
|
## Templates
|
|
218
244
|
|
|
219
|
-
|
|
245
|
+
_Object containing the following properties:_
|
|
220
246
|
|
|
221
|
-
| Property | Description | Type | Default
|
|
222
|
-
| :-------------- | :------------------------------------- | :------------------------------------------------------------------------------------- |
|
|
223
|
-
| `downloadImage` | | `string` | `'https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F'`
|
|
224
|
-
| `emojis` | Table heading emojis used when enabled |
|
|
225
|
-
| `registryUrl` | | `string` | `'https://www.npmjs.com/package/{{name}}'`
|
|
226
|
-
| `versionImage` | | `string` | `'https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F'`
|
|
247
|
+
| Property | Description | Type | Default |
|
|
248
|
+
| :-------------- | :------------------------------------- | :------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
|
|
249
|
+
| `downloadImage` | | `string` | `'https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F'` |
|
|
250
|
+
| `emojis` | Table heading emojis used when enabled | _Object with dynamic keys of type_ [Headings](#headings) _and values of type_ `string` | `{"default":"⚙️","description":"📝","devDependency":"💻","downloads":"📥","name":"🏷️","private":"🔒","required":"","version":""}` |
|
|
251
|
+
| `registryUrl` | | `string` | `'https://www.npmjs.com/package/{{name}}'` |
|
|
252
|
+
| `versionImage` | | `string` | `'https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F'` |
|
|
227
253
|
|
|
228
|
-
|
|
254
|
+
_All properties are optional._
|
|
229
255
|
|
|
230
256
|
<!-- ZOD end -->
|
package/config/schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://
|
|
1
|
+
{"$schema":{"default":"https://unpkg.com/@stephansama/auto-readme@0.1.0/config/schema.json","type":"string"},"type":"object","properties":{"affectedRegexes":{"default":[],"type":"array","items":{"type":"string"}},"defaultLanguage":{"alias":"l","description":"Default language to infer projects from","default":"JS","type":"string","enum":["JS","RS"]},"disableEmojis":{"alias":"e","description":"Whether or not to use emojis in markdown table headings","default":false,"type":"boolean"},"disableMarkdownHeadings":{"description":"Whether or not to display markdown headings","default":false,"type":"boolean"},"enableToc":{"alias":"t","description":"generate table of contents for readmes","default":false,"type":"boolean"},"enableUsage":{"description":"Whether or not to enable usage plugin","default":false,"type":"boolean"},"headings":{"description":"List of headings for different table outputs","default":{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]},"type":"object","propertyNames":{"description":"Comment action options","type":"string","enum":["ACTION","PKG","USAGE","WORKSPACE","ZOD"]},"additionalProperties":{"type":"array","items":{"description":"Table heading options","type":"string","enum":["default","description","devDependency","downloads","name","private","required","version"]}}},"onlyReadmes":{"alias":"r","description":"Whether or not to only traverse readmes","default":true,"type":"boolean"},"onlyShowPublicPackages":{"alias":"p","description":"Only show public packages in workspaces","default":false,"type":"boolean"},"removeScope":{"description":"Remove common workspace scope","default":"","type":"string"},"templates":{"description":"Handlebars templates used to fuel list and table generation","default":{"downloadImage":"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F","emojis":{"default":"⚙️","description":"📝","devDependency":"💻","downloads":"📥","name":"🏷️","private":"🔒","required":"","version":""},"registryUrl":"https://www.npmjs.com/package/{{name}}","versionImage":"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F"},"type":"object","properties":{"downloadImage":{"default":"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F","type":"string"},"emojis":{"default":{"default":"⚙️","description":"📝","devDependency":"💻","downloads":"📥","name":"🏷️","private":"🔒","required":"","version":""},"description":"Table heading emojis used when enabled","type":"object","propertyNames":{"description":"Table heading options","type":"string","enum":["default","description","devDependency","downloads","name","private","required","version"]},"additionalProperties":{"type":"string"}},"registryUrl":{"default":"https://www.npmjs.com/package/{{name}}","type":"string"},"versionImage":{"default":"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F","type":"string"}},"required":["downloadImage","emojis","registryUrl","versionImage"],"additionalProperties":false},"tocHeading":{"description":"Markdown heading used to generate table of contents","default":"Table of contents","type":"string"},"usageFile":{"description":"Workspace level usage file","default":"","type":"string"},"usageHeading":{"description":"Markdown heading used to generate usage example","default":"Usage","type":"string"},"verbose":{"alias":"v","description":"whether or not to display verbose logging","default":false,"type":"boolean"}},"required":["affectedRegexes","defaultLanguage","disableEmojis","disableMarkdownHeadings","enableToc","enableUsage","headings","onlyReadmes","onlyShowPublicPackages","removeScope","templates","tocHeading","usageFile","usageHeading","verbose"],"additionalProperties":false}
|
package/config/schema.yaml
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -235,12 +235,16 @@ function isComment(comment) {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
// src/config.ts
|
|
238
|
+
var import_toml = __toESM(require("@iarna/toml"), 1);
|
|
238
239
|
var import_cosmiconfig = require("cosmiconfig");
|
|
239
240
|
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
241
|
+
var moduleName = "autoreadme";
|
|
242
|
+
var searchPlaces = getSearchPlaces();
|
|
243
|
+
var loaders = { [".toml"]: loadToml };
|
|
240
244
|
async function loadConfig(args2) {
|
|
241
|
-
const opts2 = {};
|
|
245
|
+
const opts2 = { loaders, searchPlaces };
|
|
242
246
|
if (args2.config) opts2.searchPlaces = [args2.config];
|
|
243
|
-
const explorer = (0, import_cosmiconfig.cosmiconfig)(
|
|
247
|
+
const explorer = (0, import_cosmiconfig.cosmiconfig)(moduleName, opts2);
|
|
244
248
|
const search = await explorer.search();
|
|
245
249
|
if (!search) {
|
|
246
250
|
const location = args2.config ? " at location: " + args2.config : "";
|
|
@@ -258,6 +262,21 @@ async function loadConfig(args2) {
|
|
|
258
262
|
})
|
|
259
263
|
);
|
|
260
264
|
}
|
|
265
|
+
function loadToml(_filepath, content) {
|
|
266
|
+
return import_toml.default.parse(content);
|
|
267
|
+
}
|
|
268
|
+
function getSearchPlaces() {
|
|
269
|
+
return [
|
|
270
|
+
...(0, import_cosmiconfig.getDefaultSearchPlaces)(moduleName),
|
|
271
|
+
`.${moduleName}rc.toml`,
|
|
272
|
+
`.config/.${moduleName}rc`,
|
|
273
|
+
`.config/${moduleName}rc.toml`,
|
|
274
|
+
`.config/.${moduleName}rc.toml`,
|
|
275
|
+
`.config/.${moduleName}rc.json`,
|
|
276
|
+
`.config/.${moduleName}rc.yaml`,
|
|
277
|
+
`.config/.${moduleName}rc.yml`
|
|
278
|
+
];
|
|
279
|
+
}
|
|
261
280
|
function removeFalsy(obj) {
|
|
262
281
|
return Object.fromEntries(
|
|
263
282
|
Object.entries(obj).map(([k, v]) => !v ? false : [k, v]).filter((e) => Boolean(e))
|
|
@@ -666,7 +685,13 @@ async function run() {
|
|
|
666
685
|
await fsp3.writeFile(path5, content);
|
|
667
686
|
})
|
|
668
687
|
);
|
|
669
|
-
|
|
688
|
+
const opts2 = { stdio: "inherit" };
|
|
689
|
+
INFO("formatting with prettier");
|
|
690
|
+
cp2.execFileSync("prettier", ["--write", ...paths], opts2);
|
|
691
|
+
if (isAffected) {
|
|
692
|
+
INFO("adding affected files to git stage");
|
|
693
|
+
cp2.execFileSync("git", ["add", ...paths], opts2);
|
|
694
|
+
}
|
|
670
695
|
if (spinner) spinner.stop();
|
|
671
696
|
}
|
|
672
697
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/log.ts","../src/schema.js","../src/comment.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tif (isAffected) cp.execFileSync(\"git\", [\"add\", ...paths]);\n\n\tif (spinner) spinner.stop();\n}\n","import yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { setVerbosity } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\"affectedRegexes\", \"templates\", \"headings\"] as const;\n\ntype ComplexOptions = (typeof complexOptions)[number];\n\nconst args = {\n\t...zodToYargs(),\n\tchanges: {\n\t\talias: \"g\",\n\t\tdefault: false,\n\t\tdescription: \"Check only changed git files\",\n\t\ttype: \"boolean\",\n\t},\n\tcheck: {\n\t\talias: \"k\",\n\t\tdefault: false,\n\t\tdescription: \"Do not write to files. Only check for changes\",\n\t\ttype: \"boolean\",\n\t},\n\tconfig: { alias: \"c\", description: \"Path to config file\", type: \"string\" },\n} satisfies Record<string, Options>;\n\nexport async function parseArgs() {\n\tconst yargsInstance = yargs(hideBin(process.argv))\n\t\t.options(args)\n\t\t.help(\"h\")\n\t\t.alias(\"h\", \"help\")\n\t\t.epilogue(`--> @stephansama open-source ${new Date().getFullYear()}`);\n\n\tconst parsed = await yargsInstance\n\t\t.wrap(yargsInstance.terminalWidth())\n\t\t.parse();\n\n\tif (parsed.verbose) setVerbosity(1);\n\n\treturn parsed;\n}\n\nexport function zodToYargs(): Omit<\n\tRecord<keyof typeof shape, Options>,\n\tComplexOptions\n> {\n\tconst { shape } = configSchema.unwrap();\n\tconst entries = Object.entries(shape).map(([key, value]) => {\n\t\tif (complexOptions.includes(key as ComplexOptions)) return [];\n\t\tif (value.def.innerType instanceof z.ZodObject) return [];\n\t\tconst meta = value.meta();\n\t\tconst { innerType } = value.def;\n\t\tconst isBoolean = innerType instanceof z.ZodBoolean;\n\t\tconst isNumber = innerType instanceof z.ZodNumber;\n\t\tconst isArray = innerType instanceof z.ZodArray;\n\n\t\tconst yargType: Options[\"type\"] =\n\t\t\t(isArray && \"array\") ||\n\t\t\t(isNumber && \"number\") ||\n\t\t\t(isBoolean && \"boolean\") ||\n\t\t\t\"string\";\n\n\t\tconst options: Options = {\n\t\t\tdefault: value.def.defaultValue,\n\t\t\ttype: yargType,\n\t\t};\n\n\t\tif (meta?.alias) options.alias = meta.alias as string;\n\t\tif (meta?.description) options.description = meta.description;\n\n\t\treturn [key, options];\n\t});\n\n\treturn Object.fromEntries(entries);\n}\n","import chalk from \"chalk\";\n\nlet verbosity = 0;\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tconsole.error(chalk.red(first), ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.info(chalk.blue(first), ...remaining);\n}\n\nexport function setVerbosity(input: number) {\n\tverbosity = input;\n}\n\nexport function WARN(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.warn(chalk.yellow(first), ...remaining);\n}\n","import { z } from \"zod\";\n\nexport const actionsSchema = z\n\t.enum([\"ACTION\", \"PKG\", \"USAGE\", \"WORKSPACE\", \"ZOD\"])\n\t.describe(\"Comment action options\");\n\nexport const formatsSchema = z\n\t.enum([\"LIST\", \"TABLE\"])\n\t.default(\"TABLE\")\n\t.optional();\n\nexport const languageSchema = z.enum([\"JS\", \"RS\"]).optional().default(\"JS\");\n\nexport const headingsSchema = z\n\t.enum([\n\t\t\"default\",\n\t\t\"description\",\n\t\t\"devDependency\",\n\t\t\"downloads\",\n\t\t\"name\",\n\t\t\"private\",\n\t\t\"required\",\n\t\t\"version\",\n\t])\n\t.describe(\"Table heading options\");\n\nexport const tableHeadingsSchema = z\n\t.record(actionsSchema, headingsSchema.array().optional())\n\t.optional()\n\t.describe(\"Table heading action configuration\")\n\t.default({\n\t\tACTION: [\"name\", \"required\", \"default\", \"description\"],\n\t\tPKG: [\"name\", \"version\", \"devDependency\"],\n\t\tWORKSPACE: [\"name\", \"version\", \"downloads\", \"description\"],\n\t\tZOD: [],\n\t});\n\nexport const templatesSchema = z.object({\n\tdownloadImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F\"),\n\temojis: z\n\t\t.record(headingsSchema, z.string())\n\t\t.optional()\n\t\t.describe(\"Table heading emojis used when enabled\")\n\t\t.default({\n\t\t\tdefault: \"⚙️\",\n\t\t\tdescription: \"📝\",\n\t\t\tdevDependency: \"💻\",\n\t\t\tdownloads: \"📥\",\n\t\t\tname: \"🏷️\",\n\t\t\tprivate: \"🔒\",\n\t\t\trequired: \"\",\n\t\t\tversion: \"\",\n\t\t}),\n\tregistryUrl: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://www.npmjs.com/package/{{name}}\"),\n\tversionImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\n\t\t\t\"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F\",\n\t\t),\n});\n\nexport const defaultTemplates = templatesSchema.parse({});\nexport const defaultTableHeadings = tableHeadingsSchema.parse(undefined);\n\nconst _configSchema = z.object({\n\taffectedRegexes: z.string().array().optional().default([]),\n\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { Root } from \"mdast\";\n\nimport { INFO } from \"./log\";\nimport { actionsSchema, formatsSchema, languageSchema } from \"./schema\";\n\nexport const SEPARATOR = \"-\" as const;\n\nexport type AstComments = ReturnType<typeof loadAstComments>;\n\nexport function loadAstComments(root: Root) {\n\treturn root.children\n\t\t.map((child) => child.type === \"html\" && getComment(child.value))\n\t\t.filter((f): f is ReturnType<typeof parseComment> => f !== false);\n}\n\nexport function parseComment(comment: string) {\n\tconst input = trimComment(comment);\n\tconst [type, ...parameters] = input.split(\" \");\n\tconst [first, second, third] = type.split(SEPARATOR);\n\n\tINFO(\"parsing inputs\", { first, second, third });\n\n\tconst languageInput = third ? first : undefined;\n\tconst actionInput = third ? second : first;\n\tconst formatInput = third ? third : second;\n\tconst language = languageSchema.parse(languageInput);\n\tconst action = actionsSchema.parse(actionInput);\n\tconst format = formatsSchema.parse(formatInput);\n\tconst isStart = comment.includes(\"start\");\n\tconst parsed = { action, format, isStart, language, parameters };\n\n\tINFO(`Parsed comment ${comment}`, parsed);\n\n\treturn parsed;\n}\n\nconst startComment = \"<!--\";\nconst endComment = \"-->\";\n\nexport function trimComment(comment: string) {\n\treturn comment\n\t\t.replace(startComment, \"\")\n\t\t.replace(/start|end/, \"\")\n\t\t.replace(endComment, \"\")\n\t\t.trim();\n}\n\nfunction getComment(comment: string) {\n\treturn isComment(comment) && parseComment(comment);\n}\n\nfunction isComment(comment: string) {\n\treturn comment.startsWith(startComment) && comment.endsWith(endComment);\n}\n","import { cosmiconfig, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = {};\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(\"autoreadme\", opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { createFindParameter } from \"./data\";\nimport { INFO, WARN } from \"./log\";\nimport { autoReadmeRemarkPlugin } from \"./plugin\";\nimport { fileExists } from \"./utils\";\n\nexport async function parse(\n\tfile: string,\n\tfilepath: string,\n\troot: string,\n\tconfig: Config,\n\tdata: ActionData,\n) {\n\tconst pipeline = remark().use(autoReadmeRemarkPlugin, config, data);\n\tconst usage = data.find((d) => d.action === \"USAGE\");\n\n\tif (usage?.action === \"USAGE\" || config.enableUsage) {\n\t\tconst find = createFindParameter(usage?.parameters || []);\n\t\tconst examplePath = find(\"path\");\n\t\tconst dirname = path.dirname(filepath);\n\t\tconst resolvePath = examplePath && path.resolve(dirname, examplePath);\n\t\tconst relativeProjectPath =\n\t\t\tconfig.usageFile &&\n\t\t\tpath.relative(root, path.resolve(dirname, config.usageFile));\n\t\tconst example =\n\t\t\t(examplePath && resolvePath && path.relative(root, resolvePath)) ||\n\t\t\trelativeProjectPath ||\n\t\t\tundefined;\n\n\t\tif (await fileExists(example || \"\")) {\n\t\t\tINFO(\"generating usage section\");\n\t\t\tpipeline.use(remarkUsage, {\n\t\t\t\texample,\n\t\t\t\theading: config.usageHeading,\n\t\t\t});\n\t\t} else {\n\t\t\tWARN(\"not able to find example file for readme\", filepath, example);\n\t\t}\n\t}\n\n\tif (config.enableToc) {\n\t\tINFO(\"generating table of contents section\");\n\t\tpipeline\n\t\t\t.use(remarkToc, { heading: config.tocHeading })\n\t\t\t.use(remarkCollapse, { test: config.tocHeading });\n\t}\n\n\tconst vfile = await pipeline.process(file);\n\treturn vfile.toString();\n}\n","import type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mCAA6B;AAC7B,IAAAC,MAAoB;AACpB,IAAAC,OAAqB;AACrB,iBAAgB;;;ACHhB,mBAAoC;AACpC,qBAAwB;AACxB,IAAAC,cAAc;;;ACFd,mBAAkB;AAElB,IAAI,YAAY;AAET,SAAS,SAAS,MAAiB;AACzC,QAAM,CAAC,OAAO,GAAG,SAAS,IAAI;AAC9B,UAAQ,MAAM,aAAAC,QAAM,IAAI,KAAK,GAAG,GAAG,SAAS;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M,UAAU,MAAMC,OAAM,MAAMD,OAAM,MAAM,QAAQ,IAAI;AAC1D,YAAU,eAAUA,OAAM,OAAO;AAAA,IAClC,CAAC;AAAA,EACF;AAEA,MAAI,WAAY,CAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;AAExD,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["import_mdast_util_from_markdown","cp","fsp","import_zod","chalk","yargs","z","args","opts","deepmerge","fs","fsp","path","glob","path","body","value","ast","heading","path","Handlebars","parse","dirname","remarkUsage","remarkToc","remarkCollapse","args","ora","path","parse"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/log.ts","../src/schema.js","../src/comment.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tconst opts: cp.CommonExecOptions = { stdio: \"inherit\" };\n\n\tINFO(\"formatting with prettier\");\n\n\tcp.execFileSync(\"prettier\", [\"--write\", ...paths], opts);\n\n\tif (isAffected) {\n\t\tINFO(\"adding affected files to git stage\");\n\n\t\tcp.execFileSync(\"git\", [\"add\", ...paths], opts);\n\t}\n\n\tif (spinner) spinner.stop();\n}\n","import yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { setVerbosity } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\"affectedRegexes\", \"templates\", \"headings\"] as const;\n\ntype ComplexOptions = (typeof complexOptions)[number];\n\nconst args = {\n\t...zodToYargs(),\n\tchanges: {\n\t\talias: \"g\",\n\t\tdefault: false,\n\t\tdescription: \"Check only changed git files\",\n\t\ttype: \"boolean\",\n\t},\n\tcheck: {\n\t\talias: \"k\",\n\t\tdefault: false,\n\t\tdescription: \"Do not write to files. Only check for changes\",\n\t\ttype: \"boolean\",\n\t},\n\tconfig: { alias: \"c\", description: \"Path to config file\", type: \"string\" },\n} satisfies Record<string, Options>;\n\nexport async function parseArgs() {\n\tconst yargsInstance = yargs(hideBin(process.argv))\n\t\t.options(args)\n\t\t.help(\"h\")\n\t\t.alias(\"h\", \"help\")\n\t\t.epilogue(`--> @stephansama open-source ${new Date().getFullYear()}`);\n\n\tconst parsed = await yargsInstance\n\t\t.wrap(yargsInstance.terminalWidth())\n\t\t.parse();\n\n\tif (parsed.verbose) setVerbosity(1);\n\n\treturn parsed;\n}\n\nexport function zodToYargs(): Omit<\n\tRecord<keyof typeof shape, Options>,\n\tComplexOptions\n> {\n\tconst { shape } = configSchema.unwrap();\n\tconst entries = Object.entries(shape).map(([key, value]) => {\n\t\tif (complexOptions.includes(key as ComplexOptions)) return [];\n\t\tif (value.def.innerType instanceof z.ZodObject) return [];\n\t\tconst meta = value.meta();\n\t\tconst { innerType } = value.def;\n\t\tconst isBoolean = innerType instanceof z.ZodBoolean;\n\t\tconst isNumber = innerType instanceof z.ZodNumber;\n\t\tconst isArray = innerType instanceof z.ZodArray;\n\n\t\tconst yargType: Options[\"type\"] =\n\t\t\t(isArray && \"array\") ||\n\t\t\t(isNumber && \"number\") ||\n\t\t\t(isBoolean && \"boolean\") ||\n\t\t\t\"string\";\n\n\t\tconst options: Options = {\n\t\t\tdefault: value.def.defaultValue,\n\t\t\ttype: yargType,\n\t\t};\n\n\t\tif (meta?.alias) options.alias = meta.alias as string;\n\t\tif (meta?.description) options.description = meta.description;\n\n\t\treturn [key, options];\n\t});\n\n\treturn Object.fromEntries(entries);\n}\n","import chalk from \"chalk\";\n\nlet verbosity = 0;\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tconsole.error(chalk.red(first), ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.info(chalk.blue(first), ...remaining);\n}\n\nexport function setVerbosity(input: number) {\n\tverbosity = input;\n}\n\nexport function WARN(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.warn(chalk.yellow(first), ...remaining);\n}\n","import { z } from \"zod\";\n\nexport const actionsSchema = z\n\t.enum([\"ACTION\", \"PKG\", \"USAGE\", \"WORKSPACE\", \"ZOD\"])\n\t.describe(\"Comment action options\");\n\nexport const formatsSchema = z\n\t.enum([\"LIST\", \"TABLE\"])\n\t.default(\"TABLE\")\n\t.optional();\n\nexport const languageSchema = z.enum([\"JS\", \"RS\"]).optional().default(\"JS\");\n\nexport const headingsSchema = z\n\t.enum([\n\t\t\"default\",\n\t\t\"description\",\n\t\t\"devDependency\",\n\t\t\"downloads\",\n\t\t\"name\",\n\t\t\"private\",\n\t\t\"required\",\n\t\t\"version\",\n\t])\n\t.describe(\"Table heading options\");\n\nexport const tableHeadingsSchema = z\n\t.record(actionsSchema, headingsSchema.array().optional())\n\t.optional()\n\t.describe(\"Table heading action configuration\")\n\t.default({\n\t\tACTION: [\"name\", \"required\", \"default\", \"description\"],\n\t\tPKG: [\"name\", \"version\", \"devDependency\"],\n\t\tWORKSPACE: [\"name\", \"version\", \"downloads\", \"description\"],\n\t\tZOD: [],\n\t});\n\nexport const templatesSchema = z.object({\n\tdownloadImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F\"),\n\temojis: z\n\t\t.record(headingsSchema, z.string())\n\t\t.optional()\n\t\t.describe(\"Table heading emojis used when enabled\")\n\t\t.default({\n\t\t\tdefault: \"⚙️\",\n\t\t\tdescription: \"📝\",\n\t\t\tdevDependency: \"💻\",\n\t\t\tdownloads: \"📥\",\n\t\t\tname: \"🏷️\",\n\t\t\tprivate: \"🔒\",\n\t\t\trequired: \"\",\n\t\t\tversion: \"\",\n\t\t}),\n\tregistryUrl: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://www.npmjs.com/package/{{name}}\"),\n\tversionImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\n\t\t\t\"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F\",\n\t\t),\n});\n\nexport const defaultTemplates = templatesSchema.parse({});\nexport const defaultTableHeadings = tableHeadingsSchema.parse(undefined);\n\nconst _configSchema = z.object({\n\taffectedRegexes: z.string().array().optional().default([]),\n\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { Root } from \"mdast\";\n\nimport { INFO } from \"./log\";\nimport { actionsSchema, formatsSchema, languageSchema } from \"./schema\";\n\nexport const SEPARATOR = \"-\" as const;\n\nexport type AstComments = ReturnType<typeof loadAstComments>;\n\nexport function loadAstComments(root: Root) {\n\treturn root.children\n\t\t.map((child) => child.type === \"html\" && getComment(child.value))\n\t\t.filter((f): f is ReturnType<typeof parseComment> => f !== false);\n}\n\nexport function parseComment(comment: string) {\n\tconst input = trimComment(comment);\n\tconst [type, ...parameters] = input.split(\" \");\n\tconst [first, second, third] = type.split(SEPARATOR);\n\n\tINFO(\"parsing inputs\", { first, second, third });\n\n\tconst languageInput = third ? first : undefined;\n\tconst actionInput = third ? second : first;\n\tconst formatInput = third ? third : second;\n\tconst language = languageSchema.parse(languageInput);\n\tconst action = actionsSchema.parse(actionInput);\n\tconst format = formatsSchema.parse(formatInput);\n\tconst isStart = comment.includes(\"start\");\n\tconst parsed = { action, format, isStart, language, parameters };\n\n\tINFO(`Parsed comment ${comment}`, parsed);\n\n\treturn parsed;\n}\n\nconst startComment = \"<!--\";\nconst endComment = \"-->\";\n\nexport function trimComment(comment: string) {\n\treturn comment\n\t\t.replace(startComment, \"\")\n\t\t.replace(/start|end/, \"\")\n\t\t.replace(endComment, \"\")\n\t\t.trim();\n}\n\nfunction getComment(comment: string) {\n\treturn isComment(comment) && parseComment(comment);\n}\n\nfunction isComment(comment: string) {\n\treturn comment.startsWith(startComment) && comment.endsWith(endComment);\n}\n","import toml from \"@iarna/toml\";\nimport { cosmiconfig, getDefaultSearchPlaces, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nconst moduleName = \"autoreadme\";\n\nconst searchPlaces = getSearchPlaces();\n\nconst loaders = { [\".toml\"]: loadToml };\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = { loaders, searchPlaces };\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(moduleName, opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function loadToml(_filepath: string, content: string) {\n\treturn toml.parse(content);\n}\n\nfunction getSearchPlaces() {\n\treturn [\n\t\t...getDefaultSearchPlaces(moduleName),\n\t\t`.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc`,\n\t\t`.config/${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.json`,\n\t\t`.config/.${moduleName}rc.yaml`,\n\t\t`.config/.${moduleName}rc.yml`,\n\t];\n}\n\nfunction removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { createFindParameter } from \"./data\";\nimport { INFO, WARN } from \"./log\";\nimport { autoReadmeRemarkPlugin } from \"./plugin\";\nimport { fileExists } from \"./utils\";\n\nexport async function parse(\n\tfile: string,\n\tfilepath: string,\n\troot: string,\n\tconfig: Config,\n\tdata: ActionData,\n) {\n\tconst pipeline = remark().use(autoReadmeRemarkPlugin, config, data);\n\tconst usage = data.find((d) => d.action === \"USAGE\");\n\n\tif (usage?.action === \"USAGE\" || config.enableUsage) {\n\t\tconst find = createFindParameter(usage?.parameters || []);\n\t\tconst examplePath = find(\"path\");\n\t\tconst dirname = path.dirname(filepath);\n\t\tconst resolvePath = examplePath && path.resolve(dirname, examplePath);\n\t\tconst relativeProjectPath =\n\t\t\tconfig.usageFile &&\n\t\t\tpath.relative(root, path.resolve(dirname, config.usageFile));\n\t\tconst example =\n\t\t\t(examplePath && resolvePath && path.relative(root, resolvePath)) ||\n\t\t\trelativeProjectPath ||\n\t\t\tundefined;\n\n\t\tif (await fileExists(example || \"\")) {\n\t\t\tINFO(\"generating usage section\");\n\t\t\tpipeline.use(remarkUsage, {\n\t\t\t\texample,\n\t\t\t\theading: config.usageHeading,\n\t\t\t});\n\t\t} else {\n\t\t\tWARN(\"not able to find example file for readme\", filepath, example);\n\t\t}\n\t}\n\n\tif (config.enableToc) {\n\t\tINFO(\"generating table of contents section\");\n\t\tpipeline\n\t\t\t.use(remarkToc, { heading: config.tocHeading })\n\t\t\t.use(remarkCollapse, { test: config.tocHeading });\n\t}\n\n\tconst vfile = await pipeline.process(file);\n\treturn vfile.toString();\n}\n","import type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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MAAM,KAAK,IAAI,CAAC;AAEpD,QAAM,OAAOA,MAAK,cAAc,YAAY;AAE5C,MAAI,CAAC,MAAM,QAAQ;AAClB,WAAO,MAAM,MAAM,UAAU,0BAA0B;AAAA,EACxD;AAEA,QAAM,UAAU,CAACA,MAAK,eAAW,WAAAC,SAAI,YAAY,IAAI,EAAE,EAAE,MAAM;AAE/D,QAAM,QAAQ;AAAA,IACb,MAAM,IAAI,OAAOC,UAAS;AACzB,YAAM,OAAO,MAAU,cAASA,OAAM,EAAE,UAAU,OAAO,CAAC;AAE1D,YAAM,WAAW,MAAM;AACtB,cAAM,UAAM,+CAAa,IAAI;AAC7B,eAAO,gBAAgB,GAAG;AAAA,MAC3B,GAAG;AAEH,UAAI,CAAC,QAAQ,QAAQ;AACpB,aAAK,+BAA+BA,KAAI;AACxC,YAAI,CAAC,OAAO,eAAe,CAAC,OAAO,WAAW;AAC7C,iBAAO,MAAM,4BAA4B;AAAA,QAC1C,OAAO;AACN,eAAK,uCAAuCA,KAAI;AAAA,QACjD;AAAA,MACD;AAEA,YAAM,OAAO,MAAM,eAAe,SAASA,OAAM,IAAI;AAErD,WAAK,8BAA8B,IAAI;AAEvC,YAAM,UAAU,MAAMC,OAAM,MAAMD,OAAM,MAAM,QAAQ,IAAI;AAC1D,YAAU,eAAUA,OAAM,OAAO;AAAA,IAClC,CAAC;AAAA,EACF;AAEA,QAAME,QAA6B,EAAE,OAAO,UAAU;AAEtD,OAAK,0BAA0B;AAE/B,EAAG,iBAAa,YAAY,CAAC,WAAW,GAAG,KAAK,GAAGA,KAAI;AAEvD,MAAI,YAAY;AACf,SAAK,oCAAoC;AAEzC,IAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,GAAGA,KAAI;AAAA,EAC/C;AAEA,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["import_mdast_util_from_markdown","cp","fsp","import_zod","chalk","yargs","z","args","opts","deepmerge","toml","fs","fsp","path","glob","path","body","value","ast","heading","path","Handlebars","parse","dirname","remarkUsage","remarkToc","remarkCollapse","args","ora","path","parse","opts"]}
|
package/dist/index.js
CHANGED
|
@@ -201,12 +201,16 @@ function isComment(comment) {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
// src/config.ts
|
|
204
|
-
import
|
|
204
|
+
import toml from "@iarna/toml";
|
|
205
|
+
import { cosmiconfig, getDefaultSearchPlaces } from "cosmiconfig";
|
|
205
206
|
import deepmerge from "deepmerge";
|
|
207
|
+
var moduleName = "autoreadme";
|
|
208
|
+
var searchPlaces = getSearchPlaces();
|
|
209
|
+
var loaders = { [".toml"]: loadToml };
|
|
206
210
|
async function loadConfig(args2) {
|
|
207
|
-
const opts2 = {};
|
|
211
|
+
const opts2 = { loaders, searchPlaces };
|
|
208
212
|
if (args2.config) opts2.searchPlaces = [args2.config];
|
|
209
|
-
const explorer = cosmiconfig(
|
|
213
|
+
const explorer = cosmiconfig(moduleName, opts2);
|
|
210
214
|
const search = await explorer.search();
|
|
211
215
|
if (!search) {
|
|
212
216
|
const location = args2.config ? " at location: " + args2.config : "";
|
|
@@ -224,6 +228,21 @@ async function loadConfig(args2) {
|
|
|
224
228
|
})
|
|
225
229
|
);
|
|
226
230
|
}
|
|
231
|
+
function loadToml(_filepath, content) {
|
|
232
|
+
return toml.parse(content);
|
|
233
|
+
}
|
|
234
|
+
function getSearchPlaces() {
|
|
235
|
+
return [
|
|
236
|
+
...getDefaultSearchPlaces(moduleName),
|
|
237
|
+
`.${moduleName}rc.toml`,
|
|
238
|
+
`.config/.${moduleName}rc`,
|
|
239
|
+
`.config/${moduleName}rc.toml`,
|
|
240
|
+
`.config/.${moduleName}rc.toml`,
|
|
241
|
+
`.config/.${moduleName}rc.json`,
|
|
242
|
+
`.config/.${moduleName}rc.yaml`,
|
|
243
|
+
`.config/.${moduleName}rc.yml`
|
|
244
|
+
];
|
|
245
|
+
}
|
|
227
246
|
function removeFalsy(obj) {
|
|
228
247
|
return Object.fromEntries(
|
|
229
248
|
Object.entries(obj).map(([k, v]) => !v ? false : [k, v]).filter((e) => Boolean(e))
|
|
@@ -632,7 +651,13 @@ async function run() {
|
|
|
632
651
|
await fsp3.writeFile(path5, content);
|
|
633
652
|
})
|
|
634
653
|
);
|
|
635
|
-
|
|
654
|
+
const opts2 = { stdio: "inherit" };
|
|
655
|
+
INFO("formatting with prettier");
|
|
656
|
+
cp2.execFileSync("prettier", ["--write", ...paths], opts2);
|
|
657
|
+
if (isAffected) {
|
|
658
|
+
INFO("adding affected files to git stage");
|
|
659
|
+
cp2.execFileSync("git", ["add", ...paths], opts2);
|
|
660
|
+
}
|
|
636
661
|
if (spinner) spinner.stop();
|
|
637
662
|
}
|
|
638
663
|
export {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/log.ts","../src/schema.js","../src/comment.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tif (isAffected) cp.execFileSync(\"git\", [\"add\", ...paths]);\n\n\tif (spinner) spinner.stop();\n}\n","import yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { setVerbosity } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\"affectedRegexes\", \"templates\", \"headings\"] as const;\n\ntype ComplexOptions = (typeof complexOptions)[number];\n\nconst args = {\n\t...zodToYargs(),\n\tchanges: {\n\t\talias: \"g\",\n\t\tdefault: false,\n\t\tdescription: \"Check only changed git files\",\n\t\ttype: \"boolean\",\n\t},\n\tcheck: {\n\t\talias: \"k\",\n\t\tdefault: false,\n\t\tdescription: \"Do not write to files. Only check for changes\",\n\t\ttype: \"boolean\",\n\t},\n\tconfig: { alias: \"c\", description: \"Path to config file\", type: \"string\" },\n} satisfies Record<string, Options>;\n\nexport async function parseArgs() {\n\tconst yargsInstance = yargs(hideBin(process.argv))\n\t\t.options(args)\n\t\t.help(\"h\")\n\t\t.alias(\"h\", \"help\")\n\t\t.epilogue(`--> @stephansama open-source ${new Date().getFullYear()}`);\n\n\tconst parsed = await yargsInstance\n\t\t.wrap(yargsInstance.terminalWidth())\n\t\t.parse();\n\n\tif (parsed.verbose) setVerbosity(1);\n\n\treturn parsed;\n}\n\nexport function zodToYargs(): Omit<\n\tRecord<keyof typeof shape, Options>,\n\tComplexOptions\n> {\n\tconst { shape } = configSchema.unwrap();\n\tconst entries = Object.entries(shape).map(([key, value]) => {\n\t\tif (complexOptions.includes(key as ComplexOptions)) return [];\n\t\tif (value.def.innerType instanceof z.ZodObject) return [];\n\t\tconst meta = value.meta();\n\t\tconst { innerType } = value.def;\n\t\tconst isBoolean = innerType instanceof z.ZodBoolean;\n\t\tconst isNumber = innerType instanceof z.ZodNumber;\n\t\tconst isArray = innerType instanceof z.ZodArray;\n\n\t\tconst yargType: Options[\"type\"] =\n\t\t\t(isArray && \"array\") ||\n\t\t\t(isNumber && \"number\") ||\n\t\t\t(isBoolean && \"boolean\") ||\n\t\t\t\"string\";\n\n\t\tconst options: Options = {\n\t\t\tdefault: value.def.defaultValue,\n\t\t\ttype: yargType,\n\t\t};\n\n\t\tif (meta?.alias) options.alias = meta.alias as string;\n\t\tif (meta?.description) options.description = meta.description;\n\n\t\treturn [key, options];\n\t});\n\n\treturn Object.fromEntries(entries);\n}\n","import chalk from \"chalk\";\n\nlet verbosity = 0;\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tconsole.error(chalk.red(first), ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.info(chalk.blue(first), ...remaining);\n}\n\nexport function setVerbosity(input: number) {\n\tverbosity = input;\n}\n\nexport function WARN(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.warn(chalk.yellow(first), ...remaining);\n}\n","import { z } from \"zod\";\n\nexport const actionsSchema = z\n\t.enum([\"ACTION\", \"PKG\", \"USAGE\", \"WORKSPACE\", \"ZOD\"])\n\t.describe(\"Comment action options\");\n\nexport const formatsSchema = z\n\t.enum([\"LIST\", \"TABLE\"])\n\t.default(\"TABLE\")\n\t.optional();\n\nexport const languageSchema = z.enum([\"JS\", \"RS\"]).optional().default(\"JS\");\n\nexport const headingsSchema = z\n\t.enum([\n\t\t\"default\",\n\t\t\"description\",\n\t\t\"devDependency\",\n\t\t\"downloads\",\n\t\t\"name\",\n\t\t\"private\",\n\t\t\"required\",\n\t\t\"version\",\n\t])\n\t.describe(\"Table heading options\");\n\nexport const tableHeadingsSchema = z\n\t.record(actionsSchema, headingsSchema.array().optional())\n\t.optional()\n\t.describe(\"Table heading action configuration\")\n\t.default({\n\t\tACTION: [\"name\", \"required\", \"default\", \"description\"],\n\t\tPKG: [\"name\", \"version\", \"devDependency\"],\n\t\tWORKSPACE: [\"name\", \"version\", \"downloads\", \"description\"],\n\t\tZOD: [],\n\t});\n\nexport const templatesSchema = z.object({\n\tdownloadImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F\"),\n\temojis: z\n\t\t.record(headingsSchema, z.string())\n\t\t.optional()\n\t\t.describe(\"Table heading emojis used when enabled\")\n\t\t.default({\n\t\t\tdefault: \"⚙️\",\n\t\t\tdescription: \"📝\",\n\t\t\tdevDependency: \"💻\",\n\t\t\tdownloads: \"📥\",\n\t\t\tname: \"🏷️\",\n\t\t\tprivate: \"🔒\",\n\t\t\trequired: \"\",\n\t\t\tversion: \"\",\n\t\t}),\n\tregistryUrl: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://www.npmjs.com/package/{{name}}\"),\n\tversionImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\n\t\t\t\"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F\",\n\t\t),\n});\n\nexport const defaultTemplates = templatesSchema.parse({});\nexport const defaultTableHeadings = tableHeadingsSchema.parse(undefined);\n\nconst _configSchema = z.object({\n\taffectedRegexes: z.string().array().optional().default([]),\n\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { Root } from \"mdast\";\n\nimport { INFO } from \"./log\";\nimport { actionsSchema, formatsSchema, languageSchema } from \"./schema\";\n\nexport const SEPARATOR = \"-\" as const;\n\nexport type AstComments = ReturnType<typeof loadAstComments>;\n\nexport function loadAstComments(root: Root) {\n\treturn root.children\n\t\t.map((child) => child.type === \"html\" && getComment(child.value))\n\t\t.filter((f): f is ReturnType<typeof parseComment> => f !== false);\n}\n\nexport function parseComment(comment: string) {\n\tconst input = trimComment(comment);\n\tconst [type, ...parameters] = input.split(\" \");\n\tconst [first, second, third] = type.split(SEPARATOR);\n\n\tINFO(\"parsing inputs\", { first, second, third });\n\n\tconst languageInput = third ? first : undefined;\n\tconst actionInput = third ? second : first;\n\tconst formatInput = third ? third : second;\n\tconst language = languageSchema.parse(languageInput);\n\tconst action = actionsSchema.parse(actionInput);\n\tconst format = formatsSchema.parse(formatInput);\n\tconst isStart = comment.includes(\"start\");\n\tconst parsed = { action, format, isStart, language, parameters };\n\n\tINFO(`Parsed comment ${comment}`, parsed);\n\n\treturn parsed;\n}\n\nconst startComment = \"<!--\";\nconst endComment = \"-->\";\n\nexport function trimComment(comment: string) {\n\treturn comment\n\t\t.replace(startComment, \"\")\n\t\t.replace(/start|end/, \"\")\n\t\t.replace(endComment, \"\")\n\t\t.trim();\n}\n\nfunction getComment(comment: string) {\n\treturn isComment(comment) && parseComment(comment);\n}\n\nfunction isComment(comment: string) {\n\treturn comment.startsWith(startComment) && comment.endsWith(endComment);\n}\n","import { cosmiconfig, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = {};\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(\"autoreadme\", opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { createFindParameter } from \"./data\";\nimport { INFO, WARN } from \"./log\";\nimport { autoReadmeRemarkPlugin } from \"./plugin\";\nimport { fileExists } from \"./utils\";\n\nexport async function parse(\n\tfile: string,\n\tfilepath: string,\n\troot: string,\n\tconfig: Config,\n\tdata: ActionData,\n) {\n\tconst pipeline = remark().use(autoReadmeRemarkPlugin, config, data);\n\tconst usage = data.find((d) => d.action === \"USAGE\");\n\n\tif (usage?.action === \"USAGE\" || config.enableUsage) {\n\t\tconst find = createFindParameter(usage?.parameters || []);\n\t\tconst examplePath = find(\"path\");\n\t\tconst dirname = path.dirname(filepath);\n\t\tconst resolvePath = examplePath && path.resolve(dirname, examplePath);\n\t\tconst relativeProjectPath =\n\t\t\tconfig.usageFile &&\n\t\t\tpath.relative(root, path.resolve(dirname, config.usageFile));\n\t\tconst example =\n\t\t\t(examplePath && resolvePath && path.relative(root, resolvePath)) ||\n\t\t\trelativeProjectPath ||\n\t\t\tundefined;\n\n\t\tif (await fileExists(example || \"\")) {\n\t\t\tINFO(\"generating usage section\");\n\t\t\tpipeline.use(remarkUsage, {\n\t\t\t\texample,\n\t\t\t\theading: config.usageHeading,\n\t\t\t});\n\t\t} else {\n\t\t\tWARN(\"not able to find example file for readme\", filepath, example);\n\t\t}\n\t}\n\n\tif (config.enableToc) {\n\t\tINFO(\"generating table of contents section\");\n\t\tpipeline\n\t\t\t.use(remarkToc, { heading: config.tocHeading })\n\t\t\t.use(remarkCollapse, { test: config.tocHeading });\n\t}\n\n\tconst vfile = await pipeline.process(file);\n\treturn vfile.toString();\n}\n","import type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";AAAA,SAAS,gBAAAA,qBAAoB;AAC7B,YAAYC,SAAQ;AACpB,YAAYC,UAAS;AACrB,OAAO,SAAS;;;ACHhB,OAAO,WAA6B;AACpC,SAAS,eAAe;AACxB,OAAOC,QAAO;;;ACFd,OAAO,WAAW;AAElB,IAAI,YAAY;AAET,SAAS,SAAS,MAAiB;AACzC,QAAM,CAAC,OAAO,GAAG,SAAS,IAAI;AAC9B,UAAQ,MAAM,MAAM,IAAI,KAAK,GAAG,GAAG,SAAS;AAC7C;AAEO,SAAS,QAAQ,MAAiB;AACxC,MAAI,YAAY,EAAG;AACnB,QAAM,CAAC,OAAO,GAAG,SAAS,IAAI;AAC9B,UAAQ,KAAK,MAAM,KAAK,KAAK,GAAG,GAAG,SAAS;AAC7C;AAEO,SAAS,aAAa,OAAe;AAC3C,cAAY;AACb;AAEO,SAAS,QAAQ,MAAiB;AACxC,MAAI,YAAY,EAAG;A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D,QAAM,OAAO,WAAW;AAExB,QAAM,aAAaA,MAAK,UAAU,aAAa;AAE/C,OAAK,WAAW,CAAC,aAAa,SAAS,WAAW,OAAO;AAEzD,QAAM,QAAQ,aACX,sBAAsB,MAAM,MAAM,IAClC,MAAM,iBAAiB,MAAM,MAAM;AAEtC,OAAK,+BAA+B,MAAM,KAAK,IAAI,CAAC;AAEpD,QAAM,OAAOA,MAAK,cAAc,YAAY;AAE5C,MAAI,CAAC,MAAM,QAAQ;AAClB,WAAO,MAAM,MAAM,UAAU,0BAA0B;AAAA,EACxD;AAEA,QAAM,UAAU,CAACA,MAAK,WAAW,IAAI,YAAY,IAAI,EAAE,EAAE,MAAM;AAE/D,QAAM,QAAQ;AAAA,IACb,MAAM,IAAI,OAAOC,UAAS;AACzB,YAAM,OAAO,MAAU,cAASA,OAAM,EAAE,UAAU,OAAO,CAAC;AAE1D,YAAM,WAAW,MAAM;AACtB,cAAM,MAAMC,cAAa,IAAI;AAC7B,eAAO,gBAAgB,GAAG;AAAA,MAC3B,GAAG;AAEH,UAAI,CAAC,QAAQ,QAAQ;AACpB,aAAK,+BAA+BD,KAAI;AACxC,YAAI,CAAC,OAAO,eAAe,CAAC,OAAO,WAAW;AAC7C,iBAAO,MAAM,4BAA4B;AAAA,QAC1C,OAAO;AACN,eAAK,uCAAuCA,KAAI;AAAA,QACjD;AAAA,MACD;AAEA,YAAM,OAAO,MAAM,eAAe,SAASA,OAAM,IAAI;AAErD,WAAK,8BAA8B,IAAI;AAEvC,YAAM,UAAU,MAAME,OAAM,MAAMF,OAAM,MAAM,QAAQ,IAAI;AAC1D,YAAU,eAAUA,OAAM,OAAO;AAAA,IAClC,CAAC;AAAA,EACF;AAEA,MAAI,WAAY,CAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;AAExD,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["fromMarkdown","cp","fsp","z","z","args","opts","fs","fsp","path","path","path","body","value","ast","heading","path","parse","dirname","args","path","fromMarkdown","parse"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/log.ts","../src/schema.js","../src/comment.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tconst opts: cp.CommonExecOptions = { stdio: \"inherit\" };\n\n\tINFO(\"formatting with prettier\");\n\n\tcp.execFileSync(\"prettier\", [\"--write\", ...paths], opts);\n\n\tif (isAffected) {\n\t\tINFO(\"adding affected files to git stage\");\n\n\t\tcp.execFileSync(\"git\", [\"add\", ...paths], opts);\n\t}\n\n\tif (spinner) spinner.stop();\n}\n","import yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { setVerbosity } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\"affectedRegexes\", \"templates\", \"headings\"] as const;\n\ntype ComplexOptions = (typeof complexOptions)[number];\n\nconst args = {\n\t...zodToYargs(),\n\tchanges: {\n\t\talias: \"g\",\n\t\tdefault: false,\n\t\tdescription: \"Check only changed git files\",\n\t\ttype: \"boolean\",\n\t},\n\tcheck: {\n\t\talias: \"k\",\n\t\tdefault: false,\n\t\tdescription: \"Do not write to files. Only check for changes\",\n\t\ttype: \"boolean\",\n\t},\n\tconfig: { alias: \"c\", description: \"Path to config file\", type: \"string\" },\n} satisfies Record<string, Options>;\n\nexport async function parseArgs() {\n\tconst yargsInstance = yargs(hideBin(process.argv))\n\t\t.options(args)\n\t\t.help(\"h\")\n\t\t.alias(\"h\", \"help\")\n\t\t.epilogue(`--> @stephansama open-source ${new Date().getFullYear()}`);\n\n\tconst parsed = await yargsInstance\n\t\t.wrap(yargsInstance.terminalWidth())\n\t\t.parse();\n\n\tif (parsed.verbose) setVerbosity(1);\n\n\treturn parsed;\n}\n\nexport function zodToYargs(): Omit<\n\tRecord<keyof typeof shape, Options>,\n\tComplexOptions\n> {\n\tconst { shape } = configSchema.unwrap();\n\tconst entries = Object.entries(shape).map(([key, value]) => {\n\t\tif (complexOptions.includes(key as ComplexOptions)) return [];\n\t\tif (value.def.innerType instanceof z.ZodObject) return [];\n\t\tconst meta = value.meta();\n\t\tconst { innerType } = value.def;\n\t\tconst isBoolean = innerType instanceof z.ZodBoolean;\n\t\tconst isNumber = innerType instanceof z.ZodNumber;\n\t\tconst isArray = innerType instanceof z.ZodArray;\n\n\t\tconst yargType: Options[\"type\"] =\n\t\t\t(isArray && \"array\") ||\n\t\t\t(isNumber && \"number\") ||\n\t\t\t(isBoolean && \"boolean\") ||\n\t\t\t\"string\";\n\n\t\tconst options: Options = {\n\t\t\tdefault: value.def.defaultValue,\n\t\t\ttype: yargType,\n\t\t};\n\n\t\tif (meta?.alias) options.alias = meta.alias as string;\n\t\tif (meta?.description) options.description = meta.description;\n\n\t\treturn [key, options];\n\t});\n\n\treturn Object.fromEntries(entries);\n}\n","import chalk from \"chalk\";\n\nlet verbosity = 0;\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tconsole.error(chalk.red(first), ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.info(chalk.blue(first), ...remaining);\n}\n\nexport function setVerbosity(input: number) {\n\tverbosity = input;\n}\n\nexport function WARN(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.warn(chalk.yellow(first), ...remaining);\n}\n","import { z } from \"zod\";\n\nexport const actionsSchema = z\n\t.enum([\"ACTION\", \"PKG\", \"USAGE\", \"WORKSPACE\", \"ZOD\"])\n\t.describe(\"Comment action options\");\n\nexport const formatsSchema = z\n\t.enum([\"LIST\", \"TABLE\"])\n\t.default(\"TABLE\")\n\t.optional();\n\nexport const languageSchema = z.enum([\"JS\", \"RS\"]).optional().default(\"JS\");\n\nexport const headingsSchema = z\n\t.enum([\n\t\t\"default\",\n\t\t\"description\",\n\t\t\"devDependency\",\n\t\t\"downloads\",\n\t\t\"name\",\n\t\t\"private\",\n\t\t\"required\",\n\t\t\"version\",\n\t])\n\t.describe(\"Table heading options\");\n\nexport const tableHeadingsSchema = z\n\t.record(actionsSchema, headingsSchema.array().optional())\n\t.optional()\n\t.describe(\"Table heading action configuration\")\n\t.default({\n\t\tACTION: [\"name\", \"required\", \"default\", \"description\"],\n\t\tPKG: [\"name\", \"version\", \"devDependency\"],\n\t\tWORKSPACE: [\"name\", \"version\", \"downloads\", \"description\"],\n\t\tZOD: [],\n\t});\n\nexport const templatesSchema = z.object({\n\tdownloadImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F\"),\n\temojis: z\n\t\t.record(headingsSchema, z.string())\n\t\t.optional()\n\t\t.describe(\"Table heading emojis used when enabled\")\n\t\t.default({\n\t\t\tdefault: \"⚙️\",\n\t\t\tdescription: \"📝\",\n\t\t\tdevDependency: \"💻\",\n\t\t\tdownloads: \"📥\",\n\t\t\tname: \"🏷️\",\n\t\t\tprivate: \"🔒\",\n\t\t\trequired: \"\",\n\t\t\tversion: \"\",\n\t\t}),\n\tregistryUrl: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://www.npmjs.com/package/{{name}}\"),\n\tversionImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\n\t\t\t\"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F\",\n\t\t),\n});\n\nexport const defaultTemplates = templatesSchema.parse({});\nexport const defaultTableHeadings = tableHeadingsSchema.parse(undefined);\n\nconst _configSchema = z.object({\n\taffectedRegexes: z.string().array().optional().default([]),\n\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { Root } from \"mdast\";\n\nimport { INFO } from \"./log\";\nimport { actionsSchema, formatsSchema, languageSchema } from \"./schema\";\n\nexport const SEPARATOR = \"-\" as const;\n\nexport type AstComments = ReturnType<typeof loadAstComments>;\n\nexport function loadAstComments(root: Root) {\n\treturn root.children\n\t\t.map((child) => child.type === \"html\" && getComment(child.value))\n\t\t.filter((f): f is ReturnType<typeof parseComment> => f !== false);\n}\n\nexport function parseComment(comment: string) {\n\tconst input = trimComment(comment);\n\tconst [type, ...parameters] = input.split(\" \");\n\tconst [first, second, third] = type.split(SEPARATOR);\n\n\tINFO(\"parsing inputs\", { first, second, third });\n\n\tconst languageInput = third ? first : undefined;\n\tconst actionInput = third ? second : first;\n\tconst formatInput = third ? third : second;\n\tconst language = languageSchema.parse(languageInput);\n\tconst action = actionsSchema.parse(actionInput);\n\tconst format = formatsSchema.parse(formatInput);\n\tconst isStart = comment.includes(\"start\");\n\tconst parsed = { action, format, isStart, language, parameters };\n\n\tINFO(`Parsed comment ${comment}`, parsed);\n\n\treturn parsed;\n}\n\nconst startComment = \"<!--\";\nconst endComment = \"-->\";\n\nexport function trimComment(comment: string) {\n\treturn comment\n\t\t.replace(startComment, \"\")\n\t\t.replace(/start|end/, \"\")\n\t\t.replace(endComment, \"\")\n\t\t.trim();\n}\n\nfunction getComment(comment: string) {\n\treturn isComment(comment) && parseComment(comment);\n}\n\nfunction isComment(comment: string) {\n\treturn comment.startsWith(startComment) && comment.endsWith(endComment);\n}\n","import toml from \"@iarna/toml\";\nimport { cosmiconfig, getDefaultSearchPlaces, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nconst moduleName = \"autoreadme\";\n\nconst searchPlaces = getSearchPlaces();\n\nconst loaders = { [\".toml\"]: loadToml };\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = { loaders, searchPlaces };\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(moduleName, opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function loadToml(_filepath: string, content: string) {\n\treturn toml.parse(content);\n}\n\nfunction getSearchPlaces() {\n\treturn [\n\t\t...getDefaultSearchPlaces(moduleName),\n\t\t`.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc`,\n\t\t`.config/${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.json`,\n\t\t`.config/.${moduleName}rc.yaml`,\n\t\t`.config/.${moduleName}rc.yml`,\n\t];\n}\n\nfunction removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { createFindParameter } from \"./data\";\nimport { INFO, WARN } from \"./log\";\nimport { autoReadmeRemarkPlugin } from \"./plugin\";\nimport { fileExists } from \"./utils\";\n\nexport async function parse(\n\tfile: string,\n\tfilepath: string,\n\troot: string,\n\tconfig: Config,\n\tdata: ActionData,\n) {\n\tconst pipeline = remark().use(autoReadmeRemarkPlugin, config, data);\n\tconst usage = data.find((d) => d.action === \"USAGE\");\n\n\tif (usage?.action === \"USAGE\" || config.enableUsage) {\n\t\tconst find = createFindParameter(usage?.parameters || []);\n\t\tconst examplePath = find(\"path\");\n\t\tconst dirname = path.dirname(filepath);\n\t\tconst resolvePath = examplePath && path.resolve(dirname, examplePath);\n\t\tconst relativeProjectPath =\n\t\t\tconfig.usageFile &&\n\t\t\tpath.relative(root, path.resolve(dirname, config.usageFile));\n\t\tconst example =\n\t\t\t(examplePath && resolvePath && path.relative(root, resolvePath)) ||\n\t\t\trelativeProjectPath ||\n\t\t\tundefined;\n\n\t\tif (await fileExists(example || \"\")) {\n\t\t\tINFO(\"generating usage section\");\n\t\t\tpipeline.use(remarkUsage, {\n\t\t\t\texample,\n\t\t\t\theading: config.usageHeading,\n\t\t\t});\n\t\t} else {\n\t\t\tWARN(\"not able to find example file for readme\", filepath, example);\n\t\t}\n\t}\n\n\tif (config.enableToc) {\n\t\tINFO(\"generating table of contents section\");\n\t\tpipeline\n\t\t\t.use(remarkToc, { heading: config.tocHeading })\n\t\t\t.use(remarkCollapse, { test: config.tocHeading });\n\t}\n\n\tconst vfile = await pipeline.process(file);\n\treturn vfile.toString();\n}\n","import type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";AAAA,SAAS,gBAAAA,qBAAoB;AAC7B,YAAYC,SAAQ;AACpB,YAAYC,UAAS;AACrB,OAAO,SAAS;;;ACHhB,OAAO,WAA6B;AACpC,SAAS,eAAe;AACxB,OAAOC,QAAO;;;ACFd,OAAO,WAAW;AAElB,IAAI,YAAY;AAET,SAAS,SAAS,MAAiB;AACzC,QAAM,CAAC,OAAO,GAAG,SAAS,IAAI;AAC9B,UAAQ,MAAM,MAAM,IAAI,KAAK,GAAG,GAAG,SAAS;AAC7C;AAEO,SAAS,QAAQ,MAAiB;AACxC,MAAI,YAAY,EAAG;AACnB,QAAM,CAAC,OAAO,GAAG,SAAS,IAAI;AAC9B,UAAQ,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GAAG;AAEH,UAAI,CAAC,QAAQ,QAAQ;AACpB,aAAK,+BAA+BD,KAAI;AACxC,YAAI,CAAC,OAAO,eAAe,CAAC,OAAO,WAAW;AAC7C,iBAAO,MAAM,4BAA4B;AAAA,QAC1C,OAAO;AACN,eAAK,uCAAuCA,KAAI;AAAA,QACjD;AAAA,MACD;AAEA,YAAM,OAAO,MAAM,eAAe,SAASA,OAAM,IAAI;AAErD,WAAK,8BAA8B,IAAI;AAEvC,YAAM,UAAU,MAAME,OAAM,MAAMF,OAAM,MAAM,QAAQ,IAAI;AAC1D,YAAU,eAAUA,OAAM,OAAO;AAAA,IAClC,CAAC;AAAA,EACF;AAEA,QAAMG,QAA6B,EAAE,OAAO,UAAU;AAEtD,OAAK,0BAA0B;AAE/B,EAAG,iBAAa,YAAY,CAAC,WAAW,GAAG,KAAK,GAAGA,KAAI;AAEvD,MAAI,YAAY;AACf,SAAK,oCAAoC;AAEzC,IAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,GAAGA,KAAI;AAAA,EAC/C;AAEA,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["fromMarkdown","cp","fsp","z","z","args","opts","fs","fsp","path","path","path","body","value","ast","heading","path","parse","dirname","args","path","fromMarkdown","parse","opts"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stephansama/auto-readme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Generate lists and tables for your README automagically based on your repository and comments",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/stephansama/packages",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"table"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
+
"@iarna/toml": "^2.2.5",
|
|
51
52
|
"@manypkg/get-packages": "^3.1.0",
|
|
52
53
|
"chalk": "^5.5.0",
|
|
53
54
|
"cosmiconfig": "^9.0.0",
|