@stephansama/auto-readme 0.2.2 → 0.2.3
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 +19 -59
- package/config/schema.cjs +3 -7
- package/config/schema.d.cts +6 -48
- package/config/schema.d.ts +6 -48
- package/config/schema.js +3 -4
- package/config/schema.json +1 -1
- package/config/schema.yaml +1 -0
- package/dist/index.cjs +15 -16
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +15 -16
- package/package.json +8 -9
- package/config/schema.cjs.map +0 -1
- package/config/schema.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -180,25 +180,25 @@ _Enum, one of the following possible values:_
|
|
|
180
180
|
|
|
181
181
|
_Object containing the following properties:_
|
|
182
182
|
|
|
183
|
-
| Property | Description | Type
|
|
184
|
-
| :------------------------ | :---------------------------------------------------------- |
|
|
185
|
-
| `affectedRegexes` | | `Array<string>`
|
|
186
|
-
| `collapseHeadings` | | `Array<string>`
|
|
187
|
-
| `defaultLanguage` | Default language to infer projects from | [Language](#language)
|
|
188
|
-
| `disableEmojis` | Whether or not to use emojis in markdown table headings | `boolean`
|
|
189
|
-
| `disableMarkdownHeadings` | Whether or not to display markdown headings | `boolean`
|
|
190
|
-
| `enablePrettier` | Whether or not to use prettier to format the files | `boolean`
|
|
191
|
-
| `enableToc` | generate table of contents for readmes | `boolean`
|
|
192
|
-
| `enableUsage` | Whether or not to enable usage plugin | `boolean`
|
|
193
|
-
| `headings` | List of headings for different table outputs | _Object with dynamic keys of type_ [Actions](#actions) _and values of type_
|
|
194
|
-
| `onlyReadmes` | Whether or not to only traverse readmes | `boolean`
|
|
195
|
-
| `onlyShowPublicPackages` | Only show public packages in workspaces | `boolean`
|
|
196
|
-
| `removeScope` | Remove common workspace scope | `string`
|
|
197
|
-
| `templates` | Handlebars templates used to fuel list and table generation | _Object with properties:_<ul><li>`downloadImage`: `string`</li><li>`emojis`:
|
|
198
|
-
| `tocHeading` | Markdown heading used to generate table of contents | `string`
|
|
199
|
-
| `usageFile` | Workspace level usage file | `string`
|
|
200
|
-
| `usageHeading` | Markdown heading used to generate usage example | `string`
|
|
201
|
-
| `verbose` | whether or not to display verbose logging | `boolean`
|
|
183
|
+
| Property | Description | Type | Default |
|
|
184
|
+
| :------------------------ | :---------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
185
|
+
| `affectedRegexes` | | `Array<string>` | `[]` |
|
|
186
|
+
| `collapseHeadings` | | `Array<string>` | `[]` |
|
|
187
|
+
| `defaultLanguage` | Default language to infer projects from | [Language](#language) | |
|
|
188
|
+
| `disableEmojis` | Whether or not to use emojis in markdown table headings | `boolean` | `false` |
|
|
189
|
+
| `disableMarkdownHeadings` | Whether or not to display markdown headings | `boolean` | `false` |
|
|
190
|
+
| `enablePrettier` | Whether or not to use prettier to format the files | `boolean` | `true` |
|
|
191
|
+
| `enableToc` | generate table of contents for readmes | `boolean` | `false` |
|
|
192
|
+
| `enableUsage` | Whether or not to enable usage plugin | `boolean` | `false` |
|
|
193
|
+
| `headings` | List of headings for different table outputs | _Object with dynamic keys of type_ [Actions](#actions) _and values of type_ `Array<'default' \| 'description' \| 'devDependency' \| 'downloads' \| 'name' \| 'private' \| 'required' \| 'version'>` (_optional_) | `{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"USAGE":[],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]}` |
|
|
194
|
+
| `onlyReadmes` | Whether or not to only traverse readmes | `boolean` | `true` |
|
|
195
|
+
| `onlyShowPublicPackages` | Only show public packages in workspaces | `boolean` | `false` |
|
|
196
|
+
| `removeScope` | Remove common workspace scope | `string` | `''` |
|
|
197
|
+
| `templates` | Handlebars templates used to fuel list and table generation | _Object with properties:_<ul><li>`downloadImage`: `string`</li><li>`emojis`: `Record<'default' \| 'description' \| 'devDependency' \| 'downloads' \| 'name' \| 'private' \| 'required' \| 'version', 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"}` |
|
|
198
|
+
| `tocHeading` | Markdown heading used to generate table of contents | `string` | `'Table of contents'` |
|
|
199
|
+
| `usageFile` | Workspace level usage file | `string` | `''` |
|
|
200
|
+
| `usageHeading` | Markdown heading used to generate usage example | `string` | `'Usage'` |
|
|
201
|
+
| `verbose` | whether or not to display verbose logging | `boolean` | `false` |
|
|
202
202
|
|
|
203
203
|
_All properties are optional._ (_optional_)
|
|
204
204
|
|
|
@@ -212,21 +212,6 @@ _Enum, one of the following possible values:_
|
|
|
212
212
|
|
|
213
213
|
_Default value:_ `'TABLE'`
|
|
214
214
|
|
|
215
|
-
## Headings
|
|
216
|
-
|
|
217
|
-
Table heading options
|
|
218
|
-
|
|
219
|
-
_Enum, one of the following possible values:_
|
|
220
|
-
|
|
221
|
-
- `'default'`
|
|
222
|
-
- `'description'`
|
|
223
|
-
- `'devDependency'`
|
|
224
|
-
- `'downloads'`
|
|
225
|
-
- `'name'`
|
|
226
|
-
- `'private'`
|
|
227
|
-
- `'required'`
|
|
228
|
-
- `'version'`
|
|
229
|
-
|
|
230
215
|
## Language
|
|
231
216
|
|
|
232
217
|
_Enum, one of the following possible values:_
|
|
@@ -237,29 +222,4 @@ _Enum, one of the following possible values:_
|
|
|
237
222
|
|
|
238
223
|
_Default value:_ `'JS'`
|
|
239
224
|
|
|
240
|
-
## TableHeadings
|
|
241
|
-
|
|
242
|
-
Table heading action configuration
|
|
243
|
-
|
|
244
|
-
_Object record with dynamic keys:_
|
|
245
|
-
|
|
246
|
-
- _keys of type_ [Actions](#actions)
|
|
247
|
-
- _values of type_ _Array of [Headings](#headings) items_ (_optional_)
|
|
248
|
-
(_optional_)
|
|
249
|
-
|
|
250
|
-
_Default value:_ `{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]}`
|
|
251
|
-
|
|
252
|
-
## Templates
|
|
253
|
-
|
|
254
|
-
_Object containing the following properties:_
|
|
255
|
-
|
|
256
|
-
| Property | Description | Type | Default |
|
|
257
|
-
| :-------------- | :------------------------------------- | :------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
|
|
258
|
-
| `downloadImage` | | `string` | `'https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F'` |
|
|
259
|
-
| `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":""}` |
|
|
260
|
-
| `registryUrl` | | `string` | `'https://www.npmjs.com/package/{{name}}'` |
|
|
261
|
-
| `versionImage` | | `string` | `'https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F'` |
|
|
262
|
-
|
|
263
|
-
_All properties are optional._
|
|
264
|
-
|
|
265
225
|
<!-- ZOD end -->
|
package/config/schema.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
let zod = require("zod");
|
|
25
25
|
zod = __toESM(zod);
|
|
26
26
|
|
|
27
|
-
//#region src/schema.
|
|
27
|
+
//#region src/schema.ts
|
|
28
28
|
const actionsSchema = zod.z.enum([
|
|
29
29
|
"ACTION",
|
|
30
30
|
"PKG",
|
|
@@ -56,6 +56,7 @@ const tableHeadingsSchema = zod.z.record(actionsSchema, headingsSchema.array().o
|
|
|
56
56
|
"version",
|
|
57
57
|
"devDependency"
|
|
58
58
|
],
|
|
59
|
+
USAGE: [],
|
|
59
60
|
WORKSPACE: [
|
|
60
61
|
"name",
|
|
61
62
|
"version",
|
|
@@ -119,7 +120,6 @@ const _configSchema = zod.z.object({
|
|
|
119
120
|
})
|
|
120
121
|
});
|
|
121
122
|
const configSchema = _configSchema.optional();
|
|
122
|
-
/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */
|
|
123
123
|
|
|
124
124
|
//#endregion
|
|
125
125
|
exports.actionsSchema = actionsSchema;
|
|
@@ -127,8 +127,4 @@ exports.configSchema = configSchema;
|
|
|
127
127
|
exports.defaultTableHeadings = defaultTableHeadings;
|
|
128
128
|
exports.defaultTemplates = defaultTemplates;
|
|
129
129
|
exports.formatsSchema = formatsSchema;
|
|
130
|
-
exports.
|
|
131
|
-
exports.languageSchema = languageSchema;
|
|
132
|
-
exports.tableHeadingsSchema = tableHeadingsSchema;
|
|
133
|
-
exports.templatesSchema = templatesSchema;
|
|
134
|
-
//# sourceMappingURL=schema.cjs.map
|
|
130
|
+
exports.languageSchema = languageSchema;
|
package/config/schema.d.cts
CHANGED
|
@@ -16,47 +16,6 @@ declare const languageSchema: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
|
16
16
|
JS: "JS";
|
|
17
17
|
RS: "RS";
|
|
18
18
|
}>>>;
|
|
19
|
-
declare const headingsSchema: z.ZodEnum<{
|
|
20
|
-
default: "default";
|
|
21
|
-
description: "description";
|
|
22
|
-
devDependency: "devDependency";
|
|
23
|
-
downloads: "downloads";
|
|
24
|
-
name: "name";
|
|
25
|
-
private: "private";
|
|
26
|
-
required: "required";
|
|
27
|
-
version: "version";
|
|
28
|
-
}>;
|
|
29
|
-
declare const tableHeadingsSchema: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
30
|
-
ACTION: "ACTION";
|
|
31
|
-
PKG: "PKG";
|
|
32
|
-
USAGE: "USAGE";
|
|
33
|
-
WORKSPACE: "WORKSPACE";
|
|
34
|
-
ZOD: "ZOD";
|
|
35
|
-
}>, z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
36
|
-
default: "default";
|
|
37
|
-
description: "description";
|
|
38
|
-
devDependency: "devDependency";
|
|
39
|
-
downloads: "downloads";
|
|
40
|
-
name: "name";
|
|
41
|
-
private: "private";
|
|
42
|
-
required: "required";
|
|
43
|
-
version: "version";
|
|
44
|
-
}>>>>>>;
|
|
45
|
-
declare const templatesSchema: z.ZodObject<{
|
|
46
|
-
downloadImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
47
|
-
emojis: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
48
|
-
default: "default";
|
|
49
|
-
description: "description";
|
|
50
|
-
devDependency: "devDependency";
|
|
51
|
-
downloads: "downloads";
|
|
52
|
-
name: "name";
|
|
53
|
-
private: "private";
|
|
54
|
-
required: "required";
|
|
55
|
-
version: "version";
|
|
56
|
-
}>, z.ZodString>>>;
|
|
57
|
-
registryUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
58
|
-
versionImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
19
|
declare const defaultTemplates: {
|
|
61
20
|
downloadImage: string;
|
|
62
21
|
emojis: Record<"default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version", string>;
|
|
@@ -64,7 +23,7 @@ declare const defaultTemplates: {
|
|
|
64
23
|
versionImage: string;
|
|
65
24
|
};
|
|
66
25
|
declare const defaultTableHeadings: Record<"ACTION" | "PKG" | "USAGE" | "WORKSPACE" | "ZOD", ("default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version")[] | undefined>;
|
|
67
|
-
declare const
|
|
26
|
+
declare const _configSchema: z.ZodObject<{
|
|
68
27
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
69
28
|
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
70
29
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -114,9 +73,8 @@ declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
|
114
73
|
usageFile: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
115
74
|
usageHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
116
75
|
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
117
|
-
}, z.core.$strip
|
|
118
|
-
|
|
119
|
-
declare const _configSchema: z.ZodObject<{
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
120
78
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
121
79
|
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
122
80
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -166,7 +124,7 @@ declare const _configSchema: z.ZodObject<{
|
|
|
166
124
|
usageFile: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
167
125
|
usageHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
168
126
|
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
169
|
-
}, z.core.$strip
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
type Config = Partial<z.infer<typeof _configSchema>>;
|
|
170
129
|
//#endregion
|
|
171
|
-
export { Config, actionsSchema, configSchema, defaultTableHeadings, defaultTemplates, formatsSchema,
|
|
172
|
-
//# sourceMappingURL=schema.d.cts.map
|
|
130
|
+
export { Config, actionsSchema, configSchema, defaultTableHeadings, defaultTemplates, formatsSchema, languageSchema };
|
package/config/schema.d.ts
CHANGED
|
@@ -16,47 +16,6 @@ declare const languageSchema: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
|
16
16
|
JS: "JS";
|
|
17
17
|
RS: "RS";
|
|
18
18
|
}>>>;
|
|
19
|
-
declare const headingsSchema: z.ZodEnum<{
|
|
20
|
-
default: "default";
|
|
21
|
-
description: "description";
|
|
22
|
-
devDependency: "devDependency";
|
|
23
|
-
downloads: "downloads";
|
|
24
|
-
name: "name";
|
|
25
|
-
private: "private";
|
|
26
|
-
required: "required";
|
|
27
|
-
version: "version";
|
|
28
|
-
}>;
|
|
29
|
-
declare const tableHeadingsSchema: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
30
|
-
ACTION: "ACTION";
|
|
31
|
-
PKG: "PKG";
|
|
32
|
-
USAGE: "USAGE";
|
|
33
|
-
WORKSPACE: "WORKSPACE";
|
|
34
|
-
ZOD: "ZOD";
|
|
35
|
-
}>, z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
36
|
-
default: "default";
|
|
37
|
-
description: "description";
|
|
38
|
-
devDependency: "devDependency";
|
|
39
|
-
downloads: "downloads";
|
|
40
|
-
name: "name";
|
|
41
|
-
private: "private";
|
|
42
|
-
required: "required";
|
|
43
|
-
version: "version";
|
|
44
|
-
}>>>>>>;
|
|
45
|
-
declare const templatesSchema: z.ZodObject<{
|
|
46
|
-
downloadImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
47
|
-
emojis: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
48
|
-
default: "default";
|
|
49
|
-
description: "description";
|
|
50
|
-
devDependency: "devDependency";
|
|
51
|
-
downloads: "downloads";
|
|
52
|
-
name: "name";
|
|
53
|
-
private: "private";
|
|
54
|
-
required: "required";
|
|
55
|
-
version: "version";
|
|
56
|
-
}>, z.ZodString>>>;
|
|
57
|
-
registryUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
58
|
-
versionImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
19
|
declare const defaultTemplates: {
|
|
61
20
|
downloadImage: string;
|
|
62
21
|
emojis: Record<"default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version", string>;
|
|
@@ -64,7 +23,7 @@ declare const defaultTemplates: {
|
|
|
64
23
|
versionImage: string;
|
|
65
24
|
};
|
|
66
25
|
declare const defaultTableHeadings: Record<"ACTION" | "PKG" | "USAGE" | "WORKSPACE" | "ZOD", ("default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version")[] | undefined>;
|
|
67
|
-
declare const
|
|
26
|
+
declare const _configSchema: z.ZodObject<{
|
|
68
27
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
69
28
|
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
70
29
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -114,9 +73,8 @@ declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
|
114
73
|
usageFile: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
115
74
|
usageHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
116
75
|
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
117
|
-
}, z.core.$strip
|
|
118
|
-
|
|
119
|
-
declare const _configSchema: z.ZodObject<{
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
120
78
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
121
79
|
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
122
80
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -166,7 +124,7 @@ declare const _configSchema: z.ZodObject<{
|
|
|
166
124
|
usageFile: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
167
125
|
usageHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
168
126
|
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
169
|
-
}, z.core.$strip
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
type Config = Partial<z.infer<typeof _configSchema>>;
|
|
170
129
|
//#endregion
|
|
171
|
-
export { Config, actionsSchema, configSchema, defaultTableHeadings, defaultTemplates, formatsSchema,
|
|
172
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
130
|
+
export { Config, actionsSchema, configSchema, defaultTableHeadings, defaultTemplates, formatsSchema, languageSchema };
|
package/config/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
//#region src/schema.
|
|
3
|
+
//#region src/schema.ts
|
|
4
4
|
const actionsSchema = z.enum([
|
|
5
5
|
"ACTION",
|
|
6
6
|
"PKG",
|
|
@@ -32,6 +32,7 @@ const tableHeadingsSchema = z.record(actionsSchema, headingsSchema.array().optio
|
|
|
32
32
|
"version",
|
|
33
33
|
"devDependency"
|
|
34
34
|
],
|
|
35
|
+
USAGE: [],
|
|
35
36
|
WORKSPACE: [
|
|
36
37
|
"name",
|
|
37
38
|
"version",
|
|
@@ -95,8 +96,6 @@ const _configSchema = z.object({
|
|
|
95
96
|
})
|
|
96
97
|
});
|
|
97
98
|
const configSchema = _configSchema.optional();
|
|
98
|
-
/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */
|
|
99
99
|
|
|
100
100
|
//#endregion
|
|
101
|
-
export { actionsSchema, configSchema, defaultTableHeadings, defaultTemplates, formatsSchema,
|
|
102
|
-
//# sourceMappingURL=schema.js.map
|
|
101
|
+
export { actionsSchema, configSchema, defaultTableHeadings, defaultTemplates, formatsSchema, languageSchema };
|
package/config/schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"affectedRegexes":{"default":[],"type":"array","items":{"type":"string"}},"collapseHeadings":{"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"},"enablePrettier":{"description":"Whether or not to use prettier to format the files","default":true,"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","collapseHeadings","defaultLanguage","disableEmojis","disableMarkdownHeadings","enablePrettier","enableToc","enableUsage","headings","onlyReadmes","onlyShowPublicPackages","removeScope","templates","tocHeading","usageFile","usageHeading","verbose"],"additionalProperties":false}
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"affectedRegexes":{"default":[],"type":"array","items":{"type":"string"}},"collapseHeadings":{"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"},"enablePrettier":{"description":"Whether or not to use prettier to format the files","default":true,"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"],"USAGE":[],"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","collapseHeadings","defaultLanguage","disableEmojis","disableMarkdownHeadings","enablePrettier","enableToc","enableUsage","headings","onlyReadmes","onlyShowPublicPackages","removeScope","templates","tocHeading","usageFile","usageHeading","verbose"],"additionalProperties":false}
|
package/config/schema.yaml
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -78,7 +78,7 @@ markdown_table = __toESM(markdown_table);
|
|
|
78
78
|
let mdast_zone = require("mdast-zone");
|
|
79
79
|
mdast_zone = __toESM(mdast_zone);
|
|
80
80
|
|
|
81
|
-
//#region src/schema.
|
|
81
|
+
//#region src/schema.ts
|
|
82
82
|
const actionsSchema = zod.z.enum([
|
|
83
83
|
"ACTION",
|
|
84
84
|
"PKG",
|
|
@@ -110,6 +110,7 @@ const tableHeadingsSchema = zod.z.record(actionsSchema, headingsSchema.array().o
|
|
|
110
110
|
"version",
|
|
111
111
|
"devDependency"
|
|
112
112
|
],
|
|
113
|
+
USAGE: [],
|
|
113
114
|
WORKSPACE: [
|
|
114
115
|
"name",
|
|
115
116
|
"version",
|
|
@@ -173,7 +174,6 @@ const _configSchema = zod.z.object({
|
|
|
173
174
|
})
|
|
174
175
|
});
|
|
175
176
|
const configSchema = _configSchema.optional();
|
|
176
|
-
/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */
|
|
177
177
|
|
|
178
178
|
//#endregion
|
|
179
179
|
//#region src/args.ts
|
|
@@ -361,18 +361,6 @@ function findAffectedMarkdowns(root, config) {
|
|
|
361
361
|
INFO("Found the following readmes", dedupe);
|
|
362
362
|
return dedupe;
|
|
363
363
|
}
|
|
364
|
-
function findNearestReadme(gitRoot, inputFile, maxRotations = 15) {
|
|
365
|
-
let dir = node_path.dirname(inputFile);
|
|
366
|
-
let rotations = 0;
|
|
367
|
-
while (true) {
|
|
368
|
-
const option = node_path.join(dir, "README.md");
|
|
369
|
-
if (node_fs.existsSync(option)) return option;
|
|
370
|
-
const parent = node_path.dirname(dir);
|
|
371
|
-
if (parent === dir || dir === gitRoot || ++rotations > maxRotations) break;
|
|
372
|
-
dir = parent;
|
|
373
|
-
}
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
364
|
function getGitRoot() {
|
|
377
365
|
const root = node_child_process.execSync(sh`git rev-parse --show-toplevel`, opts).trim();
|
|
378
366
|
if (!root) throw new Error("must be ran within a git directory.");
|
|
@@ -392,6 +380,18 @@ async function getPrettierPaths(paths) {
|
|
|
392
380
|
return node_path.join(node_path.dirname(file), symlink);
|
|
393
381
|
}));
|
|
394
382
|
}
|
|
383
|
+
function findNearestReadme(gitRoot, inputFile, maxRotations = 15) {
|
|
384
|
+
let dir = node_path.dirname(inputFile);
|
|
385
|
+
let rotations = 0;
|
|
386
|
+
while (true) {
|
|
387
|
+
const option = node_path.join(dir, "README.md");
|
|
388
|
+
if (node_fs.existsSync(option)) return option;
|
|
389
|
+
const parent = node_path.dirname(dir);
|
|
390
|
+
if (parent === dir || dir === gitRoot || ++rotations > maxRotations) break;
|
|
391
|
+
dir = parent;
|
|
392
|
+
}
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
395
|
|
|
396
396
|
//#endregion
|
|
397
397
|
//#region src/data.ts
|
|
@@ -680,5 +680,4 @@ async function run() {
|
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
//#endregion
|
|
683
|
-
exports.run = run;
|
|
684
|
-
//# sourceMappingURL=index.cjs.map
|
|
683
|
+
exports.run = run;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import Handlebars from "handlebars";
|
|
|
28
28
|
import { markdownTable } from "markdown-table";
|
|
29
29
|
import { zone } from "mdast-zone";
|
|
30
30
|
|
|
31
|
-
//#region src/schema.
|
|
31
|
+
//#region src/schema.ts
|
|
32
32
|
const actionsSchema = z.enum([
|
|
33
33
|
"ACTION",
|
|
34
34
|
"PKG",
|
|
@@ -60,6 +60,7 @@ const tableHeadingsSchema = z.record(actionsSchema, headingsSchema.array().optio
|
|
|
60
60
|
"version",
|
|
61
61
|
"devDependency"
|
|
62
62
|
],
|
|
63
|
+
USAGE: [],
|
|
63
64
|
WORKSPACE: [
|
|
64
65
|
"name",
|
|
65
66
|
"version",
|
|
@@ -123,7 +124,6 @@ const _configSchema = z.object({
|
|
|
123
124
|
})
|
|
124
125
|
});
|
|
125
126
|
const configSchema = _configSchema.optional();
|
|
126
|
-
/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */
|
|
127
127
|
|
|
128
128
|
//#endregion
|
|
129
129
|
//#region src/args.ts
|
|
@@ -311,18 +311,6 @@ function findAffectedMarkdowns(root, config) {
|
|
|
311
311
|
INFO("Found the following readmes", dedupe);
|
|
312
312
|
return dedupe;
|
|
313
313
|
}
|
|
314
|
-
function findNearestReadme(gitRoot, inputFile, maxRotations = 15) {
|
|
315
|
-
let dir = path$1.dirname(inputFile);
|
|
316
|
-
let rotations = 0;
|
|
317
|
-
while (true) {
|
|
318
|
-
const option = path$1.join(dir, "README.md");
|
|
319
|
-
if (fs.existsSync(option)) return option;
|
|
320
|
-
const parent = path$1.dirname(dir);
|
|
321
|
-
if (parent === dir || dir === gitRoot || ++rotations > maxRotations) break;
|
|
322
|
-
dir = parent;
|
|
323
|
-
}
|
|
324
|
-
return null;
|
|
325
|
-
}
|
|
326
314
|
function getGitRoot() {
|
|
327
315
|
const root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();
|
|
328
316
|
if (!root) throw new Error("must be ran within a git directory.");
|
|
@@ -342,6 +330,18 @@ async function getPrettierPaths(paths) {
|
|
|
342
330
|
return path$1.join(path$1.dirname(file), symlink);
|
|
343
331
|
}));
|
|
344
332
|
}
|
|
333
|
+
function findNearestReadme(gitRoot, inputFile, maxRotations = 15) {
|
|
334
|
+
let dir = path$1.dirname(inputFile);
|
|
335
|
+
let rotations = 0;
|
|
336
|
+
while (true) {
|
|
337
|
+
const option = path$1.join(dir, "README.md");
|
|
338
|
+
if (fs.existsSync(option)) return option;
|
|
339
|
+
const parent = path$1.dirname(dir);
|
|
340
|
+
if (parent === dir || dir === gitRoot || ++rotations > maxRotations) break;
|
|
341
|
+
dir = parent;
|
|
342
|
+
}
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
345
|
|
|
346
346
|
//#endregion
|
|
347
347
|
//#region src/data.ts
|
|
@@ -630,5 +630,4 @@ async function run() {
|
|
|
630
630
|
}
|
|
631
631
|
|
|
632
632
|
//#endregion
|
|
633
|
-
export { run };
|
|
634
|
-
//# sourceMappingURL=index.js.map
|
|
633
|
+
export { run };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stephansama/auto-readme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Generate lists and tables for your README automagically based on your repository and comments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auto",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"homepage": "https://packages.stephansama.info/api/@stephansama/auto-readme",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/stephansama/packages",
|
|
18
|
+
"url": "git+https://github.com/stephansama/packages.git",
|
|
19
19
|
"directory": "core/auto-readme"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
@@ -50,20 +50,18 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@iarna/toml": "^2.2.5",
|
|
52
52
|
"@manypkg/get-packages": "^3.1.0",
|
|
53
|
-
"chalk": "^5.5.0",
|
|
54
53
|
"cosmiconfig": "^9.0.0",
|
|
55
|
-
"debug": "^4.4.
|
|
54
|
+
"debug": "^4.4.3",
|
|
56
55
|
"deepmerge": "^4.3.1",
|
|
57
56
|
"fast-glob": "^3.3.3",
|
|
58
|
-
"handlebars": "
|
|
57
|
+
"handlebars": "4.7.8",
|
|
59
58
|
"markdown-table": "^3.0.4",
|
|
60
59
|
"mdast-comment-marker": "^3.0.0",
|
|
61
60
|
"mdast-util-from-markdown": "^2.0.2",
|
|
62
|
-
"mdast-util-gfm": "^3.1.0",
|
|
63
61
|
"mdast-zone": "github:stephansama/mdast-zone#1c5b08cd97240debeed4c9c6afad49df5877a132",
|
|
64
62
|
"ora": "^8.2.0",
|
|
65
63
|
"pkg-types": "^2.2.0",
|
|
66
|
-
"remark": "
|
|
64
|
+
"remark": "15.0.1",
|
|
67
65
|
"remark-code-import": "^1.2.0",
|
|
68
66
|
"remark-collapse": "^0.1.2",
|
|
69
67
|
"remark-toc": "^9.0.0",
|
|
@@ -71,7 +69,7 @@
|
|
|
71
69
|
"vfile": "^6.0.3",
|
|
72
70
|
"yaml": "^2.8.1",
|
|
73
71
|
"yargs": "^18.0.0",
|
|
74
|
-
"zod": "
|
|
72
|
+
"zod": "4.0.15",
|
|
75
73
|
"zod2md": "^0.2.4"
|
|
76
74
|
},
|
|
77
75
|
"devDependencies": {
|
|
@@ -80,7 +78,7 @@
|
|
|
80
78
|
"@types/vfile": "^4.0.0",
|
|
81
79
|
"@types/yargs": "^17.0.33",
|
|
82
80
|
"mdast": "^3.0.0",
|
|
83
|
-
"tsdown": "
|
|
81
|
+
"tsdown": "0.15.12",
|
|
84
82
|
"unified": "^11.0.5"
|
|
85
83
|
},
|
|
86
84
|
"publishConfig": {
|
|
@@ -89,6 +87,7 @@
|
|
|
89
87
|
},
|
|
90
88
|
"scripts": {
|
|
91
89
|
"build": "node build.mjs",
|
|
90
|
+
"postbuild": "publint",
|
|
92
91
|
"dev": "node --watch-path=./src build.mjs",
|
|
93
92
|
"lint": "eslint ./src/ --pass-on-no-patterns --no-error-on-unmatched-pattern"
|
|
94
93
|
}
|
package/config/schema.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.cjs","names":["z"],"sources":["../src/schema.js"],"sourcesContent":["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\tcollapseHeadings: 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\tenablePrettier: z.boolean().default(true).meta({\n\t\tdescription: \"Whether or not to use prettier to format the files\",\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"],"mappings":";;;;;;;;;;;;;;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,QAAQ,CAAC,UAAU,CAAC,QAAQ,QAAQ,CAAC,KAAK,EACzD,aAAa,mDACb,CAAC;CACF,SAASA,MAAE,SAAS,CAAC,QAAQ,MAAM,CAAC,KAAK;EACxC,OAAO;EACP,aAAa;EACb,CAAC;CACF,CAAC;AAEF,MAAa,eAAe,cAAc,UAAU"}
|
package/config/schema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.js"],"sourcesContent":["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\tcollapseHeadings: 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\tenablePrettier: z.boolean().default(true).meta({\n\t\tdescription: \"Whether or not to use prettier to format the files\",\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"],"mappings":";;;AAEA,MAAa,gBAAgB,EAC3B,KAAK;CAAC;CAAU;CAAO;CAAS;CAAa;CAAM,CAAC,CACpD,SAAS,yBAAyB;AAEpC,MAAa,gBAAgB,EAC3B,KAAK,CAAC,QAAQ,QAAQ,CAAC,CACvB,QAAQ,QAAQ,CAChB,UAAU;AAEZ,MAAa,iBAAiB,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,UAAU,CAAC,QAAQ,KAAK;AAE3E,MAAa,iBAAiB,EAC5B,KAAK;CACL;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC,CACD,SAAS,wBAAwB;AAEnC,MAAa,sBAAsB,EACjC,OAAO,eAAe,eAAe,OAAO,CAAC,UAAU,CAAC,CACxD,UAAU,CACV,SAAS,qCAAqC,CAC9C,QAAQ;CACR,QAAQ;EAAC;EAAQ;EAAY;EAAW;EAAc;CACtD,KAAK;EAAC;EAAQ;EAAW;EAAgB;CACzC,WAAW;EAAC;EAAQ;EAAW;EAAa;EAAc;CAC1D,KAAK,EAAE;CACP,CAAC;AAEH,MAAa,kBAAkB,EAAE,OAAO;CACvC,eAAe,EACb,QAAQ,CACR,UAAU,CACV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ACP,aAAa;EACb,CAAC;CACF,wBAAwB,EAAE,SAAS,CAAC,QAAQ,MAAM,CAAC,KAAK;EACvD,OAAO;EACP,aAAa;EACb,CAAC;CACF,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,KAAK,EACnD,aAAa,iCACb,CAAC;CACF,WAAW,gBACT,UAAU,CACV,QAAQ,iBAAiB,CACzB,SACA,8DACA;CACF,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,oBAAoB,CAAC,KAAK,EACnE,aAAa,uDACb,CAAC;CACF,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,KAAK,EACjD,aAAa,8BACb,CAAC;CACF,cAAc,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,QAAQ,CAAC,KAAK,EACzD,aAAa,mDACb,CAAC;CACF,SAAS,EAAE,SAAS,CAAC,QAAQ,MAAM,CAAC,KAAK;EACxC,OAAO;EACP,aAAa;EACb,CAAC;CACF,CAAC;AAEF,MAAa,eAAe,cAAc,UAAU"}
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["z","z","yargType: Options[\"type\"]","options: Options","opts: Partial<Options>","args","opts","toml","opts: { encoding: BufferEncoding }","fsp","cp","path","fs","path","fs","error","fsp","autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root>","zod","value","heading","path","Handlebars","remarkCodeImport","path","remarkUsage","remarkToc","remarkCollapse","vfile","VFile","args","config: Config","fsp","path","opts: cp.CommonExecOptions","opts"],"sources":["../src/schema.js","../src/args.ts","../src/log.ts","../src/comment.ts","../src/config.ts","../src/utils.ts","../src/data.ts","../src/plugin.ts","../src/pipeline.ts","../src/index.ts"],"sourcesContent":["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\tcollapseHeadings: 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\tenablePrettier: z.boolean().default(true).meta({\n\t\tdescription: \"Whether or not to use prettier to format the files\",\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 debug from \"debug\";\nimport yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\n\t\"affectedRegexes\",\n\t\"collapseHeadings\",\n\t\"headings\",\n\t\"templates\",\n] 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) debug.enable(\"autoreadme*\");\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 debug from \"debug\";\n\nconst error = debug(\"autoreadme:error\");\nconst info = debug(\"autoreadme:info\");\nconst warn = debug(\"autoreadme:warn\");\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\terror(`${first} %O`, ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tinfo(`${first} %O`, ...remaining);\n}\n\nexport function WARN(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\twarn(`${first} %O`, ...remaining);\n}\n","import type { Html, Root } from \"mdast\";\n\nimport { commentMarker } from \"mdast-comment-marker\";\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))\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: Html) {\n\tif (!isComment(comment.value)) return false;\n\n\tconst marker = commentMarker(comment);\n\tif (!marker) return false;\n\n\t// TODO: update parseComment to use comment marker\n\treturn parseComment(comment.value);\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 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\nexport async function getPrettierPaths(paths: string[]) {\n\treturn await Promise.all(\n\t\tpaths.map(async (file) => {\n\t\t\tconst stats = await fsp.lstat(file);\n\t\t\tconst isSymbolicLink = stats.isSymbolicLink();\n\t\t\tif (!isSymbolicLink) return file;\n\t\t\tconst symlink = await fsp.readlink(file);\n\t\t\treturn path.join(path.dirname(file), symlink);\n\t\t}),\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 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","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCodeImport from \"remark-code-import\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\nimport { VFile } from \"vfile\";\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()\n\t\t.use(autoReadmeRemarkPlugin, config, data)\n\t\t.use(remarkCodeImport, {});\n\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 (example && (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.use(remarkToc, { heading: config.tocHeading });\n\t}\n\n\tif (config.enableToc || config.collapseHeadings?.length) {\n\t\tconst additional = config.collapseHeadings?.length\n\t\t\t? config.collapseHeadings\n\t\t\t: [];\n\t\tconst headings = [...additional, config.tocHeading];\n\t\tpipeline.use(remarkCollapse, {\n\t\t\ttest: {\n\t\t\t\tignoreFinalDefinitions: true,\n\t\t\t\ttest: (value, _) => {\n\t\t\t\t\treturn headings.some((i) => value.trim() === i?.trim());\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t}\n\n\tconst vfile = new VFile({ path: path.resolve(filepath), value: file });\n\tconst markdown = await pipeline.process(vfile);\n\treturn markdown.toString();\n}\n","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 {\n\tfindAffectedMarkdowns,\n\tgetGitRoot,\n\tgetMarkdownPaths,\n\tgetPrettierPaths,\n} 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\tif (config.enablePrettier) {\n\t\tINFO(\"formatting with prettier\");\n\n\t\tconst prettierPaths = await getPrettierPaths(paths);\n\t\tcp.execFileSync(\"prettier\", [\"--write\", ...prettierPaths], opts);\n\t}\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,gBAAgBA,MAC3B,KAAK;CAAC;CAAU;CAAO;CAAS;CAAa;CAAM,CAAC,CACpD,SAAS,yBAAyB;AAEpC,MAAa,gBAAgBA,MAC3B,KAAK,CAAC,QAAQ,QAAQ,CAAC,CACvB,QAAQ,QAAQ,CAChB,UAAU;AAEZ,MAAa,iBAAiBA,MAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,UAAU,CAAC,QAAQ,KAAK;AAE3E,MAAa,iBAAiBA,MAC5B,KAAK;CACL;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC,CACD,SAAS,wBAAwB;AAEnC,MAAa,sBAAsBA,MACjC,OAAO,eAAe,eAAe,OAAO,CAAC,UAAU,CAAC,CACxD,UAAU,CACV,SAAS,qCAAqC,CAC9C,QAAQ;CACR,QAAQ;EAAC;EAAQ;EAAY;EAAW;EAAc;CACtD,KAAK;EAAC;EAAQ;EAAW;EAAgB;CACzC,WAAW;EAAC;EAAQ;EAAW;EAAa;EAAc;CAC1D,KAAK,EAAE;CACP,CAAC;AAEH,MAAa,kBAAkBA,MAAE,OAAO;CACvC,eAAeA,MACb,QAAQ,CACR,UAAU,CACV,QAAQ,2DAA2D;CACrE,QAAQA,MACN,OAAO,gBAAgBA,MAAE,QAAQ,CAAC,CAClC,UAAU,CACV,SAAS,yCAAyC,CAClD,QAAQ;EACR,SAAS;EACT,aAAa;EACb,eAAe;EACf,WAAW;EACX,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AY;AACf,OAAK,qCAAqC;AAE1C,qBAAG,aAAa,OAAO,CAAC,OAAO,GAAG,MAAM,EAAEA,OAAK;;AAGhD,KAAI,QAAS,SAAQ,MAAM"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["z","yargType: Options[\"type\"]","options: Options","opts: Partial<Options>","args","opts","opts: { encoding: BufferEncoding }","path","path","error","autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root>","value","heading","path","args","config: Config","path","opts: cp.CommonExecOptions","opts"],"sources":["../src/schema.js","../src/args.ts","../src/log.ts","../src/comment.ts","../src/config.ts","../src/utils.ts","../src/data.ts","../src/plugin.ts","../src/pipeline.ts","../src/index.ts"],"sourcesContent":["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\tcollapseHeadings: 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\tenablePrettier: z.boolean().default(true).meta({\n\t\tdescription: \"Whether or not to use prettier to format the files\",\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 debug from \"debug\";\nimport yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\n\t\"affectedRegexes\",\n\t\"collapseHeadings\",\n\t\"headings\",\n\t\"templates\",\n] 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) debug.enable(\"autoreadme*\");\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 debug from \"debug\";\n\nconst error = debug(\"autoreadme:error\");\nconst info = debug(\"autoreadme:info\");\nconst warn = debug(\"autoreadme:warn\");\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\terror(`${first} %O`, ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tinfo(`${first} %O`, ...remaining);\n}\n\nexport function WARN(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\twarn(`${first} %O`, ...remaining);\n}\n","import type { Html, Root } from \"mdast\";\n\nimport { commentMarker } from \"mdast-comment-marker\";\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))\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: Html) {\n\tif (!isComment(comment.value)) return false;\n\n\tconst marker = commentMarker(comment);\n\tif (!marker) return false;\n\n\t// TODO: update parseComment to use comment marker\n\treturn parseComment(comment.value);\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 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\nexport async function getPrettierPaths(paths: string[]) {\n\treturn await Promise.all(\n\t\tpaths.map(async (file) => {\n\t\t\tconst stats = await fsp.lstat(file);\n\t\t\tconst isSymbolicLink = stats.isSymbolicLink();\n\t\t\tif (!isSymbolicLink) return file;\n\t\t\tconst symlink = await fsp.readlink(file);\n\t\t\treturn path.join(path.dirname(file), symlink);\n\t\t}),\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 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","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCodeImport from \"remark-code-import\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\nimport { VFile } from \"vfile\";\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()\n\t\t.use(autoReadmeRemarkPlugin, config, data)\n\t\t.use(remarkCodeImport, {});\n\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 (example && (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.use(remarkToc, { heading: config.tocHeading });\n\t}\n\n\tif (config.enableToc || config.collapseHeadings?.length) {\n\t\tconst additional = config.collapseHeadings?.length\n\t\t\t? config.collapseHeadings\n\t\t\t: [];\n\t\tconst headings = [...additional, config.tocHeading];\n\t\tpipeline.use(remarkCollapse, {\n\t\t\ttest: {\n\t\t\t\tignoreFinalDefinitions: true,\n\t\t\t\ttest: (value, _) => {\n\t\t\t\t\treturn headings.some((i) => value.trim() === i?.trim());\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t}\n\n\tconst vfile = new VFile({ path: path.resolve(filepath), value: file });\n\tconst markdown = await pipeline.process(vfile);\n\treturn markdown.toString();\n}\n","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 {\n\tfindAffectedMarkdowns,\n\tgetGitRoot,\n\tgetMarkdownPaths,\n\tgetPrettierPaths,\n} 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\tif (config.enablePrettier) {\n\t\tINFO(\"formatting with prettier\");\n\n\t\tconst prettierPaths = await getPrettierPaths(paths);\n\t\tcp.execFileSync(\"prettier\", [\"--write\", ...prettierPaths], opts);\n\t}\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,gBAAgB,EAC3B,KAAK;CAAC;CAAU;CAAO;CAAS;CAAa;CAAM,CAAC,CACpD,SAAS,yBAAyB;AAEpC,MAAa,gBAAgB,EAC3B,KAAK,CAAC,QAAQ,QAAQ,CAAC,CACvB,QAAQ,QAAQ,CAChB,UAAU;AAEZ,MAAa,iBAAiB,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,UAAU,CAAC,QAAQ,KAAK;AAE3E,MAAa,iBAAiB,EAC5B,KAAK;CACL;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC,CACD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