@stephansama/auto-readme 0.1.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/LICENSE +21 -0
- package/README.md +230 -0
- package/cli.mjs +5 -0
- package/config/schema.cjs +135 -0
- package/config/schema.cjs.map +1 -0
- package/config/schema.d.cts +167 -0
- package/config/schema.d.ts +167 -0
- package/config/schema.js +102 -0
- package/config/schema.js.map +1 -0
- package/config/schema.json +1 -0
- package/config/schema.yaml +182 -0
- package/dist/index.cjs +676 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +641 -0
- package/dist/index.js.map +1 -0
- package/package.json +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Stephan Randle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# Auto Readme 🪄
|
|
2
|
+
|
|
3
|
+
[](https://github.com/stephansama/packages/tree/main/packages/auto-readme)
|
|
4
|
+
[](https://packages.stephansama.info/modules/_stephansama_auto-readme)
|
|
5
|
+
[](https://www.npmjs.com/package/@stephansama/auto-readme)
|
|
6
|
+
[](https://www.npmjs.com/package/@stephansama/auto-readme)
|
|
7
|
+
|
|
8
|
+
Generate lists and tables for your README automagically based on your repository
|
|
9
|
+
|
|
10
|
+
##### Table of contents
|
|
11
|
+
|
|
12
|
+
<details><summary>Open Table of contents</summary>
|
|
13
|
+
|
|
14
|
+
* [Installation](#installation)
|
|
15
|
+
* [Usage](#usage)
|
|
16
|
+
* [CLI Options](#cli-options)
|
|
17
|
+
* [Configuration](#configuration)
|
|
18
|
+
* [Configuration File](#configuration-file)
|
|
19
|
+
* [JSON Example](#json-example)
|
|
20
|
+
* [YAML Example](#yaml-example)
|
|
21
|
+
* [JavaScript Example](#javascript-example)
|
|
22
|
+
* [TypeScript Example](#typescript-example)
|
|
23
|
+
* [Schema](#schema)
|
|
24
|
+
|
|
25
|
+
</details>
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pnpm install @stephansama/auto-readme
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
In order to run the script you need to do two things
|
|
36
|
+
|
|
37
|
+
1. Create either a heading or a comment to enable the corresponding feature
|
|
38
|
+
2. Run the following command:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
pnpx @stephansama/auto-readme [options]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You can run `auto-readme` as a pre-commit git hook to automatically keep your `README`s up to date. For example, you can use `husky` to add the following to your `.husky/pre-commit` file:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
auto-readme -g
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This will run `auto-readme` only when affected `README` files are changed
|
|
51
|
+
|
|
52
|
+
## CLI Options
|
|
53
|
+
|
|
54
|
+
| Option | Alias | Description | Type | Default |
|
|
55
|
+
| :---------- | :---- | :-------------------------------------------- | :-------- | :------ |
|
|
56
|
+
| `--changes` | `-g` | Check only changed git files | `boolean` | `false` |
|
|
57
|
+
| `--check` | `-k` | Do not write to files. Only check for changes | `boolean` | `false` |
|
|
58
|
+
| `--config` | `-c` | Path to config file | `string` | |
|
|
59
|
+
| `--verbose` | `-v` | whether or not to display verbose logging | `boolean` | `false` |
|
|
60
|
+
|
|
61
|
+
Most of the options in the [schema](#schema) below can also be used as command-line flags.
|
|
62
|
+
|
|
63
|
+
## Configuration
|
|
64
|
+
|
|
65
|
+
`auto-readme` can be configured using a variety of files, such as `package.json` with an `auto-readme` property, or a standalone `.autoreadmerc` file. For more information on configuration files, see [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig).
|
|
66
|
+
|
|
67
|
+
### Configuration File
|
|
68
|
+
|
|
69
|
+
You can configure `auto-readme` by creating a configuration file (or object) in the root of your project. The following file formats are supported:
|
|
70
|
+
|
|
71
|
+
* `package.json`
|
|
72
|
+
* `.autoreadmerc`
|
|
73
|
+
* `.autoreadmerc.json`
|
|
74
|
+
* `.autoreadmerc.yaml`
|
|
75
|
+
* `.autoreadmerc.yml`
|
|
76
|
+
* `.autoreadmerc.js`
|
|
77
|
+
* `.autoreadmerc.ts`
|
|
78
|
+
* `.autoreadmerc.mjs`
|
|
79
|
+
* `.autoreadmerc.cjs`
|
|
80
|
+
* `.config/autoreadmerc`
|
|
81
|
+
* `.config/autoreadmerc.json`
|
|
82
|
+
* `.config/autoreadmerc.yaml`
|
|
83
|
+
* `.config/autoreadmerc.yml`
|
|
84
|
+
* `.config/autoreadmerc.js`
|
|
85
|
+
* `.config/autoreadmerc.ts`
|
|
86
|
+
* `.config/autoreadmerc.mjs`
|
|
87
|
+
* `.config/autoreadmerc.cjs`
|
|
88
|
+
* `autoreadme.config.js`
|
|
89
|
+
* `autoreadme.config.ts`
|
|
90
|
+
* `autoreadme.config.mjs`
|
|
91
|
+
* `autoreadme.config.cjs`
|
|
92
|
+
|
|
93
|
+
#### JSON Example
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"$schema": "./node_modules/@stephansama/auto-readme/config/schema.json",
|
|
98
|
+
"disableEmojis": true
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### YAML Example
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
# yaml-language-server: $schema=./node_modules/@stephansama/auto-readme/config/schema.yaml
|
|
106
|
+
disableEmojis: true
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### JavaScript Example
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
/** @type {import('@stephansama/auto-readme').Config} */
|
|
113
|
+
export default {
|
|
114
|
+
disableEmojis: true,
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### TypeScript Example
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import type { Config } from "@stephansama/auto-readme";
|
|
122
|
+
|
|
123
|
+
export default {
|
|
124
|
+
disableEmojis: true,
|
|
125
|
+
} satisfies Config;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Schema
|
|
129
|
+
|
|
130
|
+
<!-- ZOD path="./src/schema.js" start -->
|
|
131
|
+
|
|
132
|
+
# Zod Schema
|
|
133
|
+
|
|
134
|
+
## Actions
|
|
135
|
+
|
|
136
|
+
Comment action options
|
|
137
|
+
|
|
138
|
+
*Enum, one of the following possible values:*
|
|
139
|
+
|
|
140
|
+
* `'ACTION'`
|
|
141
|
+
* `'PKG'`
|
|
142
|
+
* `'USAGE'`
|
|
143
|
+
* `'WORKSPACE'`
|
|
144
|
+
* `'ZOD'`
|
|
145
|
+
|
|
146
|
+
## Config
|
|
147
|
+
|
|
148
|
+
*Object containing the following properties:*
|
|
149
|
+
|
|
150
|
+
| Property | Description | Type | Default |
|
|
151
|
+
| :------------------------ | :---------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
152
|
+
| `affectedRegexes` | | `Array<string>` | `[]` |
|
|
153
|
+
| `defaultLanguage` | Default language to infer projects from | [Language](#language) | |
|
|
154
|
+
| `disableEmojis` | Whether or not to use emojis in markdown table headings | `boolean` | `false` |
|
|
155
|
+
| `disableMarkdownHeadings` | Whether or not to display markdown headings | `boolean` | `false` |
|
|
156
|
+
| `enableToc` | generate table of contents for readmes | `boolean` | `false` |
|
|
157
|
+
| `enableUsage` | Whether or not to enable usage plugin | `boolean` | `false` |
|
|
158
|
+
| `headings` | List of headings for different table outputs | *Object with dynamic keys of type* [Actions](#actions) *and values of type* *Array of [Headings](#headings) items* (*optional*) | `{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]}` |
|
|
159
|
+
| `onlyReadmes` | Whether or not to only traverse readmes | `boolean` | `true` |
|
|
160
|
+
| `onlyShowPublicPackages` | Only show public packages in workspaces | `boolean` | `false` |
|
|
161
|
+
| `removeScope` | Remove common workspace scope | `string` | `''` |
|
|
162
|
+
| `templates` | Handlebars templates used to fuel list and table generation | *Object with properties:*<ul><li>`downloadImage`: `string`</li><li>`emojis`: *Object with dynamic keys of type* [Headings](#headings) *and values of type* `string` - Table heading emojis used when enabled</li><li>`registryUrl`: `string`</li><li>`versionImage`: `string`</li></ul> | `{"downloadImage":"https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F","emojis":{"default":"⚙️","description":"📝","devDependency":"💻","downloads":"📥","name":"🏷️","private":"🔒","required":"","version":""},"registryUrl":"https://www.npmjs.com/package/{{name}}","versionImage":"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F"}` |
|
|
163
|
+
| `tocHeading` | Markdown heading used to generate table of contents | `string` | `'Table of contents'` |
|
|
164
|
+
| `usageFile` | Workspace level usage file | `string` | `''` |
|
|
165
|
+
| `usageHeading` | Markdown heading used to generate usage example | `string` | `'Usage'` |
|
|
166
|
+
| `verbose` | whether or not to display verbose logging | `boolean` | `false` |
|
|
167
|
+
|
|
168
|
+
*All properties are optional.* (*optional*)
|
|
169
|
+
|
|
170
|
+
## Formats
|
|
171
|
+
|
|
172
|
+
*Enum, one of the following possible values:*
|
|
173
|
+
|
|
174
|
+
* `'LIST'`
|
|
175
|
+
* `'TABLE'`
|
|
176
|
+
(*optional*)
|
|
177
|
+
|
|
178
|
+
*Default value:* `'TABLE'`
|
|
179
|
+
|
|
180
|
+
## Headings
|
|
181
|
+
|
|
182
|
+
Table heading options
|
|
183
|
+
|
|
184
|
+
*Enum, one of the following possible values:*
|
|
185
|
+
|
|
186
|
+
* `'default'`
|
|
187
|
+
* `'description'`
|
|
188
|
+
* `'devDependency'`
|
|
189
|
+
* `'downloads'`
|
|
190
|
+
* `'name'`
|
|
191
|
+
* `'private'`
|
|
192
|
+
* `'required'`
|
|
193
|
+
* `'version'`
|
|
194
|
+
|
|
195
|
+
## Language
|
|
196
|
+
|
|
197
|
+
*Enum, one of the following possible values:*
|
|
198
|
+
|
|
199
|
+
* `'JS'`
|
|
200
|
+
* `'RS'`
|
|
201
|
+
(*optional*)
|
|
202
|
+
|
|
203
|
+
*Default value:* `'JS'`
|
|
204
|
+
|
|
205
|
+
## TableHeadings
|
|
206
|
+
|
|
207
|
+
Table heading action configuration
|
|
208
|
+
|
|
209
|
+
*Object record with dynamic keys:*
|
|
210
|
+
|
|
211
|
+
* *keys of type* [Actions](#actions)
|
|
212
|
+
* *values of type* *Array of [Headings](#headings) items* (*optional*)
|
|
213
|
+
(*optional*)
|
|
214
|
+
|
|
215
|
+
*Default value:* `{"ACTION":["name","required","default","description"],"PKG":["name","version","devDependency"],"WORKSPACE":["name","version","downloads","description"],"ZOD":[]}`
|
|
216
|
+
|
|
217
|
+
## Templates
|
|
218
|
+
|
|
219
|
+
*Object containing the following properties:*
|
|
220
|
+
|
|
221
|
+
| Property | Description | Type | Default |
|
|
222
|
+
| :-------------- | :------------------------------------- | :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- |
|
|
223
|
+
| `downloadImage` | | `string` | `'https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F'` |
|
|
224
|
+
| `emojis` | Table heading emojis used when enabled | *Object with dynamic keys of type* [Headings](#headings) *and values of type* `string` | `{"default":"⚙️","description":"📝","devDependency":"💻","downloads":"📥","name":"🏷️","private":"🔒","required":"","version":""}` |
|
|
225
|
+
| `registryUrl` | | `string` | `'https://www.npmjs.com/package/{{name}}'` |
|
|
226
|
+
| `versionImage` | | `string` | `'https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F'` |
|
|
227
|
+
|
|
228
|
+
*All properties are optional.*
|
|
229
|
+
|
|
230
|
+
<!-- ZOD end -->
|
package/cli.mjs
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/schema.js
|
|
21
|
+
var schema_exports = {};
|
|
22
|
+
__export(schema_exports, {
|
|
23
|
+
actionsSchema: () => actionsSchema,
|
|
24
|
+
configSchema: () => configSchema,
|
|
25
|
+
defaultTableHeadings: () => defaultTableHeadings,
|
|
26
|
+
defaultTemplates: () => defaultTemplates,
|
|
27
|
+
formatsSchema: () => formatsSchema,
|
|
28
|
+
headingsSchema: () => headingsSchema,
|
|
29
|
+
languageSchema: () => languageSchema,
|
|
30
|
+
tableHeadingsSchema: () => tableHeadingsSchema,
|
|
31
|
+
templatesSchema: () => templatesSchema
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(schema_exports);
|
|
34
|
+
var import_zod = require("zod");
|
|
35
|
+
var actionsSchema = import_zod.z.enum(["ACTION", "PKG", "USAGE", "WORKSPACE", "ZOD"]).describe("Comment action options");
|
|
36
|
+
var formatsSchema = import_zod.z.enum(["LIST", "TABLE"]).default("TABLE").optional();
|
|
37
|
+
var languageSchema = import_zod.z.enum(["JS", "RS"]).optional().default("JS");
|
|
38
|
+
var headingsSchema = import_zod.z.enum([
|
|
39
|
+
"default",
|
|
40
|
+
"description",
|
|
41
|
+
"devDependency",
|
|
42
|
+
"downloads",
|
|
43
|
+
"name",
|
|
44
|
+
"private",
|
|
45
|
+
"required",
|
|
46
|
+
"version"
|
|
47
|
+
]).describe("Table heading options");
|
|
48
|
+
var tableHeadingsSchema = import_zod.z.record(actionsSchema, headingsSchema.array().optional()).optional().describe("Table heading action configuration").default({
|
|
49
|
+
ACTION: ["name", "required", "default", "description"],
|
|
50
|
+
PKG: ["name", "version", "devDependency"],
|
|
51
|
+
WORKSPACE: ["name", "version", "downloads", "description"],
|
|
52
|
+
ZOD: []
|
|
53
|
+
});
|
|
54
|
+
var templatesSchema = import_zod.z.object({
|
|
55
|
+
downloadImage: import_zod.z.string().optional().default("https://img.shields.io/npm/dw/{{name}}?labelColor=211F1F"),
|
|
56
|
+
emojis: import_zod.z.record(headingsSchema, import_zod.z.string()).optional().describe("Table heading emojis used when enabled").default({
|
|
57
|
+
default: "\u2699\uFE0F",
|
|
58
|
+
description: "\u{1F4DD}",
|
|
59
|
+
devDependency: "\u{1F4BB}",
|
|
60
|
+
downloads: "\u{1F4E5}",
|
|
61
|
+
name: "\u{1F3F7}\uFE0F",
|
|
62
|
+
private: "\u{1F512}",
|
|
63
|
+
required: "",
|
|
64
|
+
version: ""
|
|
65
|
+
}),
|
|
66
|
+
registryUrl: import_zod.z.string().optional().default("https://www.npmjs.com/package/{{name}}"),
|
|
67
|
+
versionImage: import_zod.z.string().optional().default(
|
|
68
|
+
"https://img.shields.io/npm/v/{{uri_name}}?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F"
|
|
69
|
+
)
|
|
70
|
+
});
|
|
71
|
+
var defaultTemplates = templatesSchema.parse({});
|
|
72
|
+
var defaultTableHeadings = tableHeadingsSchema.parse(void 0);
|
|
73
|
+
var _configSchema = import_zod.z.object({
|
|
74
|
+
affectedRegexes: import_zod.z.string().array().optional().default([]),
|
|
75
|
+
defaultLanguage: languageSchema.meta({
|
|
76
|
+
alias: "l",
|
|
77
|
+
description: "Default language to infer projects from"
|
|
78
|
+
}),
|
|
79
|
+
disableEmojis: import_zod.z.boolean().default(false).meta({
|
|
80
|
+
alias: "e",
|
|
81
|
+
description: "Whether or not to use emojis in markdown table headings"
|
|
82
|
+
}),
|
|
83
|
+
disableMarkdownHeadings: import_zod.z.boolean().default(false).meta({
|
|
84
|
+
description: "Whether or not to display markdown headings"
|
|
85
|
+
}),
|
|
86
|
+
enableToc: import_zod.z.boolean().default(false).meta({
|
|
87
|
+
alias: "t",
|
|
88
|
+
description: "generate table of contents for readmes"
|
|
89
|
+
}),
|
|
90
|
+
enableUsage: import_zod.z.boolean().optional().default(false).meta({
|
|
91
|
+
description: "Whether or not to enable usage plugin"
|
|
92
|
+
}),
|
|
93
|
+
headings: tableHeadingsSchema.optional().default(defaultTableHeadings).describe("List of headings for different table outputs"),
|
|
94
|
+
onlyReadmes: import_zod.z.boolean().default(true).meta({
|
|
95
|
+
alias: "r",
|
|
96
|
+
description: "Whether or not to only traverse readmes"
|
|
97
|
+
}),
|
|
98
|
+
onlyShowPublicPackages: import_zod.z.boolean().default(false).meta({
|
|
99
|
+
alias: "p",
|
|
100
|
+
description: "Only show public packages in workspaces"
|
|
101
|
+
}),
|
|
102
|
+
removeScope: import_zod.z.string().optional().default("").meta({
|
|
103
|
+
description: "Remove common workspace scope"
|
|
104
|
+
}),
|
|
105
|
+
templates: templatesSchema.optional().default(defaultTemplates).describe(
|
|
106
|
+
"Handlebars templates used to fuel list and table generation"
|
|
107
|
+
),
|
|
108
|
+
tocHeading: import_zod.z.string().optional().default("Table of contents").meta({
|
|
109
|
+
description: "Markdown heading used to generate table of contents"
|
|
110
|
+
}),
|
|
111
|
+
usageFile: import_zod.z.string().optional().default("").meta({
|
|
112
|
+
description: "Workspace level usage file"
|
|
113
|
+
}),
|
|
114
|
+
usageHeading: import_zod.z.string().optional().default("Usage").meta({
|
|
115
|
+
description: "Markdown heading used to generate usage example"
|
|
116
|
+
}),
|
|
117
|
+
verbose: import_zod.z.boolean().default(false).meta({
|
|
118
|
+
alias: "v",
|
|
119
|
+
description: "whether or not to display verbose logging"
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
var configSchema = _configSchema.optional();
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
actionsSchema,
|
|
126
|
+
configSchema,
|
|
127
|
+
defaultTableHeadings,
|
|
128
|
+
defaultTemplates,
|
|
129
|
+
formatsSchema,
|
|
130
|
+
headingsSchema,
|
|
131
|
+
languageSchema,
|
|
132
|
+
tableHeadingsSchema,
|
|
133
|
+
templatesSchema
|
|
134
|
+
});
|
|
135
|
+
//# sourceMappingURL=schema.cjs.map
|
|
@@ -0,0 +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":"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","names":[]}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const actionsSchema: z.ZodEnum<{
|
|
4
|
+
ACTION: "ACTION";
|
|
5
|
+
PKG: "PKG";
|
|
6
|
+
USAGE: "USAGE";
|
|
7
|
+
WORKSPACE: "WORKSPACE";
|
|
8
|
+
ZOD: "ZOD";
|
|
9
|
+
}>;
|
|
10
|
+
declare const formatsSchema: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
11
|
+
LIST: "LIST";
|
|
12
|
+
TABLE: "TABLE";
|
|
13
|
+
}>>>;
|
|
14
|
+
declare const languageSchema: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
JS: "JS";
|
|
16
|
+
RS: "RS";
|
|
17
|
+
}>>>;
|
|
18
|
+
declare const headingsSchema: z.ZodEnum<{
|
|
19
|
+
default: "default";
|
|
20
|
+
description: "description";
|
|
21
|
+
devDependency: "devDependency";
|
|
22
|
+
downloads: "downloads";
|
|
23
|
+
name: "name";
|
|
24
|
+
private: "private";
|
|
25
|
+
required: "required";
|
|
26
|
+
version: "version";
|
|
27
|
+
}>;
|
|
28
|
+
declare const tableHeadingsSchema: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
29
|
+
ACTION: "ACTION";
|
|
30
|
+
PKG: "PKG";
|
|
31
|
+
USAGE: "USAGE";
|
|
32
|
+
WORKSPACE: "WORKSPACE";
|
|
33
|
+
ZOD: "ZOD";
|
|
34
|
+
}>, z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
35
|
+
default: "default";
|
|
36
|
+
description: "description";
|
|
37
|
+
devDependency: "devDependency";
|
|
38
|
+
downloads: "downloads";
|
|
39
|
+
name: "name";
|
|
40
|
+
private: "private";
|
|
41
|
+
required: "required";
|
|
42
|
+
version: "version";
|
|
43
|
+
}>>>>>>;
|
|
44
|
+
declare const templatesSchema: z.ZodObject<{
|
|
45
|
+
downloadImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
46
|
+
emojis: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
47
|
+
default: "default";
|
|
48
|
+
description: "description";
|
|
49
|
+
devDependency: "devDependency";
|
|
50
|
+
downloads: "downloads";
|
|
51
|
+
name: "name";
|
|
52
|
+
private: "private";
|
|
53
|
+
required: "required";
|
|
54
|
+
version: "version";
|
|
55
|
+
}>, z.ZodString>>>;
|
|
56
|
+
registryUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
57
|
+
versionImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
declare const defaultTemplates: {
|
|
60
|
+
downloadImage: string;
|
|
61
|
+
emojis: Record<"default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version", string>;
|
|
62
|
+
registryUrl: string;
|
|
63
|
+
versionImage: string;
|
|
64
|
+
};
|
|
65
|
+
declare const defaultTableHeadings: Record<"ACTION" | "PKG" | "USAGE" | "WORKSPACE" | "ZOD", ("default" | "description" | "devDependency" | "downloads" | "name" | "private" | "required" | "version")[] | undefined>;
|
|
66
|
+
declare const configSchema: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
68
|
+
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
69
|
+
JS: "JS";
|
|
70
|
+
RS: "RS";
|
|
71
|
+
}>>>;
|
|
72
|
+
disableEmojis: z.ZodDefault<z.ZodBoolean>;
|
|
73
|
+
disableMarkdownHeadings: z.ZodDefault<z.ZodBoolean>;
|
|
74
|
+
enableToc: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
enableUsage: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
76
|
+
headings: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
77
|
+
ACTION: "ACTION";
|
|
78
|
+
PKG: "PKG";
|
|
79
|
+
USAGE: "USAGE";
|
|
80
|
+
WORKSPACE: "WORKSPACE";
|
|
81
|
+
ZOD: "ZOD";
|
|
82
|
+
}>, z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
83
|
+
default: "default";
|
|
84
|
+
description: "description";
|
|
85
|
+
devDependency: "devDependency";
|
|
86
|
+
downloads: "downloads";
|
|
87
|
+
name: "name";
|
|
88
|
+
private: "private";
|
|
89
|
+
required: "required";
|
|
90
|
+
version: "version";
|
|
91
|
+
}>>>>>>>>;
|
|
92
|
+
onlyReadmes: z.ZodDefault<z.ZodBoolean>;
|
|
93
|
+
onlyShowPublicPackages: z.ZodDefault<z.ZodBoolean>;
|
|
94
|
+
removeScope: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
95
|
+
templates: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
96
|
+
downloadImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
97
|
+
emojis: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
98
|
+
default: "default";
|
|
99
|
+
description: "description";
|
|
100
|
+
devDependency: "devDependency";
|
|
101
|
+
downloads: "downloads";
|
|
102
|
+
name: "name";
|
|
103
|
+
private: "private";
|
|
104
|
+
required: "required";
|
|
105
|
+
version: "version";
|
|
106
|
+
}>, z.ZodString>>>;
|
|
107
|
+
registryUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
108
|
+
versionImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
109
|
+
}, z.core.$strip>>>;
|
|
110
|
+
tocHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
111
|
+
usageFile: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
112
|
+
usageHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
113
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
type Config = Partial<z.infer<typeof _configSchema>>;
|
|
116
|
+
|
|
117
|
+
declare const _configSchema: z.ZodObject<{
|
|
118
|
+
affectedRegexes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
119
|
+
defaultLanguage: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
120
|
+
JS: "JS";
|
|
121
|
+
RS: "RS";
|
|
122
|
+
}>>>;
|
|
123
|
+
disableEmojis: z.ZodDefault<z.ZodBoolean>;
|
|
124
|
+
disableMarkdownHeadings: z.ZodDefault<z.ZodBoolean>;
|
|
125
|
+
enableToc: z.ZodDefault<z.ZodBoolean>;
|
|
126
|
+
enableUsage: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
127
|
+
headings: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
128
|
+
ACTION: "ACTION";
|
|
129
|
+
PKG: "PKG";
|
|
130
|
+
USAGE: "USAGE";
|
|
131
|
+
WORKSPACE: "WORKSPACE";
|
|
132
|
+
ZOD: "ZOD";
|
|
133
|
+
}>, z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
134
|
+
default: "default";
|
|
135
|
+
description: "description";
|
|
136
|
+
devDependency: "devDependency";
|
|
137
|
+
downloads: "downloads";
|
|
138
|
+
name: "name";
|
|
139
|
+
private: "private";
|
|
140
|
+
required: "required";
|
|
141
|
+
version: "version";
|
|
142
|
+
}>>>>>>>>;
|
|
143
|
+
onlyReadmes: z.ZodDefault<z.ZodBoolean>;
|
|
144
|
+
onlyShowPublicPackages: z.ZodDefault<z.ZodBoolean>;
|
|
145
|
+
removeScope: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
146
|
+
templates: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
147
|
+
downloadImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
148
|
+
emojis: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
149
|
+
default: "default";
|
|
150
|
+
description: "description";
|
|
151
|
+
devDependency: "devDependency";
|
|
152
|
+
downloads: "downloads";
|
|
153
|
+
name: "name";
|
|
154
|
+
private: "private";
|
|
155
|
+
required: "required";
|
|
156
|
+
version: "version";
|
|
157
|
+
}>, z.ZodString>>>;
|
|
158
|
+
registryUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
159
|
+
versionImage: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
160
|
+
}, z.core.$strip>>>;
|
|
161
|
+
tocHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
162
|
+
usageFile: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
163
|
+
usageHeading: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
164
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
|
|
167
|
+
export { type Config, actionsSchema, configSchema, defaultTableHeadings, defaultTemplates, formatsSchema, headingsSchema, languageSchema, tableHeadingsSchema, templatesSchema };
|