How to use the hosted-git-info/git-host-info.js.localhost function in hosted-git-info

To help you get started, we’ve selected a few hosted-git-info 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 npm / pacote / test / git.js View on Github external
// set this up first, so we can use 127.0.0.1 as our "hosted git" service
const httpPort = 18000 + (+process.env.TAP_CHILD_ID || 0)
const hostedUrl = `http://localhost:${httpPort}`
const ghi = require('hosted-git-info/git-host-info.js')
const gitPort = 12345 + (+process.env.TAP_CHILD_ID || 0)
ghi.localhost = {
  protocols: [ 'git+https', 'git+ssh' ],
  domain: `127.0.0.1:${gitPort}`,
  httpstemplate: 'git://{domain}/{user}{#committish}',
  treepath: 'not-implemented',
  tarballtemplate: `${hostedUrl}/repo-HEAD.tgz`,
  // shortcut MUST have a user and project, at least
  shortcuttemplate: '{type}:{user}/x{#committish}',
  pathtemplate: '/{user}{#committish}',
  pathmatch: /^\/(repo|submodule-repo)/,
  hashformat: h => h,
  protocols_re: /^(git):$/
}
ghi.localhostssh = {
  protocols: [ 'git+ssh' ],
  domain: `localhostssh:${gitPort}`,
  sshtemplate: `git://127.0.0.1:${gitPort}/{user}{#committish}`,

hosted-git-info

Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab

ISC
Latest version published 1 day ago

Package Health Score

92 / 100
Full package analysis