{"versions":{"1.0.0":{"name":"find-githost","version":"1.0.0","description":"Get repository info from a directory, package.json, url, npm shorthand or git remote","license":"MIT","author":{"name":"Vincent Weevers"},"scripts":{"test":"standard && hallmark && depcheck && nyc node test.js"},"dependencies":{"find-file-up":"^2.0.1","find-gitdir":"^1.0.0","hosted-git-info":"^3.0.7","is-git-branch-name-valid":"^1.0.1","is-git-ref-name-valid":"^1.0.0","remote-origin-url":"^2.0.0"},"devDependencies":{"depcheck":"^1.3.1","hallmark":"^3.1.0","nyc":"^15.1.0","standard":"^16.0.3","tape":"^5.0.1","tempy":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/vweevers/find-githost.git"},"homepage":"https://github.com/vweevers/find-githost","keywords":["bitbucket","git","github","gitlab","host","origin","package","remote","repository","slug","ssh"],"engines":{"node":">=10"},"gitHead":"4723b036941b9a4c17aeb96a2a3feb39a111a988","bugs":{"url":"https://github.com/vweevers/find-githost/issues"},"_id":"find-githost@1.0.0","_nodeVersion":"12.11.1","_npmVersion":"6.11.3","_npmUser":{"name":"anonymous","email":"dev@vincentweevers.nl"},"maintainers":[{"name":"anonymous","email":"dev@vincentweevers.nl"}],"dist":{"integrity":"sha512-IE89hq1ymq4a6papDtXKIrzuOi1Epn5UXlGGnd3cjIfVTffAEg0WrRAHmoW+PGty/d5gS7iNOBoKiDTyEhsqjQ==","shasum":"ba1923fa4a59dcee1be79aabf3ba5c46ee6a6a27","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/find-githost/-/find-githost-1.0.0.tgz","fileCount":4,"unpackedSize":20609,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf8Fr6CRA9TVsSAnZWagAAg5AP/0c5VPwsZ2fKQGgKRDwD\n0kQe3dqsqREgNJOfRGpI2uWl+7dfSPNCpkvf+ahOtzAttYwS0Yjdy2TeWeSS\nPbT60Hn58uIboNrUPBMxvJwKzX2ERsD8236MRPUvGGIkVLThIp86ilxRb0pA\nWu5GpzHaxpWwkVfybcA8X9wLw1Pj1sZsLpEKnIroHi3u2OzJne0lNRyZaxdw\n2+xurFLBAU8baLuqDwb92Hu7+jZLjkm3wCZz0XzkAlUtKS7mS6hADSkmfx2o\netN4fSQ/jpjVz1rOojFrbNBRQ0C8xiE0f6LCyLneKrwms9OEOkrrJToWCOMO\n699AXrZm6k/yldw+eZv5GWMkhI+6icDE/hEoXUlnfrgZmQjetkFDxnfZ6wMi\nt76lbb4LTakoc0gMqDr44cGY7K2lU4Ghz3ju0unV71DRrxfbZB7X+mHMVcMi\nGbXDn5Fhf+aczFouNTL39PyZqnKcC9gNEnv6KzUjoc1m3+zf3wUd1ynjEeVJ\nMP2PrLhd5G/l3eQpf+6P9b3hrrQXL0SgDjC9XemBNbhTq4Gw2yS+jVxQRD1Z\ni7Z2KtHwBl7gX1XPnB+R7jtywyNFxsIXYYwyImbDiXN3kf6I/SfmRa/hm2H8\ntRq1orur6Wfh5LDtof0IIStw4oyEsJQUpok6JOk3t82uM4ZyN/FwHhuX3kZ6\nVNFr\r\n=10bD\r\n-----END PGP SIGNATURE-----\r\n","size":5940},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/find-githost_1.0.0_1609587450227_0.8537230772898423"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-21T21:36:29.374Z","contributors":[]},"2.0.0":{"name":"find-githost","version":"2.0.0","description":"Get repository info from a directory, package.json, url, npm shorthand or git remote","license":"MIT","author":{"name":"Vincent Weevers"},"scripts":{"test":"standard && hallmark && nyc node test.js"},"dependencies":{"find-file-up":"^2.0.1","find-gitdir":"^1.1.0","hosted-git-info":"^7.0.2","is-git-branch-name-valid":"^1.0.1","is-git-ref-name-valid":"^1.0.0","remote-origin-url":"^2.0.0"},"devDependencies":{"hallmark":"^5.0.1","nyc":"^15.1.0","standard":"^17.0.0","tape":"^5.0.1","tempy":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/vweevers/find-githost.git"},"homepage":"https://github.com/vweevers/find-githost","keywords":["bitbucket","git","github","gitlab","host","origin","package","remote","repository","slug","ssh"],"engines":{"node":">=16"},"_id":"find-githost@2.0.0","gitHead":"42b4b7b51d2891be33d7be7386ee6a6aaade16a5","bugs":{"url":"https://github.com/vweevers/find-githost/issues"},"_nodeVersion":"22.7.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-xpOQB7ZSDrZIUPZFKazuDCtwn6FS9/j2z1rcd9tAWejGzMZldGHpWuvkfHy+jbHZ3JsHPXy7oXGeGoDgiLVphA==","shasum":"5cef5534e87d69e01f1866cba5e8c1007a8b27b4","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/find-githost/-/find-githost-2.0.0.tgz","fileCount":5,"unpackedSize":19764,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGScD5n5j+xIGzceazCImwQoSbXQn1E/EJdVVTCPnlT3AiBn+C7oXR9Q3Thjbv51uR+H4eSGZ9DYtsS6RtFScRqZYg=="}],"size":5926},"_npmUser":{"name":"anonymous","email":"dev@vincentweevers.nl"},"directories":{},"maintainers":[{"name":"anonymous","email":"dev@vincentweevers.nl"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/find-githost_2.0.0_1760708947244_0.9941027264066487"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-10-17T13:49:07.447Z","publish_time":1760708947447,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"2.0.0"},"name":"find-githost","time":{"created":"2022-01-29T00:21:05.623Z","modified":"2025-10-17T13:49:16.369Z","1.0.0":"2021-01-02T11:37:30.460Z","2.0.0":"2025-10-17T13:49:07.447Z"},"readme":"# find-githost\n\n**Get repository info from a directory, `package.json`, url, npm shorthand or git remote.** Backed by the same URL parser as npm. Supports GitHub, GitLab and BitBucket.\n\n[![npm status](http://img.shields.io/npm/v/find-githost.svg)](https://www.npmjs.org/package/find-githost)\n[![node](https://img.shields.io/node/v/find-githost.svg)](https://www.npmjs.org/package/find-githost)\n![Test](https://github.com/vweevers/find-githost/workflows/Test/badge.svg?branch=main)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)\n\n## Usage\n\nGet info from `package.json` or git remote origin, whichever is found first:\n\n```js\nconst Githost = require('find-githost')\nconst githost = Githost.fromDir('.')\n\nconsole.log(githost.type)       // github\nconsole.log(githost.owner)      // vweevers\nconsole.log(githost.name)       // find-githost\nconsole.log(githost.ssh())      // git@github.com:vweevers/find-githost.git\nconsole.log(githost.https())    // https://github.com/vweevers/find-githost.git\nconsole.log(githost.homepage()) // https://github.com/vweevers/find-githost\n```\n\nGet info from URL or npm shorthands:\n\n```js\nconst githost = Githost.fromUrl('vweevers/find-githost#d6aeb7c')\n\nconsole.log(githost.toString())\nconsole.log(githost.browse('README.md'))\nconsole.log(githost.browse('CHANGELOG.md', { committish: 'v1.0.0' }))\n```\n\n```\nvweevers/find-githost#d6aeb7c\nhttps://github.com/vweevers/find-githost/tree/d6aeb7c/README.md\nhttps://github.com/vweevers/find-githost/tree/v1.0.0/CHANGELOG.md\n```\n\n## API\n\n### Factories\n\n#### `githost = Githost.fromUrl(url[, options])`\n\nGet info from a URL or npm shortcut. Recognizes Git, SSH and HTTPS urls, as well as shortcuts (`github:vweevers/find-githost`) and for GitHub specifically, the shorter form `vweevers/find-githost`. Options:\n\n- `committish` (string or boolean): if a string, override the committish of input. If `false`, strip committish.\n- `defaultBranch` (string, default `main`): branch name to use for files and tarballs when committish is not present\n- `optional` (boolean, default false): if no valid URL is found, return `null` instead of throwing an error.\n\nThe `committish` and `defaultBranch` options can also be set per method. See the documentation of methods below, which should also clarify when these options apply.\n\n#### `githost = Githost.fromDir(cwd[, options])`\n\nGet info from `package.json` or git remote origin in the `cwd` directory, whichever is found first.  Options:\n\n- `roam` (boolean, default false): look in parent directories too\n- Other options are passed on to `fromUrl()`.\n\n#### `githost = Githost.fromPkg(cwd[, options])`\n\nGet info from the [`repository`][repository] field of a `package.json` in the `cwd` directory. Options:\n\n- `roam` (boolean, default false): look in parent directories too\n- Other options are passed on to `fromUrl()`.\n\n#### `githost = Githost.fromPkg(pkg[, options])`\n\nGet info from the [`repository`][repository] field of a parsed `package.json` object. Options are passed on to `fromUrl()`.\n\n#### `githost = Githost.fromGit(cwd[, options])`\n\nGet info from git remote origin (taken from local git config). Options:\n\n- `roam` (boolean, default false): look in parent directories too\n- Other options are passed on to `fromUrl()`.\n\n### Properties\n\n#### `githost.type`\n\nString, one of `github`, `gist`, `gitlab` or `bitbucket`.\n\n#### `githost.owner`\n\nString, repository owner.\n\n#### `githost.name`\n\nString, repository name.\n\n#### `githost.committish`\n\nString if committish is present, else `null`.\n\n#### `githost.format`\n\nString, original format of input URL, one of `shortcut`, `slug`, `https`, `ssh`, `sshurl` or `git`.\n\n#### `githost.raw`\n\nString, original input URL.\n\n#### `githost.hostname`\n\nString, domain of remote, e.g. `github.com` for type `github`.\n\n### Methods\n\n#### `githost.shortcut([options])`\n\nReturns an npm-style shortcut in the form of `type:owner/name(#committish)`. Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, strip committish.\n\n#### `githost.slug([options])`\n\nReturns an npm-style shortcut for GitHub repositories in the form of `owner/name(#committish)`.  Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, strip committish.\n\n#### `githost.https([options])`\n\nReturns Git URL for HTTPS protocol in the form of `https://hostname/owner/name.git(#committish)`, for example `https://github.com/vweevers/find-githost.git`. Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, strip committish.\n\n#### `githost.ssh([options])`\n\nReturns Git URL for SSH protocol in the short form of `git@hostname:owner/name.git(#committish)`, for example `git@github.com:vweevers/find-githost.git`.  Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, strip committish.\n\n#### `githost.sshurl([options])`\n\nReturns Git URL for SSH protocol in the long form of `ssh://git@hostname/owner/name.git(#committish)`, for example `ssh://git@github.com/vweevers/find-githost.git`.  Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, strip committish.\n\n#### `githost.git([options])`\n\nReturns Git URL for Git protocol in the form of `git://hostname/owner/name.git(#committish)`, for example `git://github.com/vweevers/find-githost.git`.  Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, strip committish.\n\n#### `githost.homepage()`\n\nReturns HTTP(S) URL of homepage, for example `https://github.com/vweevers/find-githost`.\n\n#### `githost.bugs()`\n\nReturns HTTP(S) URL of issue tracker, for example `https://github.com/vweevers/find-githost/issues`.\n\n#### `githost.browse([path][, fragment][, options])`\n\nReturns HTTP(S) URL for browsing a file or directory. For example `https://github.com/vweevers/find-githost/tree/main/README.md#usage` given path `README.md` and fragment `#usage`. For the top-most directory, omit the `path` argument or use `/`. Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, use default branch.\n- `defaultBranch` (string, default `main`): branch name to use when committish is not present.\n\n#### `githost.file(path[, options])`\n\nReturns HTTP(S) URL for the raw contents of `path`, for example `https://raw.githubusercontent.com/vweevers/find-githost/main/index.js` given path `index.js`. Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, use default branch.\n- `defaultBranch` (string, default `main`): branch name to use when committish is not present.\n\n#### `githost.tarball([options])`\n\nReturns HTTP(S) tarball URL, for example `https://codeload.github.com/vweevers/find-githost/tar.gz/v1.0.0` given committish `v1.0.0`. Options:\n\n- `committish` (string or boolean): if a string, override committish. If `false`, use default branch.\n- `defaultBranch` (string, default `main`): branch name to use when committish is not present.\n\n#### `githost.toString([options])`\n\nReturns a string representation. Options:\n\n- `format` (string, defaults to format of input): one of `shortcut`, `slug`, `https`, `ssh`, `sshurl`, `git`.\n- `committish` (string or boolean): if a string, override committish. If `false`, strip committish.\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install find-githost\n```\n\n## License\n\n[MIT](LICENSE) © Vincent Weevers\n\n[repository]: https://docs.npmjs.com/cli/v6/configuring-npm/package-json#repository","users":{}}