Skip to content

Commit c214999

Browse files
committed
docs: update docs build
1 parent 637f91d commit c214999

3 files changed

Lines changed: 51 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dev": "tsc --watch",
2020
"cmd": "ts-node src/sample.ts",
2121
"test": "jest",
22-
"doc": "typedoc --out docs src/**/*.ts --exclude src/sample.ts --plugin typedoc-plugin-zod --theme default",
22+
"doc": "typedoc",
2323
"deploy-doc": "pnpm doc && gh-pages -d docs",
2424
"semantic-release": "semantic-release"
2525
},

src/help.ts

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,21 @@ export const HelpConfig = z.object({
6565
/** Style of the help subtitles for commands, options and examples */
6666
subtitleStyle: StringStyle.optional(),
6767
/** Style of the help usage */
68-
usageStyle: StringStyle.optional(),
68+
usageStyle: z
69+
.object({
70+
/** Style of the help usage title - appears before the usage text (custom or auto) */
71+
prefix: StringStyle.optional(),
72+
/**
73+
* For custom usage text, this is the primary style used (right after the `prefix` style).
74+
* For automated usage text, this style is used for the command/binary name
75+
*/
76+
main: StringStyle.optional(),
77+
/** Style of the help usage commands (if any) */
78+
command: StringStyle.optional(),
79+
/** Style of the help usage options (if any) */
80+
options: StringStyle.optional(),
81+
})
82+
.optional(),
6983
/** Style of the help header */
7084
headerStyle: StringStyle.optional(),
7185
/** Style of the help footer */
@@ -143,8 +157,19 @@ export const defaultHelpConfig: DeepRequired<HelpConfig> = {
143157
color: 'yellow',
144158
},
145159
usageStyle: {
146-
bold: true,
147-
color: 'yellow',
160+
prefix: {
161+
bold: true,
162+
color: 'brightWhite',
163+
},
164+
main: {
165+
color: 'yellow',
166+
},
167+
command: {
168+
color: 'gray',
169+
},
170+
options: {
171+
color: 'gray',
172+
},
148173
},
149174
subtitleStyle: {
150175
bold: true,
@@ -218,7 +243,6 @@ export class HelpGenerator {
218243
),
219244
4,
220245
),
221-
'',
222246
)
223247
})
224248
.join('\n')
@@ -227,13 +251,19 @@ export class HelpGenerator {
227251
return (
228252
strConcat(
229253
_wrap(
230-
format(
231-
usageText ||
232-
[`Usage:`, entry.name, commands.length && '[command]', options.length && '[options]']
254+
usageText
255+
? strConcat(
256+
format('Usage:', this.config.usageStyle.prefix),
257+
format(usageText, this.config.usageStyle.command),
258+
)
259+
: [
260+
format(`Usage:`, this.config.usageStyle.prefix),
261+
format(entry.name, this.config.usageStyle.main),
262+
commands.length && format('[command]', this.config.usageStyle.command),
263+
options.length && format('[options]', this.config.usageStyle.options),
264+
]
233265
.filter(Boolean)
234266
.join(' '),
235-
this.config.usageStyle,
236-
),
237267
),
238268
headerText.length && ['', format(headerText, this.config.descriptionStyle)],
239269
entry.description.length && [

typedoc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"out": "docs",
4+
"entryPoints": [
5+
"src"
6+
],
7+
"theme": "default",
8+
"plugin": [
9+
"typedoc-plugin-zod"
10+
]
11+
}

0 commit comments

Comments
 (0)