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

Function parseRepoSlug

packages/bumpy/src/core/github-release.ts:269–280  ·  view source on GitHub ↗
(repository: unknown)

Source from the content-addressed store, hash-verified

267
268/** Parse an "owner/repo" slug from a package.json `repository` field (string or object form). */
269export function parseRepoSlug(repository: unknown): string | undefined {
270 const url =
271 typeof repository === 'string'
272 ? repository
273 : repository && typeof repository === 'object' && 'url' in repository
274 ? String((repository as { url?: unknown }).url ?? '')
275 : '';
276 if (!url) return undefined;
277 // Handles git+https://github.com/owner/repo.git, git@github.com:owner/repo.git, https://github.com/owner/repo
278 const match = url.match(/github\.com[/:]([^/]+)\/([^/#]+?)(?:\.git)?\/?(?:[#?].*)?$/);
279 return match ? `${match[1]}/${match[2]}` : undefined;
280}
281
282export interface BuildPublishUrlOptions {
283 /** Configured registry for the package (bumpy config or publishConfig). */

Callers 2

runPublishFlowFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…