readPackage
uses node:fs
import fs from "node:fs"; import path from "node:path"; export function readPackage(dir: string): { name: string; version: string } | undefined { try { const json = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8")) as { name: string; version: string }; return { name: json.name, version: json.version }; } catch { return undefined; } }