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

Function buildScopeMap

packages/bumpy/src/commands/generate.ts:250–273  ·  view source on GitHub ↗

Build a map of scope aliases → package names from config and package names

(packages: Map<string, WorkspacePackage>, _config: BumpyConfig)

Source from the content-addressed store, hash-verified

248 body: commit.body,
249 };
250}
251
252/** Build a map of scope aliases → package names from config and package names */
253function buildScopeMap(packages: Map<string, WorkspacePackage>, _config: BumpyConfig): Map<string, string[]> {
254 const map = new Map<string, string[]>();
255
256 for (const [name, pkg] of packages) {
257 // Use the last segment of the package name as a scope alias
258 // e.g., @myorg/core → "core", my-pkg → "my-pkg"
259 const shortName = name.includes('/') ? name.split('/').pop()! : name;
260 if (!map.has(shortName)) map.set(shortName, []);
261 map.get(shortName)!.push(name);
262
263 // Also register the full name
264 if (!map.has(name)) map.set(name, []);
265 map.get(name)!.push(name);
266
267 // Use the directory name as an alias too
268 const dirName = pkg.relativeDir.split('/').pop()!;
269 if (dirName !== shortName) {
270 if (!map.has(dirName)) map.set(dirName, []);
271 map.get(dirName)!.push(name);
272 }
273 }
274
275 return map;
276}

Callers 1

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…