@stephansama/auto-readme 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -14
- package/config/schema.cjs +1 -0
- package/config/schema.cjs.map +1 -1
- package/config/schema.d.cts +2 -0
- package/config/schema.d.ts +2 -0
- package/config/schema.js +1 -0
- package/config/schema.js.map +1 -1
- package/config/schema.json +1 -1
- package/config/schema.yaml +7 -3
- package/dist/index.cjs +59 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -34
- package/dist/index.js.map +1 -1
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Auto Readme 🪄
|
|
2
2
|
|
|
3
|
-
[](https://github.com/stephansama/packages/tree/main/
|
|
4
|
-
[](https://packages.stephansama.info/
|
|
3
|
+
[](https://github.com/stephansama/packages/tree/main/core/auto-readme)
|
|
4
|
+
[](https://packages.stephansama.info/api/@stephansama/auto-readme)
|
|
5
5
|
[](https://www.npmjs.com/package/@stephansama/auto-readme)
|
|
6
6
|
[](https://www.npmjs.com/package/@stephansama/auto-readme)
|
|
7
7
|
|
|
@@ -95,26 +95,33 @@ Most of the options in the [schema](#schema) below can also be used as command-l
|
|
|
95
95
|
You can configure `auto-readme` by creating a configuration file (or object) in the root of your project. The following file formats are supported:
|
|
96
96
|
|
|
97
97
|
- `package.json`
|
|
98
|
-
- `.autoreadmerc`
|
|
98
|
+
- `.autoreadmerc.cjs`
|
|
99
|
+
- `.autoreadmerc.js`
|
|
99
100
|
- `.autoreadmerc.json`
|
|
101
|
+
- `.autoreadmerc.mjs`
|
|
102
|
+
- `.autoreadmerc.toml`
|
|
103
|
+
- `.autoreadmerc.ts`
|
|
100
104
|
- `.autoreadmerc.yaml`
|
|
101
105
|
- `.autoreadmerc.yml`
|
|
102
|
-
- `.autoreadmerc
|
|
103
|
-
- `.autoreadmerc.
|
|
104
|
-
- `.autoreadmerc.
|
|
105
|
-
- `.autoreadmerc.
|
|
106
|
-
- `.config
|
|
106
|
+
- `.autoreadmerc`
|
|
107
|
+
- `.config/.autoreadmerc.json`
|
|
108
|
+
- `.config/.autoreadmerc.toml`
|
|
109
|
+
- `.config/.autoreadmerc.yaml`
|
|
110
|
+
- `.config/.autoreadmerc.yml`
|
|
111
|
+
- `.config/.autoreadmerc`
|
|
112
|
+
- `.config/autoreadmerc.cjs`
|
|
113
|
+
- `.config/autoreadmerc.js`
|
|
107
114
|
- `.config/autoreadmerc.json`
|
|
115
|
+
- `.config/autoreadmerc.mjs`
|
|
116
|
+
- `.config/autoreadmerc.toml`
|
|
117
|
+
- `.config/autoreadmerc.ts`
|
|
108
118
|
- `.config/autoreadmerc.yaml`
|
|
109
119
|
- `.config/autoreadmerc.yml`
|
|
110
|
-
- `.config/autoreadmerc
|
|
111
|
-
-
|
|
112
|
-
- `.config/autoreadmerc.mjs`
|
|
113
|
-
- `.config/autoreadmerc.cjs`
|
|
120
|
+
- `.config/autoreadmerc`
|
|
121
|
+
- `autoreadme.config.cjs`
|
|
114
122
|
- `autoreadme.config.js`
|
|
115
|
-
- `autoreadme.config.ts`
|
|
116
123
|
- `autoreadme.config.mjs`
|
|
117
|
-
- `autoreadme.config.
|
|
124
|
+
- `autoreadme.config.ts`
|
|
118
125
|
|
|
119
126
|
#### JSON Example
|
|
120
127
|
|
|
@@ -176,6 +183,7 @@ _Object containing the following properties:_
|
|
|
176
183
|
| Property | Description | Type | Default |
|
|
177
184
|
| :------------------------ | :---------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
178
185
|
| `affectedRegexes` | | `Array<string>` | `[]` |
|
|
186
|
+
| `collapseHeadings` | | `Array<string>` | `[]` |
|
|
179
187
|
| `defaultLanguage` | Default language to infer projects from | [Language](#language) | |
|
|
180
188
|
| `disableEmojis` | Whether or not to use emojis in markdown table headings | `boolean` | `false` |
|
|
181
189
|
| `disableMarkdownHeadings` | Whether or not to display markdown headings | `boolean` | `false` |
|
package/config/schema.cjs
CHANGED
|
@@ -72,6 +72,7 @@ var defaultTemplates = templatesSchema.parse({});
|
|
|
72
72
|
var defaultTableHeadings = tableHeadingsSchema.parse(void 0);
|
|
73
73
|
var _configSchema = import_zod.z.object({
|
|
74
74
|
affectedRegexes: import_zod.z.string().array().optional().default([]),
|
|
75
|
+
collapseHeadings: import_zod.z.string().array().optional().default([]),
|
|
75
76
|
defaultLanguage: languageSchema.meta({
|
|
76
77
|
alias: "l",
|
|
77
78
|
description: "Default language to infer projects from"
|
package/config/schema.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAEX,IAAM,gBAAgB,aAC3B,KAAK,CAAC,UAAU,OAAO,SAAS,aAAa,KAAK,CAAC,EACnD,SAAS,wBAAwB;AAE5B,IAAM,gBAAgB,aAC3B,KAAK,CAAC,QAAQ,OAAO,CAAC,EACtB,QAAQ,OAAO,EACf,SAAS;AAEJ,IAAM,iBAAiB,aAAE,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,IAAI;AAEnE,IAAM,iBAAiB,aAC5B,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC,EACA,SAAS,uBAAuB;AAE3B,IAAM,sBAAsB,aACjC,OAAO,eAAe,eAAe,MAAM,EAAE,SAAS,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od\";\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\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAEX,IAAM,gBAAgB,aAC3B,KAAK,CAAC,UAAU,OAAO,SAAS,aAAa,KAAK,CAAC,EACnD,SAAS,wBAAwB;AAE5B,IAAM,gBAAgB,aAC3B,KAAK,CAAC,QAAQ,OAAO,CAAC,EACtB,QAAQ,OAAO,EACf,SAAS;AAEJ,IAAM,iBAAiB,aAAE,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,IAAI;AAEnE,IAAM,iBAAiB,aAC5B,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC,EACA,SAAS,uBAAuB;AAE3B,IAAM,sBAAsB,aACjC,OAAO,eAAe,eAAe,MAAM,EAAE,SAAS,CAAC,EACvD,SAAS,EACT,SAAS,oCAAoC,EAC7C,QAAQ;AAAA,EACR,QAAQ,CAAC,QAAQ,YAAY,WAAW,aAAa;AAAA,EACrD,KAAK,CAAC,QAAQ,WAAW,eAAe;AAAA,EACxC,WAAW,CAAC,QAAQ,WAAW,aAAa,aAAa;AAAA,EACzD,KAAK,CAAC;AACP,CAAC;AAEK,IAAM,kBAAkB,aAAE,OAAO;AAAA,EACvC,eAAe,aACb,OAAO,EACP,SAAS,EACT,QAAQ,0DAA0D;AAAA,EACpE,QAAQ,aACN,OAAO,gBAAgB,aAAE,OAAO,CAAC,EACjC,SAAS,EACT,SAAS,wCAAwC,EACjD,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,IACb,eAAe;AAAA,IACf,WAAW;AAAA,IACX,MAAM;AAAA,I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AQ,KAAK,EAAE,KAAK;AAAA,IACvD,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAC;AAAA,EACD,aAAa,aAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK;AAAA,IACnD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,WAAW,gBACT,SAAS,EACT,QAAQ,gBAAgB,EACxB;AAAA,IACA;AAAA,EACD;AAAA,EACD,YAAY,aAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,mBAAmB,EAAE,KAAK;AAAA,IACnE,aAAa;AAAA,EACd,CAAC;AAAA,EACD,WAAW,aAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK;AAAA,IACjD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,cAAc,aAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,OAAO,EAAE,KAAK;AAAA,IACzD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,SAAS,aAAE,QAAQ,EAAE,QAAQ,KAAK,EAAE,KAAK;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAC;AACF,CAAC;AAEM,IAAM,eAAe,cAAc,SAAS;","names":[]}
|
package/config/schema.d.cts
CHANGED
|
@@ -65,6 +65,7 @@ declare const defaultTemplates: {
|
|
|
65
65
|
declare const defaultTableHeadings: Record<"ACTION" | "PKG" | "USAGE" | "WORKSPACE" | "ZOD", ("default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version")[] | undefined>;
|
|
66
66
|
declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
67
67
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
68
|
+
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
68
69
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
69
70
|
JS: "JS";
|
|
70
71
|
RS: "RS";
|
|
@@ -116,6 +117,7 @@ type Config = Partial<z.infer<typeof _configSchema>>;
|
|
|
116
117
|
|
|
117
118
|
declare const _configSchema: z.ZodObject<{
|
|
118
119
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
120
|
+
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
119
121
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
120
122
|
JS: "JS";
|
|
121
123
|
RS: "RS";
|
package/config/schema.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ declare const defaultTemplates: {
|
|
|
65
65
|
declare const defaultTableHeadings: Record<"ACTION" | "PKG" | "USAGE" | "WORKSPACE" | "ZOD", ("default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version")[] | undefined>;
|
|
66
66
|
declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
67
67
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
68
|
+
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
68
69
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
69
70
|
JS: "JS";
|
|
70
71
|
RS: "RS";
|
|
@@ -116,6 +117,7 @@ type Config = Partial<z.infer<typeof _configSchema>>;
|
|
|
116
117
|
|
|
117
118
|
declare const _configSchema: z.ZodObject<{
|
|
118
119
|
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
120
|
+
collapseHeadings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
119
121
|
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
120
122
|
JS: "JS";
|
|
121
123
|
RS: "RS";
|
package/config/schema.js
CHANGED
|
@@ -40,6 +40,7 @@ var defaultTemplates = templatesSchema.parse({});
|
|
|
40
40
|
var defaultTableHeadings = tableHeadingsSchema.parse(void 0);
|
|
41
41
|
var _configSchema = z.object({
|
|
42
42
|
affectedRegexes: z.string().array().optional().default([]),
|
|
43
|
+
collapseHeadings: z.string().array().optional().default([]),
|
|
43
44
|
defaultLanguage: languageSchema.meta({
|
|
44
45
|
alias: "l",
|
|
45
46
|
description: "Default language to infer projects from"
|
package/config/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,gBAAgB,EAC3B,KAAK,CAAC,UAAU,OAAO,SAAS,aAAa,KAAK,CAAC,EACnD,SAAS,wBAAwB;AAE5B,IAAM,gBAAgB,EAC3B,KAAK,CAAC,QAAQ,OAAO,CAAC,EACtB,QAAQ,OAAO,EACf,SAAS;AAEJ,IAAM,iBAAiB,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,IAAI;AAEnE,IAAM,iBAAiB,EAC5B,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC,EACA,SAAS,uBAAuB;AAE3B,IAAM,sBAAsB,EACjC,OAAO,eAAe,eAAe,MAAM,EAAE,SAAS,CAAC,EACvD,SAAS,EACT,SAAS,oCAAoC,EAC7C,QAAQ;AAAA,EACR,QAAQ,CAAC,QAAQ,YAAY,WAAW,aAAa;AAAA,EACrD,KAAK,CAAC,QAAQ,WAAW,eAAe;AAAA,EACxC,WAAW,CAAC,QAAQ,WAAW,aAAa,aAAa;AAAA,EACzD,KAAK,CAAC;AACP,CAAC;AAEK,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACvC,eAAe,EACb,OAAO,EACP,SAAS,EACT,QAAQ,0DAA0D;AAAA,EACpE,QAAQ,EACN,O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3C,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAC;AAAA,EACD,wBAAwB,EAAE,QAAQ,EAAE,QAAQ,KAAK,EAAE,KAAK;AAAA,IACvD,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAC;AAAA,EACD,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK;AAAA,IACnD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,WAAW,gBACT,SAAS,EACT,QAAQ,gBAAgB,EACxB;AAAA,IACA;AAAA,EACD;AAAA,EACD,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,mBAAmB,EAAE,KAAK;AAAA,IACnE,aAAa;AAAA,EACd,CAAC;AAAA,EACD,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK;AAAA,IACjD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,OAAO,EAAE,KAAK;AAAA,IACzD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,SAAS,EAAE,QAAQ,EAAE,QAAQ,KAAK,EAAE,KAAK;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAC;AACF,CAAC;AAEM,IAAM,eAAe,cAAc,SAAS;","names":[]}
|
|
1
|
+
{"version":3,"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\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":";AAAA,SAAS,SAAS;AAEX,IAAM,gBAAgB,EAC3B,KAAK,CAAC,UAAU,OAAO,SAAS,aAAa,KAAK,CAAC,EACnD,SAAS,wBAAwB;AAE5B,IAAM,gBAAgB,EAC3B,KAAK,CAAC,QAAQ,OAAO,CAAC,EACtB,QAAQ,OAAO,EACf,SAAS;AAEJ,IAAM,iBAAiB,EAAE,KA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A,IACjD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,OAAO,EAAE,KAAK;AAAA,IACzD,aAAa;AAAA,EACd,CAAC;AAAA,EACD,SAAS,EAAE,QAAQ,EAAE,QAAQ,KAAK,EAAE,KAAK;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAC;AACF,CAAC;AAEM,IAAM,eAAe,cAAc,SAAS;","names":[]}
|
package/config/schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":
|
|
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"},"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","enableToc","enableUsage","headings","onlyReadmes","onlyShowPublicPackages","removeScope","templates","tocHeading","usageFile","usageHeading","verbose"],"additionalProperties":false}
|
package/config/schema.yaml
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
$schema:
|
|
2
|
-
default: https://unpkg.com/@stephansama/auto-readme@0.1.0/config/schema.json
|
|
3
|
-
type: string
|
|
1
|
+
$schema: https://json-schema.org/draft/2020-12/schema
|
|
4
2
|
type: object
|
|
5
3
|
properties:
|
|
6
4
|
affectedRegexes:
|
|
@@ -8,6 +6,11 @@ properties:
|
|
|
8
6
|
type: array
|
|
9
7
|
items:
|
|
10
8
|
type: string
|
|
9
|
+
collapseHeadings:
|
|
10
|
+
default: []
|
|
11
|
+
type: array
|
|
12
|
+
items:
|
|
13
|
+
type: string
|
|
11
14
|
defaultLanguage:
|
|
12
15
|
alias: l
|
|
13
16
|
description: Default language to infer projects from
|
|
@@ -167,6 +170,7 @@ properties:
|
|
|
167
170
|
type: boolean
|
|
168
171
|
required:
|
|
169
172
|
- affectedRegexes
|
|
173
|
+
- collapseHeadings
|
|
170
174
|
- defaultLanguage
|
|
171
175
|
- disableEmojis
|
|
172
176
|
- disableMarkdownHeadings
|
package/dist/index.cjs
CHANGED
|
@@ -39,31 +39,11 @@ var fsp3 = __toESM(require("fs/promises"), 1);
|
|
|
39
39
|
var import_ora = __toESM(require("ora"), 1);
|
|
40
40
|
|
|
41
41
|
// src/args.ts
|
|
42
|
+
var import_debug = __toESM(require("debug"), 1);
|
|
42
43
|
var import_yargs = __toESM(require("yargs"), 1);
|
|
43
44
|
var import_helpers = require("yargs/helpers");
|
|
44
45
|
var import_zod2 = __toESM(require("zod"), 1);
|
|
45
46
|
|
|
46
|
-
// src/log.ts
|
|
47
|
-
var import_chalk = __toESM(require("chalk"), 1);
|
|
48
|
-
var verbosity = 0;
|
|
49
|
-
function ERROR(...rest) {
|
|
50
|
-
const [first, ...remaining] = rest;
|
|
51
|
-
console.error(import_chalk.default.red(first), ...remaining);
|
|
52
|
-
}
|
|
53
|
-
function INFO(...rest) {
|
|
54
|
-
if (verbosity < 1) return;
|
|
55
|
-
const [first, ...remaining] = rest;
|
|
56
|
-
console.info(import_chalk.default.blue(first), ...remaining);
|
|
57
|
-
}
|
|
58
|
-
function setVerbosity(input) {
|
|
59
|
-
verbosity = input;
|
|
60
|
-
}
|
|
61
|
-
function WARN(...rest) {
|
|
62
|
-
if (verbosity < 1) return;
|
|
63
|
-
const [first, ...remaining] = rest;
|
|
64
|
-
console.warn(import_chalk.default.yellow(first), ...remaining);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
47
|
// src/schema.js
|
|
68
48
|
var import_zod = require("zod");
|
|
69
49
|
var actionsSchema = import_zod.z.enum(["ACTION", "PKG", "USAGE", "WORKSPACE", "ZOD"]).describe("Comment action options");
|
|
@@ -106,6 +86,7 @@ var defaultTemplates = templatesSchema.parse({});
|
|
|
106
86
|
var defaultTableHeadings = tableHeadingsSchema.parse(void 0);
|
|
107
87
|
var _configSchema = import_zod.z.object({
|
|
108
88
|
affectedRegexes: import_zod.z.string().array().optional().default([]),
|
|
89
|
+
collapseHeadings: import_zod.z.string().array().optional().default([]),
|
|
109
90
|
defaultLanguage: languageSchema.meta({
|
|
110
91
|
alias: "l",
|
|
111
92
|
description: "Default language to infer projects from"
|
|
@@ -156,7 +137,12 @@ var _configSchema = import_zod.z.object({
|
|
|
156
137
|
var configSchema = _configSchema.optional();
|
|
157
138
|
|
|
158
139
|
// src/args.ts
|
|
159
|
-
var complexOptions = [
|
|
140
|
+
var complexOptions = [
|
|
141
|
+
"affectedRegexes",
|
|
142
|
+
"collapseHeadings",
|
|
143
|
+
"headings",
|
|
144
|
+
"templates"
|
|
145
|
+
];
|
|
160
146
|
var args = {
|
|
161
147
|
...zodToYargs(),
|
|
162
148
|
changes: {
|
|
@@ -176,7 +162,7 @@ var args = {
|
|
|
176
162
|
async function parseArgs() {
|
|
177
163
|
const yargsInstance = (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).options(args).help("h").alias("h", "help").epilogue(`--> @stephansama open-source ${(/* @__PURE__ */ new Date()).getFullYear()}`);
|
|
178
164
|
const parsed = await yargsInstance.wrap(yargsInstance.terminalWidth()).parse();
|
|
179
|
-
if (parsed.verbose)
|
|
165
|
+
if (parsed.verbose) import_debug.default.enable("autoreadme*");
|
|
180
166
|
return parsed;
|
|
181
167
|
}
|
|
182
168
|
function zodToYargs() {
|
|
@@ -201,10 +187,31 @@ function zodToYargs() {
|
|
|
201
187
|
return Object.fromEntries(entries);
|
|
202
188
|
}
|
|
203
189
|
|
|
190
|
+
// src/comment.ts
|
|
191
|
+
var import_mdast_comment_marker = require("mdast-comment-marker");
|
|
192
|
+
|
|
193
|
+
// src/log.ts
|
|
194
|
+
var import_debug2 = __toESM(require("debug"), 1);
|
|
195
|
+
var error = (0, import_debug2.default)("autoreadme:error");
|
|
196
|
+
var info = (0, import_debug2.default)("autoreadme:info");
|
|
197
|
+
var warn = (0, import_debug2.default)("autoreadme:warn");
|
|
198
|
+
function ERROR(...rest) {
|
|
199
|
+
const [first, ...remaining] = rest;
|
|
200
|
+
error(`${first} %O`, ...remaining);
|
|
201
|
+
}
|
|
202
|
+
function INFO(...rest) {
|
|
203
|
+
const [first, ...remaining] = rest;
|
|
204
|
+
info(`${first} %O`, ...remaining);
|
|
205
|
+
}
|
|
206
|
+
function WARN(...rest) {
|
|
207
|
+
const [first, ...remaining] = rest;
|
|
208
|
+
warn(`${first} %O`, ...remaining);
|
|
209
|
+
}
|
|
210
|
+
|
|
204
211
|
// src/comment.ts
|
|
205
212
|
var SEPARATOR = "-";
|
|
206
213
|
function loadAstComments(root) {
|
|
207
|
-
return root.children.map((child) => child.type === "html" && getComment(child
|
|
214
|
+
return root.children.map((child) => child.type === "html" && getComment(child)).filter((f) => f !== false);
|
|
208
215
|
}
|
|
209
216
|
function parseComment(comment) {
|
|
210
217
|
const input = trimComment(comment);
|
|
@@ -228,7 +235,10 @@ function trimComment(comment) {
|
|
|
228
235
|
return comment.replace(startComment, "").replace(/start|end/, "").replace(endComment, "").trim();
|
|
229
236
|
}
|
|
230
237
|
function getComment(comment) {
|
|
231
|
-
|
|
238
|
+
if (!isComment(comment.value)) return false;
|
|
239
|
+
const marker = (0, import_mdast_comment_marker.commentMarker)(comment);
|
|
240
|
+
if (!marker) return false;
|
|
241
|
+
return parseComment(comment.value);
|
|
232
242
|
}
|
|
233
243
|
function isComment(comment) {
|
|
234
244
|
return comment.startsWith(startComment) && comment.endsWith(endComment);
|
|
@@ -415,8 +425,8 @@ async function loadActionData(actions, file, root) {
|
|
|
415
425
|
}
|
|
416
426
|
const inputPath = find("path");
|
|
417
427
|
if (!inputPath) {
|
|
418
|
-
const
|
|
419
|
-
throw new Error(
|
|
428
|
+
const error2 = `no path found for zod table at markdown file ${file}`;
|
|
429
|
+
throw new Error(error2);
|
|
420
430
|
}
|
|
421
431
|
const body = await (0, import_zod2md.zod2md)({
|
|
422
432
|
entry: path2.resolve(path2.dirname(file), inputPath),
|
|
@@ -440,8 +450,8 @@ async function loadActionYaml(baseDir) {
|
|
|
440
450
|
const actualPath = await fileExists(actionYamlPath) && actionYamlPath || await fileExists(actionYmlPath) && actionYmlPath;
|
|
441
451
|
if (!actualPath) {
|
|
442
452
|
const locations = [actionYmlPath, actionYamlPath];
|
|
443
|
-
const
|
|
444
|
-
throw new Error(
|
|
453
|
+
const error2 = `no yaml file found at locations: ${locations}`;
|
|
454
|
+
throw new Error(error2);
|
|
445
455
|
}
|
|
446
456
|
const actionFile = await fsp2.readFile(actualPath, { encoding: "utf8" });
|
|
447
457
|
return yaml.parse(actionFile);
|
|
@@ -450,9 +460,11 @@ async function loadActionYaml(baseDir) {
|
|
|
450
460
|
// src/pipeline.ts
|
|
451
461
|
var path4 = __toESM(require("path"), 1);
|
|
452
462
|
var import_remark = require("remark");
|
|
463
|
+
var import_remark_code_import = __toESM(require("remark-code-import"), 1);
|
|
453
464
|
var import_remark_collapse = __toESM(require("remark-collapse"), 1);
|
|
454
465
|
var import_remark_toc = __toESM(require("remark-toc"), 1);
|
|
455
466
|
var import_remark_usage = __toESM(require("remark-usage"), 1);
|
|
467
|
+
var import_vfile = require("vfile");
|
|
456
468
|
|
|
457
469
|
// src/plugin.ts
|
|
458
470
|
var import_handlebars = __toESM(require("handlebars"), 1);
|
|
@@ -622,7 +634,7 @@ function loadTemplates(templates) {
|
|
|
622
634
|
|
|
623
635
|
// src/pipeline.ts
|
|
624
636
|
async function parse2(file, filepath, root, config, data) {
|
|
625
|
-
const pipeline = (0, import_remark.remark)().use(autoReadmeRemarkPlugin, config, data);
|
|
637
|
+
const pipeline = (0, import_remark.remark)().use(autoReadmeRemarkPlugin, config, data).use(import_remark_code_import.default, {});
|
|
626
638
|
const usage = data.find((d) => d.action === "USAGE");
|
|
627
639
|
if (usage?.action === "USAGE" || config.enableUsage) {
|
|
628
640
|
const find = createFindParameter(usage?.parameters || []);
|
|
@@ -631,7 +643,7 @@ async function parse2(file, filepath, root, config, data) {
|
|
|
631
643
|
const resolvePath = examplePath && path4.resolve(dirname4, examplePath);
|
|
632
644
|
const relativeProjectPath = config.usageFile && path4.relative(root, path4.resolve(dirname4, config.usageFile));
|
|
633
645
|
const example = examplePath && resolvePath && path4.relative(root, resolvePath) || relativeProjectPath || void 0;
|
|
634
|
-
if (await fileExists(example
|
|
646
|
+
if (example && await fileExists(example)) {
|
|
635
647
|
INFO("generating usage section");
|
|
636
648
|
pipeline.use(import_remark_usage.default, {
|
|
637
649
|
example,
|
|
@@ -643,10 +655,23 @@ async function parse2(file, filepath, root, config, data) {
|
|
|
643
655
|
}
|
|
644
656
|
if (config.enableToc) {
|
|
645
657
|
INFO("generating table of contents section");
|
|
646
|
-
pipeline.use(import_remark_toc.default, { heading: config.tocHeading })
|
|
658
|
+
pipeline.use(import_remark_toc.default, { heading: config.tocHeading });
|
|
659
|
+
}
|
|
660
|
+
if (config.enableToc || config.collapseHeadings?.length) {
|
|
661
|
+
const additional = config.collapseHeadings?.length ? config.collapseHeadings : [];
|
|
662
|
+
const headings = [...additional, config.tocHeading];
|
|
663
|
+
pipeline.use(import_remark_collapse.default, {
|
|
664
|
+
test: {
|
|
665
|
+
ignoreFinalDefinitions: true,
|
|
666
|
+
test: (value, _) => {
|
|
667
|
+
return headings.some((i) => value.trim() === i?.trim());
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
});
|
|
647
671
|
}
|
|
648
|
-
const vfile =
|
|
649
|
-
|
|
672
|
+
const vfile = new import_vfile.VFile({ path: path4.resolve(filepath), value: file });
|
|
673
|
+
const markdown = await pipeline.process(vfile);
|
|
674
|
+
return markdown.toString();
|
|
650
675
|
}
|
|
651
676
|
|
|
652
677
|
// src/index.ts
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/log.ts","../src/schema.js","../src/comment.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tconst opts: cp.CommonExecOptions = { stdio: \"inherit\" };\n\n\tINFO(\"formatting with prettier\");\n\n\tcp.execFileSync(\"prettier\", [\"--write\", ...paths], opts);\n\n\tif (isAffected) {\n\t\tINFO(\"adding affected files to git stage\");\n\n\t\tcp.execFileSync(\"git\", [\"add\", ...paths], opts);\n\t}\n\n\tif (spinner) spinner.stop();\n}\n","import yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { setVerbosity } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\"affectedRegexes\", \"templates\", \"headings\"] as const;\n\ntype ComplexOptions = (typeof complexOptions)[number];\n\nconst args = {\n\t...zodToYargs(),\n\tchanges: {\n\t\talias: \"g\",\n\t\tdefault: false,\n\t\tdescription: \"Check only changed git files\",\n\t\ttype: \"boolean\",\n\t},\n\tcheck: {\n\t\talias: \"k\",\n\t\tdefault: false,\n\t\tdescription: \"Do not write to files. Only check for changes\",\n\t\ttype: \"boolean\",\n\t},\n\tconfig: { alias: \"c\", description: \"Path to config file\", type: \"string\" },\n} satisfies Record<string, Options>;\n\nexport async function parseArgs() {\n\tconst yargsInstance = yargs(hideBin(process.argv))\n\t\t.options(args)\n\t\t.help(\"h\")\n\t\t.alias(\"h\", \"help\")\n\t\t.epilogue(`--> @stephansama open-source ${new Date().getFullYear()}`);\n\n\tconst parsed = await yargsInstance\n\t\t.wrap(yargsInstance.terminalWidth())\n\t\t.parse();\n\n\tif (parsed.verbose) setVerbosity(1);\n\n\treturn parsed;\n}\n\nexport function zodToYargs(): Omit<\n\tRecord<keyof typeof shape, Options>,\n\tComplexOptions\n> {\n\tconst { shape } = configSchema.unwrap();\n\tconst entries = Object.entries(shape).map(([key, value]) => {\n\t\tif (complexOptions.includes(key as ComplexOptions)) return [];\n\t\tif (value.def.innerType instanceof z.ZodObject) return [];\n\t\tconst meta = value.meta();\n\t\tconst { innerType } = value.def;\n\t\tconst isBoolean = innerType instanceof z.ZodBoolean;\n\t\tconst isNumber = innerType instanceof z.ZodNumber;\n\t\tconst isArray = innerType instanceof z.ZodArray;\n\n\t\tconst yargType: Options[\"type\"] =\n\t\t\t(isArray && \"array\") ||\n\t\t\t(isNumber && \"number\") ||\n\t\t\t(isBoolean && \"boolean\") ||\n\t\t\t\"string\";\n\n\t\tconst options: Options = {\n\t\t\tdefault: value.def.defaultValue,\n\t\t\ttype: yargType,\n\t\t};\n\n\t\tif (meta?.alias) options.alias = meta.alias as string;\n\t\tif (meta?.description) options.description = meta.description;\n\n\t\treturn [key, options];\n\t});\n\n\treturn Object.fromEntries(entries);\n}\n","import chalk from \"chalk\";\n\nlet verbosity = 0;\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tconsole.error(chalk.red(first), ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.info(chalk.blue(first), ...remaining);\n}\n\nexport function setVerbosity(input: number) {\n\tverbosity = input;\n}\n\nexport function WARN(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.warn(chalk.yellow(first), ...remaining);\n}\n","import { z } from \"zod\";\n\nexport const actionsSchema = z\n\t.enum([\"ACTION\", \"PKG\", \"USAGE\", \"WORKSPACE\", \"ZOD\"])\n\t.describe(\"Comment action options\");\n\nexport const formatsSchema = z\n\t.enum([\"LIST\", \"TABLE\"])\n\t.default(\"TABLE\")\n\t.optional();\n\nexport const languageSchema = z.enum([\"JS\", \"RS\"]).optional().default(\"JS\");\n\nexport const headingsSchema = z\n\t.enum([\n\t\t\"default\",\n\t\t\"description\",\n\t\t\"devDependency\",\n\t\t\"downloads\",\n\t\t\"name\",\n\t\t\"private\",\n\t\t\"required\",\n\t\t\"version\",\n\t])\n\t.describe(\"Table heading options\");\n\nexport const tableHeadingsSchema = z\n\t.record(actionsSchema, headingsSchema.array().optional())\n\t.optional()\n\t.describe(\"Table heading action configuration\")\n\t.default({\n\t\tACTION: [\"name\", \"required\", \"default\", \"description\"],\n\t\tPKG: [\"name\", \"version\", \"devDependency\"],\n\t\tWORKSPACE: [\"name\", \"version\", \"downloads\", \"description\"],\n\t\tZOD: [],\n\t});\n\nexport const templatesSchema = z.object({\n\tdownloadImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F\"),\n\temojis: z\n\t\t.record(headingsSchema, z.string())\n\t\t.optional()\n\t\t.describe(\"Table heading emojis used when enabled\")\n\t\t.default({\n\t\t\tdefault: \"⚙️\",\n\t\t\tdescription: \"📝\",\n\t\t\tdevDependency: \"💻\",\n\t\t\tdownloads: \"📥\",\n\t\t\tname: \"🏷️\",\n\t\t\tprivate: \"🔒\",\n\t\t\trequired: \"\",\n\t\t\tversion: \"\",\n\t\t}),\n\tregistryUrl: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://www.npmjs.com/package/{{name}}\"),\n\tversionImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\n\t\t\t\"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F\",\n\t\t),\n});\n\nexport const defaultTemplates = templatesSchema.parse({});\nexport const defaultTableHeadings = tableHeadingsSchema.parse(undefined);\n\nconst _configSchema = z.object({\n\taffectedRegexes: z.string().array().optional().default([]),\n\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { Root } from \"mdast\";\n\nimport { INFO } from \"./log\";\nimport { actionsSchema, formatsSchema, languageSchema } from \"./schema\";\n\nexport const SEPARATOR = \"-\" as const;\n\nexport type AstComments = ReturnType<typeof loadAstComments>;\n\nexport function loadAstComments(root: Root) {\n\treturn root.children\n\t\t.map((child) => child.type === \"html\" && getComment(child.value))\n\t\t.filter((f): f is ReturnType<typeof parseComment> => f !== false);\n}\n\nexport function parseComment(comment: string) {\n\tconst input = trimComment(comment);\n\tconst [type, ...parameters] = input.split(\" \");\n\tconst [first, second, third] = type.split(SEPARATOR);\n\n\tINFO(\"parsing inputs\", { first, second, third });\n\n\tconst languageInput = third ? first : undefined;\n\tconst actionInput = third ? second : first;\n\tconst formatInput = third ? third : second;\n\tconst language = languageSchema.parse(languageInput);\n\tconst action = actionsSchema.parse(actionInput);\n\tconst format = formatsSchema.parse(formatInput);\n\tconst isStart = comment.includes(\"start\");\n\tconst parsed = { action, format, isStart, language, parameters };\n\n\tINFO(`Parsed comment ${comment}`, parsed);\n\n\treturn parsed;\n}\n\nconst startComment = \"<!--\";\nconst endComment = \"-->\";\n\nexport function trimComment(comment: string) {\n\treturn comment\n\t\t.replace(startComment, \"\")\n\t\t.replace(/start|end/, \"\")\n\t\t.replace(endComment, \"\")\n\t\t.trim();\n}\n\nfunction getComment(comment: string) {\n\treturn isComment(comment) && parseComment(comment);\n}\n\nfunction isComment(comment: string) {\n\treturn comment.startsWith(startComment) && comment.endsWith(endComment);\n}\n","import toml from \"@iarna/toml\";\nimport { cosmiconfig, getDefaultSearchPlaces, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nconst moduleName = \"autoreadme\";\n\nconst searchPlaces = getSearchPlaces();\n\nconst loaders = { [\".toml\"]: loadToml };\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = { loaders, searchPlaces };\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(moduleName, opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function loadToml(_filepath: string, content: string) {\n\treturn toml.parse(content);\n}\n\nfunction getSearchPlaces() {\n\treturn [\n\t\t...getDefaultSearchPlaces(moduleName),\n\t\t`.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc`,\n\t\t`.config/${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.json`,\n\t\t`.config/.${moduleName}rc.yaml`,\n\t\t`.config/.${moduleName}rc.yml`,\n\t];\n}\n\nfunction removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { createFindParameter } from \"./data\";\nimport { INFO, WARN } from \"./log\";\nimport { autoReadmeRemarkPlugin } from \"./plugin\";\nimport { fileExists } from \"./utils\";\n\nexport async function parse(\n\tfile: string,\n\tfilepath: string,\n\troot: string,\n\tconfig: Config,\n\tdata: ActionData,\n) {\n\tconst pipeline = remark().use(autoReadmeRemarkPlugin, config, data);\n\tconst usage = data.find((d) => d.action === \"USAGE\");\n\n\tif (usage?.action === \"USAGE\" || config.enableUsage) {\n\t\tconst find = createFindParameter(usage?.parameters || []);\n\t\tconst examplePath = find(\"path\");\n\t\tconst dirname = path.dirname(filepath);\n\t\tconst resolvePath = examplePath && path.resolve(dirname, examplePath);\n\t\tconst relativeProjectPath =\n\t\t\tconfig.usageFile &&\n\t\t\tpath.relative(root, path.resolve(dirname, config.usageFile));\n\t\tconst example =\n\t\t\t(examplePath && resolvePath && path.relative(root, resolvePath)) ||\n\t\t\trelativeProjectPath ||\n\t\t\tundefined;\n\n\t\tif (await fileExists(example || \"\")) {\n\t\t\tINFO(\"generating usage section\");\n\t\t\tpipeline.use(remarkUsage, {\n\t\t\t\texample,\n\t\t\t\theading: config.usageHeading,\n\t\t\t});\n\t\t} else {\n\t\t\tWARN(\"not able to find example file for readme\", filepath, example);\n\t\t}\n\t}\n\n\tif (config.enableToc) {\n\t\tINFO(\"generating table of contents section\");\n\t\tpipeline\n\t\t\t.use(remarkToc, { heading: config.tocHeading })\n\t\t\t.use(remarkCollapse, { test: config.tocHeading });\n\t}\n\n\tconst vfile = await pipeline.process(file);\n\treturn vfile.toString();\n}\n","import type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mCAA6B;AAC7B,IAAAC,MAAoB;AACpB,IAAAC,OAAqB;AACrB,iBAAgB;;;ACHhB,mBAAoC;AACpC,qBAAwB;AACxB,IAAAC,cAAc;;;ACFd,mBAAkB;AAElB,IAAI,YAAY;AAET,SAAS,SAAS,MAAiB;AACzC,QAAM,CAAC,OAAO,GAAG,SAAS,IAAI;AAC9B,UAAQ,MAAM,aA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AA,IACb,MAAM,IAAI,OAAOC,UAAS;AACzB,YAAM,OAAO,MAAU,cAASA,OAAM,EAAE,UAAU,OAAO,CAAC;AAE1D,YAAM,WAAW,MAAM;AACtB,cAAM,UAAM,+CAAa,IAAI;AAC7B,eAAO,gBAAgB,GAAG;AAAA,MAC3B,GAAG;AAEH,UAAI,CAAC,QAAQ,QAAQ;AACpB,aAAK,+BAA+BA,KAAI;AACxC,YAAI,CAAC,OAAO,eAAe,CAAC,OAAO,WAAW;AAC7C,iBAAO,MAAM,4BAA4B;AAAA,QAC1C,OAAO;AACN,eAAK,uCAAuCA,KAAI;AAAA,QACjD;AAAA,MACD;AAEA,YAAM,OAAO,MAAM,eAAe,SAASA,OAAM,IAAI;AAErD,WAAK,8BAA8B,IAAI;AAEvC,YAAM,UAAU,MAAMC,OAAM,MAAMD,OAAM,MAAM,QAAQ,IAAI;AAC1D,YAAU,eAAUA,OAAM,OAAO;AAAA,IAClC,CAAC;AAAA,EACF;AAEA,QAAME,QAA6B,EAAE,OAAO,UAAU;AAEtD,OAAK,0BAA0B;AAE/B,EAAG,iBAAa,YAAY,CAAC,WAAW,GAAG,KAAK,GAAGA,KAAI;AAEvD,MAAI,YAAY;AACf,SAAK,oCAAoC;AAEzC,IAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,GAAGA,KAAI;AAAA,EAC/C;AAEA,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["import_mdast_util_from_markdown","cp","fsp","import_zod","chalk","yargs","z","args","opts","deepmerge","toml","fs","fsp","path","glob","path","body","value","ast","heading","path","Handlebars","parse","dirname","remarkUsage","remarkToc","remarkCollapse","args","ora","path","parse","opts"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/schema.js","../src/comment.ts","../src/log.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tconst opts: cp.CommonExecOptions = { stdio: \"inherit\" };\n\n\tINFO(\"formatting with prettier\");\n\n\tcp.execFileSync(\"prettier\", [\"--write\", ...paths], opts);\n\n\tif (isAffected) {\n\t\tINFO(\"adding affected files to git stage\");\n\n\t\tcp.execFileSync(\"git\", [\"add\", ...paths], opts);\n\t}\n\n\tif (spinner) spinner.stop();\n}\n","import 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 { 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\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { 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 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 toml from \"@iarna/toml\";\nimport { cosmiconfig, getDefaultSearchPlaces, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nconst moduleName = \"autoreadme\";\n\nconst searchPlaces = getSearchPlaces();\n\nconst loaders = { [\".toml\"]: loadToml };\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = { loaders, searchPlaces };\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(moduleName, opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function loadToml(_filepath: string, content: string) {\n\treturn toml.parse(content);\n}\n\nfunction getSearchPlaces() {\n\treturn [\n\t\t...getDefaultSearchPlaces(moduleName),\n\t\t`.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc`,\n\t\t`.config/${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.json`,\n\t\t`.config/.${moduleName}rc.yaml`,\n\t\t`.config/.${moduleName}rc.yml`,\n\t];\n}\n\nfunction removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport 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 type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mCAA6B;AAC7B,IAAAC,MAAoB;AAC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AAA,QAC1C,OAAO;AACN,eAAK,uCAAuCA,KAAI;AAAA,QACjD;AAAA,MACD;AAEA,YAAM,OAAO,MAAM,eAAe,SAASA,OAAM,IAAI;AAErD,WAAK,8BAA8B,IAAI;AAEvC,YAAM,UAAU,MAAMC,OAAM,MAAMD,OAAM,MAAM,QAAQ,IAAI;AAC1D,YAAU,eAAUA,OAAM,OAAO;AAAA,IAClC,CAAC;AAAA,EACF;AAEA,QAAME,QAA6B,EAAE,OAAO,UAAU;AAEtD,OAAK,0BAA0B;AAE/B,EAAG,iBAAa,YAAY,CAAC,WAAW,GAAG,KAAK,GAAGA,KAAI;AAEvD,MAAI,YAAY;AACf,SAAK,oCAAoC;AAEzC,IAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,GAAGA,KAAI;AAAA,EAC/C;AAEA,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["import_mdast_util_from_markdown","cp","fsp","import_zod","yargs","debug","z","import_debug","debug","args","opts","deepmerge","toml","fs","fsp","path","glob","error","path","body","value","ast","heading","path","Handlebars","parse","remarkCodeImport","dirname","remarkUsage","remarkToc","remarkCollapse","args","ora","path","parse","opts"]}
|
package/dist/index.js
CHANGED
|
@@ -5,31 +5,11 @@ import * as fsp3 from "fs/promises";
|
|
|
5
5
|
import ora from "ora";
|
|
6
6
|
|
|
7
7
|
// src/args.ts
|
|
8
|
+
import debug from "debug";
|
|
8
9
|
import yargs from "yargs";
|
|
9
10
|
import { hideBin } from "yargs/helpers";
|
|
10
11
|
import z2 from "zod";
|
|
11
12
|
|
|
12
|
-
// src/log.ts
|
|
13
|
-
import chalk from "chalk";
|
|
14
|
-
var verbosity = 0;
|
|
15
|
-
function ERROR(...rest) {
|
|
16
|
-
const [first, ...remaining] = rest;
|
|
17
|
-
console.error(chalk.red(first), ...remaining);
|
|
18
|
-
}
|
|
19
|
-
function INFO(...rest) {
|
|
20
|
-
if (verbosity < 1) return;
|
|
21
|
-
const [first, ...remaining] = rest;
|
|
22
|
-
console.info(chalk.blue(first), ...remaining);
|
|
23
|
-
}
|
|
24
|
-
function setVerbosity(input) {
|
|
25
|
-
verbosity = input;
|
|
26
|
-
}
|
|
27
|
-
function WARN(...rest) {
|
|
28
|
-
if (verbosity < 1) return;
|
|
29
|
-
const [first, ...remaining] = rest;
|
|
30
|
-
console.warn(chalk.yellow(first), ...remaining);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
13
|
// src/schema.js
|
|
34
14
|
import { z } from "zod";
|
|
35
15
|
var actionsSchema = z.enum(["ACTION", "PKG", "USAGE", "WORKSPACE", "ZOD"]).describe("Comment action options");
|
|
@@ -72,6 +52,7 @@ var defaultTemplates = templatesSchema.parse({});
|
|
|
72
52
|
var defaultTableHeadings = tableHeadingsSchema.parse(void 0);
|
|
73
53
|
var _configSchema = z.object({
|
|
74
54
|
affectedRegexes: z.string().array().optional().default([]),
|
|
55
|
+
collapseHeadings: z.string().array().optional().default([]),
|
|
75
56
|
defaultLanguage: languageSchema.meta({
|
|
76
57
|
alias: "l",
|
|
77
58
|
description: "Default language to infer projects from"
|
|
@@ -122,7 +103,12 @@ var _configSchema = z.object({
|
|
|
122
103
|
var configSchema = _configSchema.optional();
|
|
123
104
|
|
|
124
105
|
// src/args.ts
|
|
125
|
-
var complexOptions = [
|
|
106
|
+
var complexOptions = [
|
|
107
|
+
"affectedRegexes",
|
|
108
|
+
"collapseHeadings",
|
|
109
|
+
"headings",
|
|
110
|
+
"templates"
|
|
111
|
+
];
|
|
126
112
|
var args = {
|
|
127
113
|
...zodToYargs(),
|
|
128
114
|
changes: {
|
|
@@ -142,7 +128,7 @@ var args = {
|
|
|
142
128
|
async function parseArgs() {
|
|
143
129
|
const yargsInstance = yargs(hideBin(process.argv)).options(args).help("h").alias("h", "help").epilogue(`--> @stephansama open-source ${(/* @__PURE__ */ new Date()).getFullYear()}`);
|
|
144
130
|
const parsed = await yargsInstance.wrap(yargsInstance.terminalWidth()).parse();
|
|
145
|
-
if (parsed.verbose)
|
|
131
|
+
if (parsed.verbose) debug.enable("autoreadme*");
|
|
146
132
|
return parsed;
|
|
147
133
|
}
|
|
148
134
|
function zodToYargs() {
|
|
@@ -167,10 +153,31 @@ function zodToYargs() {
|
|
|
167
153
|
return Object.fromEntries(entries);
|
|
168
154
|
}
|
|
169
155
|
|
|
156
|
+
// src/comment.ts
|
|
157
|
+
import { commentMarker } from "mdast-comment-marker";
|
|
158
|
+
|
|
159
|
+
// src/log.ts
|
|
160
|
+
import debug2 from "debug";
|
|
161
|
+
var error = debug2("autoreadme:error");
|
|
162
|
+
var info = debug2("autoreadme:info");
|
|
163
|
+
var warn = debug2("autoreadme:warn");
|
|
164
|
+
function ERROR(...rest) {
|
|
165
|
+
const [first, ...remaining] = rest;
|
|
166
|
+
error(`${first} %O`, ...remaining);
|
|
167
|
+
}
|
|
168
|
+
function INFO(...rest) {
|
|
169
|
+
const [first, ...remaining] = rest;
|
|
170
|
+
info(`${first} %O`, ...remaining);
|
|
171
|
+
}
|
|
172
|
+
function WARN(...rest) {
|
|
173
|
+
const [first, ...remaining] = rest;
|
|
174
|
+
warn(`${first} %O`, ...remaining);
|
|
175
|
+
}
|
|
176
|
+
|
|
170
177
|
// src/comment.ts
|
|
171
178
|
var SEPARATOR = "-";
|
|
172
179
|
function loadAstComments(root) {
|
|
173
|
-
return root.children.map((child) => child.type === "html" && getComment(child
|
|
180
|
+
return root.children.map((child) => child.type === "html" && getComment(child)).filter((f) => f !== false);
|
|
174
181
|
}
|
|
175
182
|
function parseComment(comment) {
|
|
176
183
|
const input = trimComment(comment);
|
|
@@ -194,7 +201,10 @@ function trimComment(comment) {
|
|
|
194
201
|
return comment.replace(startComment, "").replace(/start|end/, "").replace(endComment, "").trim();
|
|
195
202
|
}
|
|
196
203
|
function getComment(comment) {
|
|
197
|
-
|
|
204
|
+
if (!isComment(comment.value)) return false;
|
|
205
|
+
const marker = commentMarker(comment);
|
|
206
|
+
if (!marker) return false;
|
|
207
|
+
return parseComment(comment.value);
|
|
198
208
|
}
|
|
199
209
|
function isComment(comment) {
|
|
200
210
|
return comment.startsWith(startComment) && comment.endsWith(endComment);
|
|
@@ -381,8 +391,8 @@ async function loadActionData(actions, file, root) {
|
|
|
381
391
|
}
|
|
382
392
|
const inputPath = find("path");
|
|
383
393
|
if (!inputPath) {
|
|
384
|
-
const
|
|
385
|
-
throw new Error(
|
|
394
|
+
const error2 = `no path found for zod table at markdown file ${file}`;
|
|
395
|
+
throw new Error(error2);
|
|
386
396
|
}
|
|
387
397
|
const body = await zod2md({
|
|
388
398
|
entry: path2.resolve(path2.dirname(file), inputPath),
|
|
@@ -406,8 +416,8 @@ async function loadActionYaml(baseDir) {
|
|
|
406
416
|
const actualPath = await fileExists(actionYamlPath) && actionYamlPath || await fileExists(actionYmlPath) && actionYmlPath;
|
|
407
417
|
if (!actualPath) {
|
|
408
418
|
const locations = [actionYmlPath, actionYamlPath];
|
|
409
|
-
const
|
|
410
|
-
throw new Error(
|
|
419
|
+
const error2 = `no yaml file found at locations: ${locations}`;
|
|
420
|
+
throw new Error(error2);
|
|
411
421
|
}
|
|
412
422
|
const actionFile = await fsp2.readFile(actualPath, { encoding: "utf8" });
|
|
413
423
|
return yaml.parse(actionFile);
|
|
@@ -416,9 +426,11 @@ async function loadActionYaml(baseDir) {
|
|
|
416
426
|
// src/pipeline.ts
|
|
417
427
|
import * as path4 from "path";
|
|
418
428
|
import { remark } from "remark";
|
|
429
|
+
import remarkCodeImport from "remark-code-import";
|
|
419
430
|
import remarkCollapse from "remark-collapse";
|
|
420
431
|
import remarkToc from "remark-toc";
|
|
421
432
|
import remarkUsage from "remark-usage";
|
|
433
|
+
import { VFile } from "vfile";
|
|
422
434
|
|
|
423
435
|
// src/plugin.ts
|
|
424
436
|
import Handlebars from "handlebars";
|
|
@@ -588,7 +600,7 @@ function loadTemplates(templates) {
|
|
|
588
600
|
|
|
589
601
|
// src/pipeline.ts
|
|
590
602
|
async function parse2(file, filepath, root, config, data) {
|
|
591
|
-
const pipeline = remark().use(autoReadmeRemarkPlugin, config, data);
|
|
603
|
+
const pipeline = remark().use(autoReadmeRemarkPlugin, config, data).use(remarkCodeImport, {});
|
|
592
604
|
const usage = data.find((d) => d.action === "USAGE");
|
|
593
605
|
if (usage?.action === "USAGE" || config.enableUsage) {
|
|
594
606
|
const find = createFindParameter(usage?.parameters || []);
|
|
@@ -597,7 +609,7 @@ async function parse2(file, filepath, root, config, data) {
|
|
|
597
609
|
const resolvePath = examplePath && path4.resolve(dirname4, examplePath);
|
|
598
610
|
const relativeProjectPath = config.usageFile && path4.relative(root, path4.resolve(dirname4, config.usageFile));
|
|
599
611
|
const example = examplePath && resolvePath && path4.relative(root, resolvePath) || relativeProjectPath || void 0;
|
|
600
|
-
if (await fileExists(example
|
|
612
|
+
if (example && await fileExists(example)) {
|
|
601
613
|
INFO("generating usage section");
|
|
602
614
|
pipeline.use(remarkUsage, {
|
|
603
615
|
example,
|
|
@@ -609,10 +621,23 @@ async function parse2(file, filepath, root, config, data) {
|
|
|
609
621
|
}
|
|
610
622
|
if (config.enableToc) {
|
|
611
623
|
INFO("generating table of contents section");
|
|
612
|
-
pipeline.use(remarkToc, { heading: config.tocHeading })
|
|
624
|
+
pipeline.use(remarkToc, { heading: config.tocHeading });
|
|
625
|
+
}
|
|
626
|
+
if (config.enableToc || config.collapseHeadings?.length) {
|
|
627
|
+
const additional = config.collapseHeadings?.length ? config.collapseHeadings : [];
|
|
628
|
+
const headings = [...additional, config.tocHeading];
|
|
629
|
+
pipeline.use(remarkCollapse, {
|
|
630
|
+
test: {
|
|
631
|
+
ignoreFinalDefinitions: true,
|
|
632
|
+
test: (value, _) => {
|
|
633
|
+
return headings.some((i) => value.trim() === i?.trim());
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
});
|
|
613
637
|
}
|
|
614
|
-
const vfile =
|
|
615
|
-
|
|
638
|
+
const vfile = new VFile({ path: path4.resolve(filepath), value: file });
|
|
639
|
+
const markdown = await pipeline.process(vfile);
|
|
640
|
+
return markdown.toString();
|
|
616
641
|
}
|
|
617
642
|
|
|
618
643
|
// src/index.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/log.ts","../src/schema.js","../src/comment.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tconst opts: cp.CommonExecOptions = { stdio: \"inherit\" };\n\n\tINFO(\"formatting with prettier\");\n\n\tcp.execFileSync(\"prettier\", [\"--write\", ...paths], opts);\n\n\tif (isAffected) {\n\t\tINFO(\"adding affected files to git stage\");\n\n\t\tcp.execFileSync(\"git\", [\"add\", ...paths], opts);\n\t}\n\n\tif (spinner) spinner.stop();\n}\n","import yargs, { type Options } from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport z from \"zod\";\n\nimport { setVerbosity } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nexport type Args = Awaited<ReturnType<typeof parseArgs>>;\n\nconst complexOptions = [\"affectedRegexes\", \"templates\", \"headings\"] as const;\n\ntype ComplexOptions = (typeof complexOptions)[number];\n\nconst args = {\n\t...zodToYargs(),\n\tchanges: {\n\t\talias: \"g\",\n\t\tdefault: false,\n\t\tdescription: \"Check only changed git files\",\n\t\ttype: \"boolean\",\n\t},\n\tcheck: {\n\t\talias: \"k\",\n\t\tdefault: false,\n\t\tdescription: \"Do not write to files. Only check for changes\",\n\t\ttype: \"boolean\",\n\t},\n\tconfig: { alias: \"c\", description: \"Path to config file\", type: \"string\" },\n} satisfies Record<string, Options>;\n\nexport async function parseArgs() {\n\tconst yargsInstance = yargs(hideBin(process.argv))\n\t\t.options(args)\n\t\t.help(\"h\")\n\t\t.alias(\"h\", \"help\")\n\t\t.epilogue(`--> @stephansama open-source ${new Date().getFullYear()}`);\n\n\tconst parsed = await yargsInstance\n\t\t.wrap(yargsInstance.terminalWidth())\n\t\t.parse();\n\n\tif (parsed.verbose) setVerbosity(1);\n\n\treturn parsed;\n}\n\nexport function zodToYargs(): Omit<\n\tRecord<keyof typeof shape, Options>,\n\tComplexOptions\n> {\n\tconst { shape } = configSchema.unwrap();\n\tconst entries = Object.entries(shape).map(([key, value]) => {\n\t\tif (complexOptions.includes(key as ComplexOptions)) return [];\n\t\tif (value.def.innerType instanceof z.ZodObject) return [];\n\t\tconst meta = value.meta();\n\t\tconst { innerType } = value.def;\n\t\tconst isBoolean = innerType instanceof z.ZodBoolean;\n\t\tconst isNumber = innerType instanceof z.ZodNumber;\n\t\tconst isArray = innerType instanceof z.ZodArray;\n\n\t\tconst yargType: Options[\"type\"] =\n\t\t\t(isArray && \"array\") ||\n\t\t\t(isNumber && \"number\") ||\n\t\t\t(isBoolean && \"boolean\") ||\n\t\t\t\"string\";\n\n\t\tconst options: Options = {\n\t\t\tdefault: value.def.defaultValue,\n\t\t\ttype: yargType,\n\t\t};\n\n\t\tif (meta?.alias) options.alias = meta.alias as string;\n\t\tif (meta?.description) options.description = meta.description;\n\n\t\treturn [key, options];\n\t});\n\n\treturn Object.fromEntries(entries);\n}\n","import chalk from \"chalk\";\n\nlet verbosity = 0;\n\nexport function ERROR(...rest: unknown[]) {\n\tconst [first, ...remaining] = rest;\n\tconsole.error(chalk.red(first), ...remaining);\n}\n\nexport function INFO(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.info(chalk.blue(first), ...remaining);\n}\n\nexport function setVerbosity(input: number) {\n\tverbosity = input;\n}\n\nexport function WARN(...rest: unknown[]) {\n\tif (verbosity < 1) return;\n\tconst [first, ...remaining] = rest;\n\tconsole.warn(chalk.yellow(first), ...remaining);\n}\n","import { z } from \"zod\";\n\nexport const actionsSchema = z\n\t.enum([\"ACTION\", \"PKG\", \"USAGE\", \"WORKSPACE\", \"ZOD\"])\n\t.describe(\"Comment action options\");\n\nexport const formatsSchema = z\n\t.enum([\"LIST\", \"TABLE\"])\n\t.default(\"TABLE\")\n\t.optional();\n\nexport const languageSchema = z.enum([\"JS\", \"RS\"]).optional().default(\"JS\");\n\nexport const headingsSchema = z\n\t.enum([\n\t\t\"default\",\n\t\t\"description\",\n\t\t\"devDependency\",\n\t\t\"downloads\",\n\t\t\"name\",\n\t\t\"private\",\n\t\t\"required\",\n\t\t\"version\",\n\t])\n\t.describe(\"Table heading options\");\n\nexport const tableHeadingsSchema = z\n\t.record(actionsSchema, headingsSchema.array().optional())\n\t.optional()\n\t.describe(\"Table heading action configuration\")\n\t.default({\n\t\tACTION: [\"name\", \"required\", \"default\", \"description\"],\n\t\tPKG: [\"name\", \"version\", \"devDependency\"],\n\t\tWORKSPACE: [\"name\", \"version\", \"downloads\", \"description\"],\n\t\tZOD: [],\n\t});\n\nexport const templatesSchema = z.object({\n\tdownloadImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F\"),\n\temojis: z\n\t\t.record(headingsSchema, z.string())\n\t\t.optional()\n\t\t.describe(\"Table heading emojis used when enabled\")\n\t\t.default({\n\t\t\tdefault: \"⚙️\",\n\t\t\tdescription: \"📝\",\n\t\t\tdevDependency: \"💻\",\n\t\t\tdownloads: \"📥\",\n\t\t\tname: \"🏷️\",\n\t\t\tprivate: \"🔒\",\n\t\t\trequired: \"\",\n\t\t\tversion: \"\",\n\t\t}),\n\tregistryUrl: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"https://www.npmjs.com/package/{{name}}\"),\n\tversionImage: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\n\t\t\t\"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F\",\n\t\t),\n});\n\nexport const defaultTemplates = templatesSchema.parse({});\nexport const defaultTableHeadings = tableHeadingsSchema.parse(undefined);\n\nconst _configSchema = z.object({\n\taffectedRegexes: z.string().array().optional().default([]),\n\tdefaultLanguage: languageSchema.meta({\n\t\talias: \"l\",\n\t\tdescription: \"Default language to infer projects from\",\n\t}),\n\tdisableEmojis: z.boolean().default(false).meta({\n\t\talias: \"e\",\n\t\tdescription: \"Whether or not to use emojis in markdown table headings\",\n\t}),\n\tdisableMarkdownHeadings: z.boolean().default(false).meta({\n\t\tdescription: \"Whether or not to display markdown headings\",\n\t}),\n\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { Root } from \"mdast\";\n\nimport { INFO } from \"./log\";\nimport { actionsSchema, formatsSchema, languageSchema } from \"./schema\";\n\nexport const SEPARATOR = \"-\" as const;\n\nexport type AstComments = ReturnType<typeof loadAstComments>;\n\nexport function loadAstComments(root: Root) {\n\treturn root.children\n\t\t.map((child) => child.type === \"html\" && getComment(child.value))\n\t\t.filter((f): f is ReturnType<typeof parseComment> => f !== false);\n}\n\nexport function parseComment(comment: string) {\n\tconst input = trimComment(comment);\n\tconst [type, ...parameters] = input.split(\" \");\n\tconst [first, second, third] = type.split(SEPARATOR);\n\n\tINFO(\"parsing inputs\", { first, second, third });\n\n\tconst languageInput = third ? first : undefined;\n\tconst actionInput = third ? second : first;\n\tconst formatInput = third ? third : second;\n\tconst language = languageSchema.parse(languageInput);\n\tconst action = actionsSchema.parse(actionInput);\n\tconst format = formatsSchema.parse(formatInput);\n\tconst isStart = comment.includes(\"start\");\n\tconst parsed = { action, format, isStart, language, parameters };\n\n\tINFO(`Parsed comment ${comment}`, parsed);\n\n\treturn parsed;\n}\n\nconst startComment = \"<!--\";\nconst endComment = \"-->\";\n\nexport function trimComment(comment: string) {\n\treturn comment\n\t\t.replace(startComment, \"\")\n\t\t.replace(/start|end/, \"\")\n\t\t.replace(endComment, \"\")\n\t\t.trim();\n}\n\nfunction getComment(comment: string) {\n\treturn isComment(comment) && parseComment(comment);\n}\n\nfunction isComment(comment: string) {\n\treturn comment.startsWith(startComment) && comment.endsWith(endComment);\n}\n","import toml from \"@iarna/toml\";\nimport { cosmiconfig, getDefaultSearchPlaces, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nconst moduleName = \"autoreadme\";\n\nconst searchPlaces = getSearchPlaces();\n\nconst loaders = { [\".toml\"]: loadToml };\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = { loaders, searchPlaces };\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(moduleName, opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function loadToml(_filepath: string, content: string) {\n\treturn toml.parse(content);\n}\n\nfunction getSearchPlaces() {\n\treturn [\n\t\t...getDefaultSearchPlaces(moduleName),\n\t\t`.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc`,\n\t\t`.config/${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.json`,\n\t\t`.config/.${moduleName}rc.yaml`,\n\t\t`.config/.${moduleName}rc.yml`,\n\t];\n}\n\nfunction removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport remarkCollapse from \"remark-collapse\";\nimport remarkToc from \"remark-toc\";\nimport remarkUsage from \"remark-usage\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { createFindParameter } from \"./data\";\nimport { INFO, WARN } from \"./log\";\nimport { autoReadmeRemarkPlugin } from \"./plugin\";\nimport { fileExists } from \"./utils\";\n\nexport async function parse(\n\tfile: string,\n\tfilepath: string,\n\troot: string,\n\tconfig: Config,\n\tdata: ActionData,\n) {\n\tconst pipeline = remark().use(autoReadmeRemarkPlugin, config, data);\n\tconst usage = data.find((d) => d.action === \"USAGE\");\n\n\tif (usage?.action === \"USAGE\" || config.enableUsage) {\n\t\tconst find = createFindParameter(usage?.parameters || []);\n\t\tconst examplePath = find(\"path\");\n\t\tconst dirname = path.dirname(filepath);\n\t\tconst resolvePath = examplePath && path.resolve(dirname, examplePath);\n\t\tconst relativeProjectPath =\n\t\t\tconfig.usageFile &&\n\t\t\tpath.relative(root, path.resolve(dirname, config.usageFile));\n\t\tconst example =\n\t\t\t(examplePath && resolvePath && path.relative(root, resolvePath)) ||\n\t\t\trelativeProjectPath ||\n\t\t\tundefined;\n\n\t\tif (await fileExists(example || \"\")) {\n\t\t\tINFO(\"generating usage section\");\n\t\t\tpipeline.use(remarkUsage, {\n\t\t\t\texample,\n\t\t\t\theading: config.usageHeading,\n\t\t\t});\n\t\t} else {\n\t\t\tWARN(\"not able to find example file for readme\", filepath, example);\n\t\t}\n\t}\n\n\tif (config.enableToc) {\n\t\tINFO(\"generating table of contents section\");\n\t\tpipeline\n\t\t\t.use(remarkToc, { heading: config.tocHeading })\n\t\t\t.use(remarkCollapse, { test: config.tocHeading });\n\t}\n\n\tconst vfile = await pipeline.process(file);\n\treturn vfile.toString();\n}\n","import type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";AAAA,SAAS,gBAAAA,qBAAoB;AAC7B,YAAYC,SAAQ;AACpB,YAAYC,UAAS;AACrB,OAAO,SAAS;;;ACHhB,OAAO,WAA6B;AACpC,SAAS,eAAe;AACxB,OAAOC,QAAO;;;ACFd,OAAO,WAAW;AAElB,IAAI,YAAY;AAET,SAAS,SAAS,MAAiB;AACzC,QAAM,CAAC,OAAO,GAAG,SAAS,IAAI;AAC9B,UAAQ,MAAM,MAAM,IAAI,KAAK,GAAG,GAAG,SAAS;AAC7C;AAEO,SAAS,QAAQ,MAAiB;A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,MAAM;AACtB,cAAM,MAAMC,cAAa,IAAI;AAC7B,eAAO,gBAAgB,GAAG;AAAA,MAC3B,GAAG;AAEH,UAAI,CAAC,QAAQ,QAAQ;AACpB,aAAK,+BAA+BD,KAAI;AACxC,YAAI,CAAC,OAAO,eAAe,CAAC,OAAO,WAAW;AAC7C,iBAAO,MAAM,4BAA4B;AAAA,QAC1C,OAAO;AACN,eAAK,uCAAuCA,KAAI;AAAA,QACjD;AAAA,MACD;AAEA,YAAM,OAAO,MAAM,eAAe,SAASA,OAAM,IAAI;AAErD,WAAK,8BAA8B,IAAI;AAEvC,YAAM,UAAU,MAAME,OAAM,MAAMF,OAAM,MAAM,QAAQ,IAAI;AAC1D,YAAU,eAAUA,OAAM,OAAO;AAAA,IAClC,CAAC;AAAA,EACF;AAEA,QAAMG,QAA6B,EAAE,OAAO,UAAU;AAEtD,OAAK,0BAA0B;AAE/B,EAAG,iBAAa,YAAY,CAAC,WAAW,GAAG,KAAK,GAAGA,KAAI;AAEvD,MAAI,YAAY;AACf,SAAK,oCAAoC;AAEzC,IAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,GAAGA,KAAI;AAAA,EAC/C;AAEA,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["fromMarkdown","cp","fsp","z","z","args","opts","fs","fsp","path","path","path","body","value","ast","heading","path","parse","dirname","args","path","fromMarkdown","parse","opts"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/args.ts","../src/schema.js","../src/comment.ts","../src/log.ts","../src/config.ts","../src/data.ts","../src/utils.ts","../src/pipeline.ts","../src/plugin.ts"],"sourcesContent":["import { fromMarkdown } from \"mdast-util-from-markdown\";\nimport * as cp from \"node:child_process\";\nimport * as fsp from \"node:fs/promises\";\nimport ora from \"ora\";\n\nimport type { Config } from \"./schema\";\n\nimport { parseArgs } from \"./args\";\nimport { loadAstComments } from \"./comment\";\nimport { loadConfig } from \"./config\";\nimport { loadActionData } from \"./data\";\nimport { ERROR, INFO, WARN } from \"./log\";\nimport { parse } from \"./pipeline\";\nimport { findAffectedMarkdowns, getGitRoot, getMarkdownPaths } from \"./utils\";\n\nexport async function run() {\n\tconst args = await parseArgs();\n\tconst config: Config = (await loadConfig(args)) || {};\n\n\tINFO(\"Loaded the following configuration:\", config);\n\n\tconst root = getGitRoot();\n\n\tconst isAffected = args.changes ? \"affected\" : \"\";\n\n\tINFO(`Loading ${!isAffected ? \"all \" : \"affected \"}files`);\n\n\tconst paths = isAffected\n\t\t? findAffectedMarkdowns(root, config)\n\t\t: await getMarkdownPaths(root, config);\n\n\tINFO(\"Loaded the following files:\", paths.join(\"\\n\"));\n\n\tconst type = args.onlyReadmes ? \"readmes\" : \"all markdown files\";\n\n\tif (!paths.length) {\n\t\treturn ERROR(`no ${isAffected} readmes found to update`);\n\t}\n\n\tconst spinner = !args.verbose && ora(`Updating ${type}`).start();\n\n\tawait Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst file = await fsp.readFile(path, { encoding: \"utf8\" });\n\t\t\t// get rid of ast via garbage collector faster\n\t\t\tconst actions = (() => {\n\t\t\t\tconst ast = fromMarkdown(file);\n\t\t\t\treturn loadAstComments(ast);\n\t\t\t})();\n\n\t\t\tif (!actions.length) {\n\t\t\t\tWARN(`no action comments found in`, path);\n\t\t\t\tif (!config.enableUsage || !config.enableToc) {\n\t\t\t\t\treturn ERROR(\"no action or plugins found\");\n\t\t\t\t} else {\n\t\t\t\t\tINFO(\"plugins enabled. continuing parsing\", path);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst data = await loadActionData(actions, path, root);\n\n\t\t\tINFO(\"Loaded comment action data\", data);\n\n\t\t\tconst content = await parse(file, path, root, config, data);\n\t\t\tawait fsp.writeFile(path, content);\n\t\t}),\n\t);\n\n\tconst opts: cp.CommonExecOptions = { stdio: \"inherit\" };\n\n\tINFO(\"formatting with prettier\");\n\n\tcp.execFileSync(\"prettier\", [\"--write\", ...paths], opts);\n\n\tif (isAffected) {\n\t\tINFO(\"adding affected files to git stage\");\n\n\t\tcp.execFileSync(\"git\", [\"add\", ...paths], opts);\n\t}\n\n\tif (spinner) spinner.stop();\n}\n","import 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 { 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\tenableToc: z.boolean().default(false).meta({\n\t\talias: \"t\",\n\t\tdescription: \"generate table of contents for readmes\",\n\t}),\n\tenableUsage: z.boolean().optional().default(false).meta({\n\t\tdescription: \"Whether or not to enable usage plugin\",\n\t}),\n\theadings: tableHeadingsSchema\n\t\t.optional()\n\t\t.default(defaultTableHeadings)\n\t\t.describe(\"List of headings for different table outputs\"),\n\tonlyReadmes: z.boolean().default(true).meta({\n\t\talias: \"r\",\n\t\tdescription: \"Whether or not to only traverse readmes\",\n\t}),\n\tonlyShowPublicPackages: z.boolean().default(false).meta({\n\t\talias: \"p\",\n\t\tdescription: \"Only show public packages in workspaces\",\n\t}),\n\tremoveScope: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Remove common workspace scope\",\n\t}),\n\ttemplates: templatesSchema\n\t\t.optional()\n\t\t.default(defaultTemplates)\n\t\t.describe(\n\t\t\t\"Handlebars templates used to fuel list and table generation\",\n\t\t),\n\ttocHeading: z.string().optional().default(\"Table of contents\").meta({\n\t\tdescription: \"Markdown heading used to generate table of contents\",\n\t}),\n\tusageFile: z.string().optional().default(\"\").meta({\n\t\tdescription: \"Workspace level usage file\",\n\t}),\n\tusageHeading: z.string().optional().default(\"Usage\").meta({\n\t\tdescription: \"Markdown heading used to generate usage example\",\n\t}),\n\tverbose: z.boolean().default(false).meta({\n\t\talias: \"v\",\n\t\tdescription: \"whether or not to display verbose logging\",\n\t}),\n});\n\nexport const configSchema = _configSchema.optional();\n\n/** @typedef {Partial<z.infer<typeof _configSchema>>} Config */\n","import type { 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 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 toml from \"@iarna/toml\";\nimport { cosmiconfig, getDefaultSearchPlaces, type Options } from \"cosmiconfig\";\nimport deepmerge from \"deepmerge\";\n\nimport type { Args } from \"./args\";\n\nimport { INFO, WARN } from \"./log\";\nimport { configSchema } from \"./schema\";\n\nconst moduleName = \"autoreadme\";\n\nconst searchPlaces = getSearchPlaces();\n\nconst loaders = { [\".toml\"]: loadToml };\n\nexport async function loadConfig(args: Partial<Args>) {\n\tconst opts: Partial<Options> = { loaders, searchPlaces };\n\n\tif (args.config) opts.searchPlaces = [args.config];\n\n\tconst explorer = cosmiconfig(moduleName, opts);\n\n\tconst search = await explorer.search();\n\n\tif (!search) {\n\t\tconst location = args.config ? \" at location: \" + args.config : \"\";\n\t\tWARN(`no config file found`, location);\n\t\tINFO(\"using default configuration\");\n\t} else {\n\t\tINFO(\"found configuration file at: \", search.filepath);\n\t\tINFO(\"loaded cosmiconfig\", search.config);\n\t}\n\n\targs = removeFalsy(args);\n\n\tINFO(\"merging config with args\", args);\n\n\treturn configSchema.parse(\n\t\tdeepmerge(search?.config || {}, args, {\n\t\t\tarrayMerge: (_, sourceArray) => sourceArray,\n\t\t}),\n\t);\n}\n\nexport function loadToml(_filepath: string, content: string) {\n\treturn toml.parse(content);\n}\n\nfunction getSearchPlaces() {\n\treturn [\n\t\t...getDefaultSearchPlaces(moduleName),\n\t\t`.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc`,\n\t\t`.config/${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.toml`,\n\t\t`.config/.${moduleName}rc.json`,\n\t\t`.config/.${moduleName}rc.yaml`,\n\t\t`.config/.${moduleName}rc.yml`,\n\t];\n}\n\nfunction removeFalsy(obj: object) {\n\treturn Object.fromEntries(\n\t\tObject.entries(obj)\n\t\t\t.map(([k, v]) => (!v ? false : [k, v]))\n\t\t\t.filter((e): e is [string, unknown] => Boolean(e)),\n\t);\n}\n","import { getPackages } from \"@manypkg/get-packages\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { readPackageJSON } from \"pkg-types\";\nimport * as yaml from \"yaml\";\nimport { zod2md } from \"zod2md\";\n\nimport type { AstComments } from \"./comment\";\n\nimport { fileExists } from \"./utils\";\n\nexport type ActionData = Awaited<ReturnType<typeof loadActionData>>;\n\nexport type ActionTableHeading = \"name\" | keyof ActionInput;\n\nexport type ActionYaml = { inputs?: Record<string, ActionInput> };\n\ntype ActionInput = {\n\tdefault?: string;\n\tdescription?: string;\n\trequired?: boolean;\n};\n\nexport function createFindParameter(parameterList: string[]) {\n\treturn function (parameterName: string) {\n\t\treturn parameterList\n\t\t\t?.find((p) => p.startsWith(parameterName))\n\t\t\t?.replace(parameterName + \"=\", \"\")\n\t\t\t?.replace(/\"/gi, \"\")\n\t\t\t?.replace(/_/gi, \" \");\n\t};\n}\n\nexport async function loadActionData(\n\tactions: AstComments,\n\tfile: string,\n\troot: string,\n) {\n\tconst startActions = actions.filter((action) => action.isStart);\n\treturn await Promise.all(\n\t\tstartActions.map(async (action) => {\n\t\t\tconst find = createFindParameter(action.parameters);\n\t\t\tswitch (action.action) {\n\t\t\t\tcase \"ACTION\": {\n\t\t\t\t\tconst baseDir = path.dirname(file);\n\t\t\t\t\tconst actionYaml = await loadActionYaml(baseDir);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tactionYaml,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"PKG\": {\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tconst filename = inputPath\n\t\t\t\t\t\t? path.resolve(path.dirname(file), inputPath)\n\t\t\t\t\t\t: path.dirname(file);\n\t\t\t\t\tconst pkgJson = await readPackageJSON(filename);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\tpkgJson,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"USAGE\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"WORKSPACE\": {\n\t\t\t\t\tconst workspaces = await getPackages(process.cwd());\n\t\t\t\t\tconst pnpmPath = path.resolve(root, \"pnpm-workspace.yaml\");\n\t\t\t\t\tconst isPnpm = fs.existsSync(pnpmPath);\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tisPnpm,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t\troot,\n\t\t\t\t\t\tworkspaces,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tcase \"ZOD\": {\n\t\t\t\t\tif (action.format === \"LIST\") {\n\t\t\t\t\t\tthrow new Error(\"cannot display zod in list format\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputPath = find(\"path\");\n\t\t\t\t\tif (!inputPath) {\n\t\t\t\t\t\tconst error = `no path found for zod table at markdown file ${file}`;\n\t\t\t\t\t\tthrow new Error(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst body = await zod2md({\n\t\t\t\t\t\tentry: path.resolve(path.dirname(file), inputPath),\n\t\t\t\t\t\ttitle: find(\"title\") || \"Zod Schema\",\n\t\t\t\t\t});\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\taction: action.action,\n\t\t\t\t\t\tbody,\n\t\t\t\t\t\tparameters: action.parameters,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"feature not yet implemented\");\n\t\t\t}\n\t\t}),\n\t);\n}\n\nasync function loadActionYaml(baseDir: string) {\n\tconst actionYmlPath = path.resolve(baseDir, \"action.yml\");\n\tconst actionYamlPath = path.resolve(baseDir, \"action.yaml\");\n\tconst actualPath =\n\t\t((await fileExists(actionYamlPath)) && actionYamlPath) ||\n\t\t((await fileExists(actionYmlPath)) && actionYmlPath);\n\n\tif (!actualPath) {\n\t\tconst locations = [actionYmlPath, actionYamlPath];\n\t\tconst error = `no yaml file found at locations: ${locations}`;\n\t\tthrow new Error(error);\n\t}\n\n\tconst actionFile = await fsp.readFile(actualPath, { encoding: \"utf8\" });\n\n\treturn yaml.parse(actionFile) as ActionYaml;\n}\n","import glob from \"fast-glob\";\nimport * as cp from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { Config } from \"./schema\";\n\nimport { ERROR, INFO } from \"./log\";\n\nconst sh = String.raw;\n\nconst opts: { encoding: BufferEncoding } = { encoding: \"utf8\" };\n\nconst ignore = [\"**/node_modules/**\"];\n\nconst matches = [\n\t/.*README\\.md$/gi,\n\t/.*Cargo\\.toml$/gi,\n\t/.*action\\.ya?ml$/gi,\n\t/.*package\\.json$/gi,\n\t/.*pnpm-workspace\\.yaml$/gi,\n];\n\nexport async function fileExists(file: string) {\n\treturn await fsp\n\t\t.access(file)\n\t\t.then(() => true)\n\t\t.catch(() => false);\n}\n\nexport function findAffectedMarkdowns(root: string, config: Config) {\n\tconst affected = cp\n\t\t/* cspell:disable-next-line because of the filter */\n\t\t.execSync(sh`git diff --cached --name-only --diff-filter=MACT`, opts)\n\t\t.trim()\n\t\t.split(\"\\n\")\n\t\t.filter(Boolean);\n\n\tif (!affected.length) ERROR(\"no staged files found\");\n\n\tif (config.affectedRegexes?.length) {\n\t\tINFO(\"adding the following expressions: \", config.affectedRegexes);\n\t}\n\n\tconst allMatches = [\n\t\t...matches,\n\t\t...(config.affectedRegexes?.map((r) => new RegExp(r)) || []),\n\t];\n\n\tINFO(\"Checking affected files against regexes\", affected, allMatches);\n\n\tconst eligible = affected.filter((a) => allMatches.some((m) => a.match(m)));\n\n\tINFO(\"Found the following eligible affected files\", eligible);\n\n\tconst md = eligible.map((e) => findNearestReadme(root, path.resolve(e)));\n\tconst rootMd = path.join(root, \"README.md\");\n\tconst dedupe = [...new Set(md), rootMd].filter((s): s is string =>\n\t\tBoolean(s),\n\t);\n\n\tINFO(\"Found the following readmes\", dedupe);\n\n\treturn dedupe;\n}\n\nexport function findNearestReadme(\n\tgitRoot: string,\n\tinputFile: string,\n\tmaxRotations = 15,\n) {\n\tlet dir = path.dirname(inputFile);\n\tlet rotations = 0;\n\n\twhile (true) {\n\t\tconst option = path.join(dir, \"README.md\");\n\n\t\tif (fs.existsSync(option)) return option;\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir || dir === gitRoot || ++rotations > maxRotations) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\treturn null;\n}\n\nexport function getGitRoot() {\n\tconst root = cp.execSync(sh`git rev-parse --show-toplevel`, opts).trim();\n\n\tif (!root) {\n\t\tthrow new Error(\"must be ran within a git directory.\");\n\t}\n\n\tINFO(\"found git root at location: \", root);\n\n\treturn root;\n}\n\nexport async function getMarkdownPaths(cwd: string, config: Config) {\n\tconst pattern = `**/${config?.onlyReadmes ? \"README\" : \"*\"}.md`;\n\tconst readmes = await glob(pattern, { cwd, ignore });\n\treturn readmes.map((readme) => path.resolve(cwd, readme));\n}\n","import * as path from \"node:path\";\nimport { remark } from \"remark\";\nimport 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 type { Root } from \"mdast\";\nimport type { Plugin } from \"unified\";\n\nimport Handlebars from \"handlebars\";\nimport { markdownTable } from \"markdown-table\";\nimport { fromMarkdown } from \"mdast-util-from-markdown\";\nimport { zone } from \"mdast-zone\";\nimport path from \"node:path\";\n\nimport type { ActionData } from \"./data\";\nimport type { Config } from \"./schema\";\n\nimport { parseComment } from \"./comment\";\nimport { defaultTableHeadings, defaultTemplates } from \"./schema\";\n\ntype TemplateContext = {\n\tname: string;\n\turi_name: string;\n};\n\nfunction createHeading(\n\theadings: (keyof NonNullable<Config[\"templates\"]>[\"emojis\"])[],\n\tdisableEmojis = false,\n\temojis: typeof defaultTemplates.emojis = defaultTemplates.emojis,\n) {\n\treturn headings.map(\n\t\t(h) =>\n\t\t\t`${disableEmojis ? \"\" : emojis[h] + \" \"}${h?.at(0)?.toUpperCase() + h?.slice(1)}`,\n\t);\n}\n\nfunction wrapRequired(required: boolean | undefined, input: string) {\n\tif (!required) return input;\n\treturn `<b>*${input}</b>`;\n}\n\nexport const autoReadmeRemarkPlugin: Plugin<[Config, ActionData], Root> =\n\t(config, data) => (tree) => {\n\t\tzone(tree, /.*ZOD.*/gi, function (start, _, end) {\n\t\t\tconst zod = data.find((d) => d?.action === \"ZOD\");\n\t\t\tif (!zod?.body) {\n\t\t\t\tthrow new Error(\"unable to load zod body\");\n\t\t\t}\n\n\t\t\tconst ast = fromMarkdown(zod.body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*ACTION.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst options = value && parseComment(value);\n\t\t\tif (!options) throw new Error(\"not able to parse comment\");\n\n\t\t\tconst first = data.find((d) => d?.action === \"ACTION\");\n\t\t\tconst inputs = first?.actionYaml?.inputs || {};\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🧰\"} actions`;\n\n\t\t\tif (options.format === \"LIST\") {\n\t\t\t\tconst body =\n\t\t\t\t\t`${heading}\\n` +\n\t\t\t\t\tObject.entries(inputs)\n\t\t\t\t\t\t.sort((a) => (a[1].required ? -1 : 1))\n\t\t\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\t\t\treturn `- ${wrapRequired(value.required, key)}: (default: ${value.default})\\n\\n${value.description}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\\n\");\n\t\t\t\tconst ast = fromMarkdown(body);\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.ACTION?.length && config.headings.ACTION) ||\n\t\t\t\tdefaultTableHeadings.ACTION!;\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(inputs).map(([k, v]) =>\n\t\t\t\t\theadings\n\t\t\t\t\t\t.map((heading) => v[heading as keyof typeof v] || k)\n\t\t\t\t\t\t.map(String),\n\t\t\t\t),\n\t\t\t]);\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*WORKSPACE.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst workspace = data.find((d) => d?.action === \"WORKSPACE\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst packages = workspace?.workspaces?.packages || [];\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.WORKSPACE?.length &&\n\t\t\t\t\tconfig.headings?.WORKSPACE) ||\n\t\t\t\tdefaultTableHeadings.WORKSPACE!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\t// throw new Error(\"List is currently not su\")\n\t\t\t}\n\n\t\t\tconst tableHeadings = createHeading(\n\t\t\t\theadings,\n\t\t\t\tconfig.disableEmojis,\n\t\t\t\tconfig.templates?.emojis,\n\t\t\t);\n\n\t\t\tconst table = markdownTable([\n\t\t\t\ttableHeadings,\n\t\t\t\t...packages\n\t\t\t\t\t.filter((pkg) =>\n\t\t\t\t\t\tconfig.onlyShowPublicPackages\n\t\t\t\t\t\t\t? !pkg.packageJson.private\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t)\n\t\t\t\t\t.map((pkg) => {\n\t\t\t\t\t\tconst { name } = pkg.packageJson;\n\t\t\t\t\t\treturn headings.map((heading) => {\n\t\t\t\t\t\t\tif (heading === \"name\") {\n\t\t\t\t\t\t\t\tconst scoped = config.removeScope\n\t\t\t\t\t\t\t\t\t? name.replace(config.removeScope, \"\")\n\t\t\t\t\t\t\t\t\t: name;\n\t\t\t\t\t\t\t\treturn `[${scoped}](${path.relative(\n\t\t\t\t\t\t\t\t\tprocess.cwd(),\n\t\t\t\t\t\t\t\t\tpath.resolve(pkg.dir, \"README.md\"),\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"version\") {\n\t\t\t\t\t\t\t\treturn ` },\n\t\t\t\t\t\t\t\t)})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"downloads\") {\n\t\t\t\t\t\t\t\treturn `})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (heading === \"description\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpkg.packageJson as { description?: string }\n\t\t\t\t\t\t\t\t)?.description;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn ``;\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"🏭\"} workspace`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst ast = fromMarkdown(body);\n\t\t\treturn [start, ast, end];\n\t\t});\n\n\t\tzone(tree, /.*PKG.*/gi, function (start, _, end) {\n\t\t\tconst value = start.type === \"html\" && start.value;\n\t\t\tconst comment = value && parseComment(value);\n\t\t\tconst first = data.find((d) => d?.action === \"PKG\");\n\t\t\tconst templates = loadTemplates(config.templates);\n\t\t\tconst headings =\n\t\t\t\t(config.headings?.PKG?.length && config.headings?.PKG) ||\n\t\t\t\tdefaultTableHeadings.PKG!;\n\n\t\t\tif (comment && comment.format === \"LIST\") {\n\t\t\t\tconst ast = fromMarkdown(\"\");\n\t\t\t\treturn [start, ast, end];\n\t\t\t}\n\n\t\t\tfunction mapDependencies(isDev: boolean) {\n\t\t\t\treturn function ([name, version]: [string, string]) {\n\t\t\t\t\tconst url = templates.registryUrl({ name });\n\t\t\t\t\treturn headings.map((key) => {\n\t\t\t\t\t\tif (key === \"devDependency\") {\n\t\t\t\t\t\t\tif (config.disableEmojis) {\n\t\t\t\t\t\t\t\treturn `\\`${isDev}\\``;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn `${isDev ? \"⌨️\" : \"👥\"}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"name\") {\n\t\t\t\t\t\t\treturn `[${name}](${url})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (key === \"version\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\"workspace\", \"catalog\", \"*\"].some((type) =>\n\t\t\t\t\t\t\t\t\tversion.includes(type),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn `\\`${version}\\``;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ` })})`;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { dependencies = {}, devDependencies = {} } =\n\t\t\t\tfirst?.pkgJson || {};\n\n\t\t\tconst table = markdownTable([\n\t\t\t\tcreateHeading(\n\t\t\t\t\theadings,\n\t\t\t\t\tconfig.disableEmojis,\n\t\t\t\t\tconfig.templates?.emojis,\n\t\t\t\t),\n\t\t\t\t...Object.entries(devDependencies).map(mapDependencies(true)),\n\t\t\t\t...Object.entries(dependencies).map(mapDependencies(false)),\n\t\t\t]);\n\n\t\t\tconst heading = `### ${config.disableEmojis ? \"\" : \"📦\"} packages`;\n\t\t\tconst body = [heading, \"\", table].join(\"\\n\");\n\t\t\tconst tableAst = fromMarkdown(body);\n\n\t\t\treturn [start, tableAst, end];\n\t\t});\n\t};\n\nfunction loadTemplates(\n\ttemplates: Config[\"templates\"],\n): Record<\n\tkeyof NonNullable<Config[\"templates\"]>,\n\t(context: Partial<TemplateContext>) => string\n> {\n\tif (!templates) throw new Error(\"failed to load templates\");\n\n\treturn Object.fromEntries(\n\t\tObject.entries(templates).map(([key, value]) => {\n\t\t\tif (typeof value !== \"string\") return [];\n\t\t\treturn [key, Handlebars.compile(value)];\n\t\t}),\n\t);\n}\n"],"mappings":";AAAA,SAAS,gBAAAA,qBAAoB;AAC7B,YAAYC,SAAQ;AACpB,YAAYC,UAAS;AACrB,OAAO,SAAS;;;ACHhB,OAAO,WAAW;AAClB,OAAO,WAA6B;AACpC,SAAS,eAAe;AACxB,OAAOC,QAAO;;;ACHd,SAAS,SAAS;AAEX,IAAM,gBAAgB,EAC3B,KAAK,CAAC,UAAU,OAAO,SAAS,aAAa,KAAK,CAAC,EACnD,SAAS,wBAAwB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AA,EACF;AAEA,QAAMG,QAA6B,EAAE,OAAO,UAAU;AAEtD,OAAK,0BAA0B;AAE/B,EAAG,iBAAa,YAAY,CAAC,WAAW,GAAG,KAAK,GAAGA,KAAI;AAEvD,MAAI,YAAY;AACf,SAAK,oCAAoC;AAEzC,IAAG,iBAAa,OAAO,CAAC,OAAO,GAAG,KAAK,GAAGA,KAAI;AAAA,EAC/C;AAEA,MAAI,QAAS,SAAQ,KAAK;AAC3B;","names":["fromMarkdown","cp","fsp","z","z","debug","args","opts","fs","fsp","path","error","path","path","body","value","ast","heading","path","parse","dirname","args","path","fromMarkdown","parse","opts"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stephansama/auto-readme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Generate lists and tables for your README automagically based on your repository and comments",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/stephansama/packages",
|
|
7
7
|
"type": "git",
|
|
8
|
-
"directory": "
|
|
8
|
+
"directory": "core/auto-readme"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://packages.stephansama.info/
|
|
10
|
+
"homepage": "https://packages.stephansama.info/api/@stephansama/auto-readme",
|
|
11
11
|
"author": {
|
|
12
12
|
"email": "stephanrandle.dev@gmail.com",
|
|
13
13
|
"name": "Stephan Randle",
|
|
@@ -52,26 +52,32 @@
|
|
|
52
52
|
"@manypkg/get-packages": "^3.1.0",
|
|
53
53
|
"chalk": "^5.5.0",
|
|
54
54
|
"cosmiconfig": "^9.0.0",
|
|
55
|
+
"debug": "^4.4.1",
|
|
55
56
|
"deepmerge": "^4.3.1",
|
|
56
57
|
"fast-glob": "^3.3.3",
|
|
57
58
|
"handlebars": "^4.7.8",
|
|
58
59
|
"markdown-table": "^3.0.4",
|
|
60
|
+
"mdast-comment-marker": "^3.0.0",
|
|
59
61
|
"mdast-util-from-markdown": "^2.0.2",
|
|
60
62
|
"mdast-util-gfm": "^3.1.0",
|
|
61
|
-
"mdast-zone": "
|
|
63
|
+
"mdast-zone": "github:stephansama/mdast-zone#1c5b08cd97240debeed4c9c6afad49df5877a132",
|
|
62
64
|
"ora": "^8.2.0",
|
|
63
65
|
"pkg-types": "^2.2.0",
|
|
64
66
|
"remark": "^15.0.1",
|
|
67
|
+
"remark-code-import": "^1.2.0",
|
|
65
68
|
"remark-collapse": "^0.1.2",
|
|
66
69
|
"remark-toc": "^9.0.0",
|
|
67
70
|
"remark-usage": "^11.0.1",
|
|
71
|
+
"vfile": "^6.0.3",
|
|
68
72
|
"yaml": "^2.8.1",
|
|
69
73
|
"yargs": "^18.0.0",
|
|
70
74
|
"zod": "^4.0.15",
|
|
71
75
|
"zod2md": "^0.2.4"
|
|
72
76
|
},
|
|
73
77
|
"devDependencies": {
|
|
78
|
+
"@types/debug": "^4.1.12",
|
|
74
79
|
"@types/mdast": "^4.0.4",
|
|
80
|
+
"@types/vfile": "^4.0.0",
|
|
75
81
|
"@types/yargs": "^17.0.33",
|
|
76
82
|
"mdast": "^3.0.0",
|
|
77
83
|
"tsup": "^8.3.6",
|