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 "";