From 7c095b09cbcca17950481327729ca93ff2b9c938 Mon Sep 17 00:00:00 2001 From: Andrew Walsh Date: Sat, 4 Jul 2026 11:24:58 -0700 Subject: [PATCH] docs: add examples in manifest module --- src/manifest.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/manifest.ts b/src/manifest.ts index e1dedf7..1e3f6bc 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -1,5 +1,15 @@ import fs from "node:fs"; +/** + * Writes manifest entries as newline-delimited, sorted values. + * + * @param filePath Output manifest path. + * @param entries Manifest entries to normalize and write. + * @returns Nothing. + * + * @example + * writeManifest("/tmp/manifest.log", ["git=2.39", "curl=8.5.0"]); + */ export function writeManifest(filePath: string, entries: string[]): void { const normalized = [...entries] .filter(Boolean) @@ -7,6 +17,15 @@ export function writeManifest(filePath: string, entries: string[]): void { fs.writeFileSync(filePath, normalized.join("\n"), "utf8"); } +/** + * Reads a newline-delimited manifest and returns a CSV string. + * + * @param filePath Input manifest path. + * @returns Comma-separated manifest entries or an empty string when missing. + * + * @example + * const csv = readManifestAsCsv("/tmp/manifest.log"); + */ export function readManifestAsCsv(filePath: string): string { if (!fs.existsSync(filePath)) { return "";