MCPcopy Create free account
hub / github.com/subquery/subql / extractGitInfo

Function extractGitInfo

packages/cli/src/controller/migrate/migrate-controller.ts:25–39  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

23 * @returns The link and branch if the input is a valid git repository url, otherwise undefined.
24 */
25export function extractGitInfo(input: string): {link: string; branch?: string} | undefined {
26 const gitLinkMatch = input.match(githubLinkRegex);
27 const bitBucketLinkMatch = input.match(bitbucketLinkRegex);
28 const sshMatch = input.match(sshRegex);
29 if (!gitLinkMatch && !sshMatch && !bitBucketLinkMatch) {
30 return undefined;
31 }
32 const {branch, domain, repository} = gitLinkMatch?.groups || bitBucketLinkMatch?.groups || {};
33 const link = sshMatch
34 ? input
35 : `https:${
36 gitLinkMatch ? `//github.com` : bitBucketLinkMatch ? `//bitbucket.org` : undefined
37 }/${domain}/${repository}`;
38 return {link, branch};
39}
40
41// improve project info from the graph package json
42export function improveProjectInfo(subgraphDir: string, subgraphManifest: SubgraphProject): void {

Callers 2

migrateSubgraphAdapterFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected