MCPcopy Create free account
hub / github.com/dmno-dev/bumpy / mapFilesToPackages

Function mapFilesToPackages

packages/bumpy/src/commands/generate.ts:194–211  ·  view source on GitHub ↗
(
  files: string[],
  packages: Map<string, WorkspacePackage>,
  rootDir: string,
)

Source from the content-addressed store, hash-verified

192
193/** Map file paths to package names based on directory containment */
194export function mapFilesToPackages(
195 files: string[],
196 packages: Map<string, WorkspacePackage>,
197 rootDir: string,
198): string[] {
199 const matched = new Set<string>();
200 for (const file of files) {
201 for (const [name, pkg] of packages) {
202 const pkgRelDir = relative(rootDir, pkg.dir);
203 // Root package (single-package repo) has an empty relative dir, so every
204 // file belongs to it. Otherwise the file must live under the package dir.
205 if (pkgRelDir === '' || file.startsWith(pkgRelDir + '/')) {
206 matched.add(name);
207 }
208 }
209 }
210 return [...matched];
211}
212
213/** Parse raw git log output into individual commits */
214function parseGitLog(raw: string): { hash: string; subject: string; body: string }[] {

Callers 2

generate.test.tsFile · 0.90
generateCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…