How to use parse-github-url - 7 common examples

To help you get started, we’ve selected a few parse-github-url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / shipjs / packages / shipjs-lib / src / lib / git / getRepoInfo.js View on Github external
export default function getRepoInfo(remote, dir) {
  const remoteOriginalUrl = getRemoteOriginUrl(remote, dir);
  const { owner, name, repo, branch } = gh(remoteOriginalUrl);
  const url = `https://github.com/${repo}`;

  return {
    owner, // "algolia"
    name, // "shipjs"
    repo, // "algolia/shipjs"
    branch, // "master"
    url, // "https://github.com/algolia/shipjs"
  };
}
github intuit / auto / plugins / maven / src / index.ts View on Github external
throw new Error(
          'Could not find scm settings in pom.xml. Make sure you set one up that points to your project on GitHub or set owner+repo in your .autorc'
        );
      }

      const github = arrayify(pom.pomObject.project.scm).find(remote =>
        Boolean(remote.url.includes('github'))
      );

      if (!github) {
        throw new Error(
          'Could not find GitHub scm settings in pom.xml. Make sure you set one up that points to your project on GitHub or set owner+repo in your .autorc'
        );
      }

      const repoInfo = parseGitHubUrl(github.url);

      if (!repoInfo || !repoInfo.owner || !repoInfo.name) {
        throw new Error(
          'Cannot read owner and project name from GitHub URL in pom.xml'
        );
      }

      return {
        owner: repoInfo.owner,
        repo: repoInfo.name
      };
    });
github WeBuildWorld / webuild.world / src / pages / Bricks / component.tsx View on Github external
public renderItem(brick: any) {

    const started = moment((brick.dateCreated as any) * 1000).fromNow();
    const expireLabel = ((brick.expired as any) * 1000 > new Date().getTime()) ? ' Expires ' : ' Expired ';
    let expired = brick.expired > 0 ? moment((brick.expired as any) * 1000).fromNow() : '';
    expired = expired ? (" • " + expireLabel + expired) : "";
    const detailUrl = "/brick/" + brick.id;
    const desc = "Status " + BrickStatus[brick.status] + " • " + "Opened "
      + started + expired;
    let avatar;
    const uriObj = parser(brick.url);
    if (uriObj && uriObj.owner && uriObj.host === 'github.com') {
      const src = "https://avatars.githubusercontent.com/" + uriObj.owner;
      avatar = ;
    }

    return (
      {brick.value} ETH <i>
        }
      &gt;
        {brick.title}}
          description={desc}</i>
github henry40408 / awesome-stars / app / scripts / contentscript.js View on Github external
function parseGithubURL (url) {
  let parsed = ParseGithubURL(url)
  if (parsed && parsed.host === 'github.com' && parsed.owner && parsed.name) {
    let { owner, name } = parsed
    return { valid: true, owner, name }
  }
  return { valid: false }
}
github henry40408 / awesome-stars / app / scripts / contentscript.jsx View on Github external
function parseGithubURL(url) {
  const parsed = ParseGithubURL(url);

  if (parsed && parsed.host === 'github.com' && parsed.owner && parsed.name) {
    return parsed;
  }

  return null;
}
github antvis / gatsby-theme-antv / @antv / gatsby-theme-antv / site / components / Banner.tsx View on Github external
<p style="{{">
            {t('知源・致远')}
          </p>
        
      ,
    );
  }

  if (showGithubStars) {
    const githubObj = gh(githubUrl);
    if (githubObj &amp;&amp; githubObj.owner &amp;&amp; githubObj.name) {
      renderButtons.push(
        <div>
          
        </div>,
      );
    }
  }

  return (
    <section style="{style}"></section>
github prisma / prisma2 / cli / introspection / src / loader.ts View on Github external
function getTemplateRepositoryTarInformation(template: Template): TemplateRepositoryTarInformation {
  const meta = github(template.repo.uri)
  const uri = [`https://api.github.com/repos`, meta.repo, 'tarball', template.repo.branch].join('/')

  return { uri, files: template.repo.path }
}

parse-github-url

Parse a github URL into an object.

MIT
Latest version published 6 months ago

Package Health Score

77 / 100
Full package analysis

Popular parse-github-url functions