packagesIn
uses tcmts.cli.config.configValue, which uses node:path
The packages a branch's names (or a past namespace's) declare: a library's own packages aren't among them.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { configValue } from "#codebase/tcmts/cli/config"; import { inLibrary, librariesOf, RECORD } from "#codebase/tcmts/cli/libraries"; import { isManifestPath, nsOf, validate } from "#codebase/tcmts/cli/manifests"; import type { Pkg } from "#codebase/tcmts/cli/manifests"; import type { NameRow } from "#codebase/tcmts/store"; export function packagesIn(cb: Codebase, rows: NameRow[]): Pkg[] { const out: Pkg[] = []; // (names given without the files kept with them are a branch's, as `names()` reads them: its records say) const records = rows.some((r) => r.kind === "file") ? rows : cb.store.filesNamed(RECORD); const libraries = librariesOf(records, (h) => cb.store.getDef(h)?.sourceText ?? ""); for (const r of rows) { if (!isManifestPath(r.path) || r.kind === "type" || inLibrary(libraries, r.path)) continue; const manifest = validate( r.path, configValue(cb, r.hash, r.path), cb.store.getDef(r.hash)?.doc, ); const twin = out.find((p) => p.name === manifest.name); if (twin) throw new Error( `two packages are called ${manifest.name}: ${twin.manifestPath} and ${r.path}`, ); out.push({ name: manifest.name, namespace: nsOf(r.path), manifestPath: r.path, manifestHash: r.hash, manifest, }); } return out.sort((a, b) => (a.name < b.name ? -1 : 1)); }
uses
- tcmts.cli.codebase.Codebase
- tcmts.cli.config.configValue
- tcmts.cli.libraries.RECORD
- tcmts.cli.libraries.inLibrary
- tcmts.cli.libraries.librariesOf
- tcmts.cli.manifests.Pkg
- tcmts.cli.manifests.isManifestPath
- tcmts.cli.manifests.nsOf
- tcmts.cli.manifests.validate
- tcmts.store.NameRow
used by
- tcmts.cli.builds.makeBuild
- tcmts.cli.libraries.libraryReport
- tcmts.cli.main.importProject
- tcmts.cli.main.releaseAt
- tcmts.cli.pack.packLibraries
- tcmts.cli.release_pages.publishingList
- tcmts.cli.release_pages.releaseCheck
- tcmts.cli.release_pages.releasePage
- tcmts.cli.releases.contributionsIn
- tcmts.cli.releases.packPackage
- tcmts.cli.releases.packageState
- tcmts.cli.releases.planRelease
- tcmts.cli.run.runChangelog
- tcmts.cli.run.runRelease
- tcmts.cli.run.runReleases
- tcmts.cli.run.runRun
- tcmts.cli.suites.commandsIn
- tcmts.cli.suites.suiteApps
- tcmts.cli.suites.suiteLibraries
- tcmts.cli.suites.suitesIn
- tcmts.dev.checkLibraries