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

Function getChangedCatalogEntries

packages/bumpy/src/commands/check.ts:413–443  ·  view source on GitHub ↗

* Compute which catalog entries changed between the base ref and HEAD. * Returns Map >. Empty if no catalog files changed.

(
  rootDir: string,
  baseBranch: string,
  changedFiles: string[],
)

Source from the content-addressed store, hash-verified

411 * Returns Map<catalogName, Set<depName>>. Empty if no catalog files changed.
412 */
413async function getChangedCatalogEntries(
414 rootDir: string,
415 baseBranch: string,
416 changedFiles: string[],
417): Promise<Map<string, Set<string>>> {
418 const catalogFileChanged = changedFiles.some((f) => (CATALOG_FILES as readonly string[]).includes(f));
419 if (!catalogFileChanged) return new Map();
420
421 const baseRef = getBaseCompareRef(rootDir, baseBranch);
422
423 const pm = await detectPackageManager(rootDir);
424
425 // The workspace YAML that may hold catalogs: pnpm-workspace.yaml for pnpm,
426 // .yarnrc.yml for Yarn, and none for npm/bun (which use package.json).
427 const yamlFile = catalogYamlFile(pm);
428
429 // Load "after" (current working tree state)
430 const afterYaml =
431 yamlFile && (await exists(resolve(rootDir, yamlFile))) ? await readText(resolve(rootDir, yamlFile)) : null;
432 const afterPkgJson = (await exists(resolve(rootDir, 'package.json')))
433 ? await readText(resolve(rootDir, 'package.json'))
434 : null;
435 const afterCatalogs = parseCatalogs(afterYaml, afterPkgJson);
436
437 // Load "before" (state at base ref).
438 const beforeYaml = yamlFile ? readFileAtRef(rootDir, baseRef, yamlFile) : null;
439 const beforePkgJson = readFileAtRef(rootDir, baseRef, 'package.json');
440 const beforeCatalogs = parseCatalogs(beforeYaml, beforePkgJson);
441
442 return diffCatalogMaps(beforeCatalogs, afterCatalogs);
443}

Callers 1

findChangedPackagesFunction · 0.85

Calls 8

getBaseCompareRefFunction · 0.90
detectPackageManagerFunction · 0.90
catalogYamlFileFunction · 0.90
existsFunction · 0.90
readTextFunction · 0.90
parseCatalogsFunction · 0.90
readFileAtRefFunction · 0.90
diffCatalogMapsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…