How to use the hosted-git-info/git-host-info.js.localhostssh 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
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}`,
  sshurltemplate: `git://127.0.0.1:${gitPort}/{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):$/
}


const remote = `git://localhost:${gitPort}/repo`

hosted-git-info

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

ISC
Latest version published 7 months ago

Package Health Score

89 / 100
Full package analysis