Package Utils
Installation
Section titled “Installation”pnpm add @theholocron/pkg-utilsimport { dependencyNames, detectPackageManager, readPackageJson } from "@theholocron/pkg-utils";
const pkg = await readPackageJson(process.cwd());dependencyNames(pkg).has("tsdown");detectPackageManager(process.cwd()); // "pnpm" | "npm" | "yarn" | "bun"What is in it
Section titled “What is in it”- A package’s manifest:
readPackageJson,parsePackageJsonanddependencyNames. - A workspace’s packages:
listWorkspacePackagesSyncscans fixed roots;discoverWorkspacePackagesfollows the repo’spnpm-workspace.yaml(or, without one, theworkspacesfield of the rootpackage.json) with pnpm’s*,**and!patterns, and reports a pattern it cannot read instead of throwing. Neither filters byname,versionorprivate, so the caller decides. pnpm-workspace.yamlitself:readWorkspaceGlobs,resolveWorkspaceGlobs,parseCatalogs,addWorkspaceMemberandbumpCatalogPins. These read and edit the file line by line rather than parsing YAML, so thecatalog:andoverrides:blocks keep their formatting.- The package manager:
detectPackageManager.
The full API reference is generated from the package’s TSDoc comments.