owns
Whether a name is the package's own: in its namespace, not in a package nested in it, not its manifest, a test or tool config.
import { isManifestPath, within } from "#codebase/tcmts/cli/manifests"; import type { Pkg } from "#codebase/tcmts/cli/manifests"; import { isTestPath } from "#codebase/tcmts/cli/testing"; export function owns(pkg: Pkg, all: Pkg[], p: string): boolean { if (!within(pkg.namespace, p) || isManifestPath(p) || isTestPath(p) || p.endsWith("lint.config") || p.endsWith("fmt.config")) return false; return !all.some((o) => o !== pkg && o.namespace.length > pkg.namespace.length && within(pkg.namespace, o.namespace) && within(o.namespace, p)); }
uses
- tcmts.cli.manifests.Pkg
- tcmts.cli.manifests.isManifestPath
- tcmts.cli.manifests.within
- tcmts.cli.testing.isTestPath