From 78e916538404e9e73a46f54cdac801fbd5fa76ac Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 6 Feb 2024 01:04:00 +0100 Subject: [PATCH] feat(jsdocs): upper-first headings --- package.json | 1 + pnpm-lock.yaml | 3 +++ src/generators/jsdocs.ts | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2f30459..a164714 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "citty": "^0.1.5", "consola": "^3.2.3", "magic-string": "^0.30.7", + "scule": "^1.2.0", "untyped": "^1.4.2" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9559a00..9d05600 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ dependencies: magic-string: specifier: ^0.30.7 version: 0.30.7 + scule: + specifier: ^1.2.0 + version: 1.2.0 untyped: specifier: ^1.4.2 version: 1.4.2 diff --git a/src/generators/jsdocs.ts b/src/generators/jsdocs.ts index 4a8a999..e53a3ba 100644 --- a/src/generators/jsdocs.ts +++ b/src/generators/jsdocs.ts @@ -1,6 +1,7 @@ import { resolve } from "node:path"; import { loadSchema } from "untyped/loader"; import type { Schema } from "untyped"; +import { upperFirst } from "scule"; import { defineGenerator } from "../generator"; export default defineGenerator({ @@ -78,7 +79,7 @@ function renderSchema(schema: Schema, opts: { headingLevel: number }) { return a.localeCompare(b); })) { if (group) { - lines.push(`${"#".repeat(opts.headingLevel)} ${group}`, ""); + lines.push(`${"#".repeat(opts.headingLevel)} ${upperFirst(group)}`, ""); } for (const item of sections[group].sort((i1, i2) => i1[0].localeCompare(i2[0]),